xiangpei
2025-05-29 817c7de04cb6b74164a42ed0e6050ae5b91b0ef1
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
<?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.MyCollectMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.MyCollectVO">
        <id column="id" property="id"/>
        <result column="user_id" property="userId" />
        <result column="collect_type" property="collectType" />
        <result column="ref_id" property="refId" />
    </resultMap>
 
 
 
 
 
 
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LMC.user_id,
            LMC.collect_type,
            LMC.ref_id,
            LMC.id
        FROM
            lmk_my_collect LMC
        WHERE
            LMC.id = #{id} AND LMC.delete_flag = 0
    </select>
 
 
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            LMC.user_id,
            LMC.collect_type,
            LMC.ref_id,
            LMC.id
        FROM
            lmk_my_collect LMC
        WHERE
            LMC.delete_flag = 0
    </select>
 
    <select id="getCollectsByVideoIds" resultType="cn.lili.modules.lmk.domain.vo.SimpleMyCollectVO">
        SELECT
               id,
               ref_id as refId
        FROM
             lmk_my_collect
        WHERE
              user_id = #{userId}
          AND delete_flag = 0
          AND collect_type = 'video'
          AND ref_id IN <foreach collection="videoIds" open="(" item="videoId" close=")" separator=",">#{videoId}</foreach>
    </select>
 
    <select id="countNumGroupByType" parameterType="string" resultType="cn.lili.modules.lmk.domain.vo.CollectTypeNumVO">
        SELECT
               ref_id as id,
               count(id) as countNum
        FROM
             lmk_my_collect
        WHERE
              collect_type = #{type} AND delete_flag = 0
        GROUP BY
            ref_id
    </select>
 
</mapper>