229 lines
7.0 KiB
XML
229 lines
7.0 KiB
XML
<?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.imooc.mapper.VlogMapperCustom" >
|
|
|
|
<select id="getIndexVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
|
SELECT
|
|
v.id as vlogId,
|
|
v.vloger_id as vlogerId,
|
|
u.face as vlogerFace,
|
|
u.nickname as vlogerName,
|
|
v.title as content,
|
|
v.url as url,
|
|
v.cover as cover,
|
|
v.width as width,
|
|
v.height as height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentsCounts,
|
|
v.is_private as isPrivate,
|
|
v.city_code as cityCode,
|
|
v.reason as reason,
|
|
v.file_id as fileId,
|
|
v.status as status,
|
|
v.first_frame_img as firstFrameImg
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN
|
|
t_users u
|
|
ON
|
|
v.vloger_id = u.id
|
|
WHERE
|
|
v.is_private = 0
|
|
<choose>
|
|
<when test="paramMap.status != null and paramMap.status!=''">
|
|
AND v.status = #{paramMap.status}
|
|
</when>
|
|
<otherwise>
|
|
AND v.status = 1
|
|
</otherwise>
|
|
</choose>
|
|
AND v.first_frame_img IS NOT NULL
|
|
<if test="paramMap.cityCode != null and paramMap.cityCode != ''">
|
|
AND v.city_code = #{paramMap.cityCode}
|
|
</if>
|
|
<if test="paramMap.search != null and paramMap.search != ''">
|
|
AND v.title like '%${paramMap.search}%'
|
|
</if>
|
|
<if test="paramMap.blockVd != null and paramMap.blockVd.size() > 0">
|
|
AND v.id NOT IN
|
|
<foreach collection="paramMap.blockVd" item="vlogId" open="(" separator="," close=")">
|
|
#{vlogId}
|
|
</foreach>
|
|
</if>
|
|
<if test="paramMap.blockUser != null and paramMap.blockUser.size() > 0">
|
|
AND v.vloger_id NOT IN
|
|
<foreach collection="paramMap.blockUser" item="vlogerId" open="(" separator="," close=")">
|
|
#{vlogerId}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY
|
|
v.created_time
|
|
DESC
|
|
</select>
|
|
|
|
|
|
<select id="getVlogDetailById" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
|
SELECT
|
|
v.id as vlogId,
|
|
v.vloger_id as vlogerId,
|
|
u.face as vlogerFace,
|
|
u.nickname as vlogerName,
|
|
v.title as content,
|
|
v.url as url,
|
|
v.cover as cover,
|
|
v.width as width,
|
|
v.height as height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentsCounts,
|
|
v.is_private as isPrivate,
|
|
v.city_code as cityCode,
|
|
v.reason as reason,
|
|
v.file_id as fileId,
|
|
v.status as status,
|
|
v.first_frame_img as firstFrameImg
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN
|
|
t_users u
|
|
ON
|
|
v.vloger_id = u.id
|
|
WHERE
|
|
v.id = #{paramMap.vlogId}
|
|
AND v.status = 1
|
|
AND v.first_frame_img IS NOT NULL
|
|
</select>
|
|
|
|
<select id="getMyLikedVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
|
SELECT
|
|
v.id as vlogId,
|
|
v.vloger_id as vlogerId,
|
|
-- u.face as vlogerFace,
|
|
-- u.nickname as vlogerName,
|
|
v.title as content,
|
|
v.url as url,
|
|
v.cover as cover,
|
|
v.width as width,
|
|
v.height as height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentsCounts,
|
|
v.is_private as isPrivate,
|
|
v.city_code as cityCode,
|
|
v.reason as reason,
|
|
v.status as status,
|
|
v.file_id as fileId,
|
|
v.first_frame_img as firstFrameImg
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN
|
|
t_my_liked_vlog mlv
|
|
ON
|
|
v.id = mlv.vlog_id
|
|
LEFT JOIN
|
|
t_users u
|
|
ON
|
|
mlv.user_id = u.id
|
|
WHERE
|
|
u.id = #{paramMap.userId}
|
|
AND v.status = 1
|
|
AND v.first_frame_img IS NOT NULL
|
|
AND v.is_private = 0
|
|
<if test="paramMap.blockVd != null and paramMap.blockVd.size() > 0">
|
|
AND v.id NOT IN
|
|
<foreach collection="paramMap.blockVd" item="vlogId" open="(" separator="," close=")">
|
|
#{vlogId}
|
|
</foreach>
|
|
</if>
|
|
<if test="paramMap.blockUser != null and paramMap.blockUser.size() > 0">
|
|
AND v.vloger_id NOT IN
|
|
<foreach collection="paramMap.blockUser" item="vlogerId" open="(" separator="," close=")">
|
|
#{vlogerId}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY
|
|
v.created_time
|
|
DESC
|
|
</select>
|
|
|
|
<select id="getMyFollowVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
|
SELECT
|
|
v.id as vlogId,
|
|
v.vloger_id as vlogerId,
|
|
u.face as vlogerFace,
|
|
u.nickname as vlogerName,
|
|
v.title as content,
|
|
v.url as url,
|
|
v.cover as cover,
|
|
v.width as width,
|
|
v.height as height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentsCounts,
|
|
v.is_private as isPrivate,
|
|
v.city_code as cityCode,
|
|
v.reason as reason,
|
|
v.status as status,
|
|
v.file_id as fileId,
|
|
v.first_frame_img as firstFrameImg
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN
|
|
t_fans f
|
|
ON
|
|
v.vloger_id = f.vloger_id
|
|
LEFT JOIN
|
|
t_users u
|
|
ON
|
|
f.vloger_id = u.id
|
|
WHERE
|
|
v.is_private = 0
|
|
AND v.status = 1
|
|
AND v.first_frame_img IS NOT NULL
|
|
AND
|
|
f.fan_id = #{paramMap.myId}
|
|
ORDER BY
|
|
v.created_time
|
|
DESC
|
|
</select>
|
|
|
|
<select id="getMyFriendVlogList" parameterType="map" resultType="com.imooc.vo.IndexVlogVO">
|
|
SELECT
|
|
v.id as vlogId,
|
|
v.vloger_id as vlogerId,
|
|
u.face as vlogerFace,
|
|
u.nickname as vlogerName,
|
|
v.title as content,
|
|
v.url as url,
|
|
v.cover as cover,
|
|
v.width as width,
|
|
v.height as height,
|
|
v.like_counts as likeCounts,
|
|
v.comments_counts as commentsCounts,
|
|
v.is_private as isPrivate,
|
|
v.city_code as cityCode,
|
|
v.reason as reason,
|
|
v.status as status,
|
|
v.file_id as fileId,
|
|
v.first_frame_img as firstFrameImg
|
|
FROM
|
|
t_vlog v
|
|
LEFT JOIN
|
|
t_fans f
|
|
ON
|
|
v.vloger_id = f.fan_id
|
|
LEFT JOIN
|
|
t_users u
|
|
ON
|
|
f.fan_id = u.id
|
|
WHERE
|
|
v.is_private = 0
|
|
AND v.status = 1
|
|
AND v.first_frame_img IS NOT NULL
|
|
AND
|
|
f.vloger_id = #{paramMap.myId}
|
|
AND
|
|
f.is_fan_friend_of_mine = 1
|
|
ORDER BY
|
|
v.created_time
|
|
DESC
|
|
</select>
|
|
|
|
</mapper> |