zxl
5 天以前 b76f0174ce81d7639bf33cc10e67cb6b9e85de3f
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?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="cn.lili.modules.lmk.mapper.ThumbsUpRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.ThumbsUpRecordVO">
        <id column="id" property="id"/>
        <result column="ref_id" property="refId" />
        <result column="thumbs_up_type" property="thumbsUpType" />
        <result column="user_id" property="userId" />
    </resultMap>
 
 
 
 
 
 
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LTUR.ref_id,
            LTUR.thumbs_up_type,
            LTUR.user_id,
            LTUR.id
        FROM
            lmk_thumbs_up_record LTUR
        WHERE
            LTUR.id = #{id} AND LTUR.delete_flag = 0
    </select>
 
 
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            LTUR.ref_id,
            LTUR.user_id,
            LTUR.thumbs_up_type,
            LTUR.id
        FROM
            lmk_thumbs_up_record LTUR
        WHERE
            LTUR.delete_flag = 0
    </select>
 
 
    <select id="countNumGroupByComment" resultType="cn.lili.modules.lmk.domain.vo.CollectTypeNumVO">
        SELECT
               LVC.id as id,
               count(LTUR.ref_id) as countNum
        FROM
             lmk_video_comment LVC
                LEFT JOIN lmk_thumbs_up_record LTUR ON LTUR.ref_id = LVC.id AND LTUR.thumbs_up_type = 'video_comment' AND LTUR.delete_flag = 0
        WHERE
              LVC.thumbs_up_job = 1
              AND LVC.delete_flag = 0
        GROUP BY
             LTUR.ref_id
    </select>
 
    <select id="countNumGroupByVideo" resultType="cn.lili.modules.lmk.domain.vo.CollectTypeNumVO">
        SELECT
            LV.id as id,
            count(LTUR.ref_id) as countNum
        FROM
            lmk_video LV
                LEFT JOIN lmk_thumbs_up_record LTUR ON LTUR.ref_id = LV.id AND LTUR.thumbs_up_type = 'video' AND LTUR.delete_flag = 0
        WHERE
            LV.thumbs_up_num_job = 1
            AND LV.delete_flag = 0
        GROUP BY
            LTUR.ref_id
    </select>
 
    <select id="getThumbssByVideoIds" resultType="cn.lili.modules.lmk.domain.vo.SimpleMyThumbsUpVO">
        SELECT
            id,
            ref_id as refId
        FROM
            lmk_thumbs_up_record
        WHERE
            user_id = #{userId}
            AND delete_flag = 0
            AND thumbs_up_type = 'video'
            AND ref_id IN <foreach collection="videoIds" open="(" item="videoId" close=")" separator=",">#{videoId}</foreach>
    </select>
 
</mapper>