puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dsh.activity.mapper.BenefitsVideosMapper">
 
 
    <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)
 
        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)
        LIMIT #{limit} OFFSET #{offset}
    </select>
    <select id="getBenefitVideoById" resultType="com.dsh.activity.entity.BenefitsVideos">
        select * from t_benefits_videos where
        t_benefits_videos.benefitsVideoClassificationId = #{id}
    </select>
    <select id="getBybIdAndcId" resultType="com.dsh.activity.entity.BenefitsVideos">
        select * from t_benefits_videos
        where benefitsVideoClassificationId=#{bId} and courseId= #{cId}
    </select>
 
</mapper>