puzhibing
2023-07-12 aa43a92c7ec9053dbaef92fe5ccb3011b670442c
cloud-server-activity/src/main/resources/mapper/BenefitsVideosMapper.xml
@@ -3,4 +3,32 @@
<mapper namespace="com.dsh.activity.mapper.BenefitsVideosMapper">
    <select id="queryBenefitsVideosList" resultType="map">
        select * from (
            (select
            id,
            courseId,
            integral,
            0 as study
            from t_benefits_videos where state = 1 and id not in (select benefitsVideosId from t_user_benefits_videos where appUserId = #{uid})
            <if test="null != classificationId">
                and benefitsVideoClassificationId = #{classificationId}
            </if>
            order by insertTime desc)
            union all
            (select
            id,
            courseId,
            integral,
            1 as study
            from t_benefits_videos where state = 1 and id in (select benefitsVideosId from t_user_benefits_videos where appUserId = #{uid})
            <if test="null != classificationId">
                and benefitsVideoClassificationId = #{classificationId}
            </if>
            order by insertTime desc)
        ) as a limit #{pageSize}, #{pageNo}
    </select>
</mapper>