vlog/book-mapper/src/main/resources/mapper/VlogMapperCustom.xml

229 lines
7.0 KiB
XML
Raw Normal View History

2025-03-10 15:40:51 +08:00
<?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,
2025-04-03 11:25:24 +08:00
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
2025-03-10 15:40:51 +08:00
FROM
2025-03-14 11:30:58 +08:00
t_vlog v
2025-03-10 15:40:51 +08:00
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_users u
2025-03-10 15:40:51 +08:00
ON
v.vloger_id = u.id
WHERE
v.is_private = 0
2025-04-07 15:19:45 +08:00
<choose>
<when test="paramMap.status != null and paramMap.status!=''">
AND v.status = #{paramMap.status}
</when>
<otherwise>
AND v.status = 1
</otherwise>
</choose>
2025-04-03 11:25:24 +08:00
AND v.first_frame_img IS NOT NULL
2025-04-07 15:19:45 +08:00
<if test="paramMap.cityCode != null and paramMap.cityCode != ''">
2025-04-07 18:56:14 +08:00
AND v.city_code = #{paramMap.cityCode}
2025-04-07 15:19:45 +08:00
</if>
2025-03-10 15:40:51 +08:00
<if test="paramMap.search != null and paramMap.search != ''">
AND v.title like '%${paramMap.search}%'
</if>
2025-05-14 04:20:56 +08:00
<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>
2025-03-10 15:40:51 +08:00
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,
2025-04-03 11:25:24 +08:00
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
2025-03-10 15:40:51 +08:00
FROM
2025-03-14 11:30:58 +08:00
t_vlog v
2025-03-10 15:40:51 +08:00
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_users u
2025-03-10 15:40:51 +08:00
ON
v.vloger_id = u.id
WHERE
v.id = #{paramMap.vlogId}
2025-04-03 11:25:24 +08:00
AND v.status = 1
AND v.first_frame_img IS NOT NULL
2025-03-10 15:40:51 +08:00
</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,
2025-04-03 11:25:24 +08:00
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
2025-03-10 15:40:51 +08:00
FROM
2025-03-14 11:30:58 +08:00
t_vlog v
2025-03-10 15:40:51 +08:00
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_my_liked_vlog mlv
2025-03-10 15:40:51 +08:00
ON
v.id = mlv.vlog_id
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_users u
2025-03-10 15:40:51 +08:00
ON
mlv.user_id = u.id
WHERE
u.id = #{paramMap.userId}
2025-04-03 11:25:24 +08:00
AND v.status = 1
AND v.first_frame_img IS NOT NULL
AND v.is_private = 0
2025-05-14 04:20:56 +08:00
<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>
2025-03-10 15:40:51 +08:00
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,
2025-04-03 11:25:24 +08:00
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
2025-03-10 15:40:51 +08:00
FROM
2025-03-14 11:30:58 +08:00
t_vlog v
2025-03-10 15:40:51 +08:00
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_fans f
2025-03-10 15:40:51 +08:00
ON
v.vloger_id = f.vloger_id
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_users u
2025-03-10 15:40:51 +08:00
ON
f.vloger_id = u.id
WHERE
v.is_private = 0
2025-04-03 11:25:24 +08:00
AND v.status = 1
AND v.first_frame_img IS NOT NULL
2025-03-10 15:40:51 +08:00
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,
2025-04-03 11:25:24 +08:00
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
2025-03-10 15:40:51 +08:00
FROM
2025-03-14 11:30:58 +08:00
t_vlog v
2025-03-10 15:40:51 +08:00
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_fans f
2025-03-10 15:40:51 +08:00
ON
v.vloger_id = f.fan_id
LEFT JOIN
2025-03-14 11:30:58 +08:00
t_users u
2025-03-10 15:40:51 +08:00
ON
f.fan_id = u.id
WHERE
v.is_private = 0
2025-04-03 11:25:24 +08:00
AND v.status = 1
AND v.first_frame_img IS NOT NULL
2025-03-10 15:40:51 +08:00
AND
f.vloger_id = #{paramMap.myId}
AND
f.is_fan_friend_of_mine = 1
ORDER BY
v.created_time
DESC
</select>
</mapper>