Browse Source

修改领养日记部分sql问题

glx_phase2
glx 5 days ago
parent
commit
9cda7d3986
  1. 8
      src/main/resources/mapper/mini/MiniAdoptionDiaryCommentLikeMapper.xml
  2. 4
      src/main/resources/mapper/mini/MiniAdoptionDiaryCommentMapper.xml

8
src/main/resources/mapper/mini/MiniAdoptionDiaryCommentLikeMapper.xml

@ -10,7 +10,7 @@
<select id="selectUserLikeCount" resultType="java.lang.Integer"> <select id="selectUserLikeCount" resultType="java.lang.Integer">
SELECT COUNT(1) SELECT COUNT(1)
FROM mini_adoption_diary_comment_like FROM mini_adoption_diary_comment_like
WHERE note_comment_id = #{commentId} WHERE diary_comment_id = #{commentId}
AND mini_user_id = #{userId} AND mini_user_id = #{userId}
AND is_deleted = 0 AND is_deleted = 0
</select> </select>
@ -18,9 +18,9 @@
<!-- 新增或更新点赞记录 --> <!-- 新增或更新点赞记录 -->
<insert id="insertOrUpdateLike"> <insert id="insertOrUpdateLike">
INSERT INTO mini_adoption_diary_comment_like INSERT INTO mini_adoption_diary_comment_like
(uuid, note_comment_id, mini_user_id, create_timestamp, create_time, create_by, is_deleted) (uuid, diary_comment_id, mini_user_id, create_timestamp, create_time, create_by, is_deleted)
VALUES VALUES
(#{uuid}, #{noteCommentId}, #{miniUserId}, #{createTimestamp}, #{createTime}, #{createBy}, 0) (#{uuid}, #{diaryCommentId}, #{miniUserId}, #{createTimestamp}, #{createTime}, #{createBy}, 0)
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
is_deleted = 0, is_deleted = 0,
update_timestamp = #{createTimestamp}, update_timestamp = #{createTimestamp},
@ -35,7 +35,7 @@
update_time = NOW(), update_time = NOW(),
update_timestamp = #{currentTime}, update_timestamp = #{currentTime},
update_by = #{userId} update_by = #{userId}
WHERE note_comment_id = #{commentId} WHERE diary_comment_id = #{commentId}
AND mini_user_id = #{userId} AND mini_user_id = #{userId}
AND is_deleted = 0 AND is_deleted = 0
</update> </update>

4
src/main/resources/mapper/mini/MiniAdoptionDiaryCommentMapper.xml

@ -85,13 +85,13 @@
<!-- 批量查询用户对指定评论的点赞状态 --> <!-- 批量查询用户对指定评论的点赞状态 -->
<select id="batchGetUserCommentLikes" resultType="com.youlai.boot.mini.model.entity.MiniAdoptionDiaryCommentLike"> <select id="batchGetUserCommentLikes" resultType="com.youlai.boot.mini.model.entity.MiniAdoptionDiaryCommentLike">
SELECT SELECT
note_comment_id AS noteCommentId, diary_comment_id AS diaryCommentId,
mini_user_id AS miniUserId mini_user_id AS miniUserId
FROM FROM
mini_adoption_diary_comment_like mini_adoption_diary_comment_like
WHERE WHERE
mini_user_id = #{userId} mini_user_id = #{userId}
AND note_comment_id IN AND diary_comment_id IN
<foreach item="commentId" collection="commentIds" open="(" separator="," close=")"> <foreach item="commentId" collection="commentIds" open="(" separator="," close=")">
#{commentId} #{commentId}
</foreach> </foreach>

Loading…
Cancel
Save