puzhibing
2023-11-25 7fe6d026bcc8f993ce76437d01607e591cc671fe
cloud-server-activity/src/main/resources/mapper/BenefitsVideosMapper.xml
@@ -4,41 +4,43 @@
    <select id="queryBenefitsVideosList" resultType="java.util.Map">
            (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>
            <if test="null != ids">
                and courseId in
                <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            order by insertTime desc)
        (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>
        <if test="null != ids">
            and courseId in
            <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by insertTime desc)
            union all
        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>
            <if test="null != ids">
                and courseId in
                <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
            order by insertTime desc)
        (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>
        <if test="null != ids">
            and courseId in
            <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by insertTime desc)
        LIMIT #{limit} OFFSET #{offset}
    </select>
    <select id="getBenefitVideoById" resultType="com.dsh.activity.entity.BenefitsVideos">