<?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>
|