- 新增 Category、Collection、Comment 等实体类 - 实现笔记查询、分类、收藏、评论等功能 - 添加 Markdown 解析工具类 - 新增用户点赞和收藏功能 - 实现问题查询和统计功能
37 lines
1.2 KiB
XML
37 lines
1.2 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.example.copykamanotes.mapper.NoteLikeMapper">
|
|
<select id="findUserLikedNoteIds" resultType="integer">
|
|
<if test="noteIds != null and noteIds.size > 0">
|
|
SELECT note_id FROM note_like
|
|
WHERE note_id IN
|
|
<foreach collection="noteIds" item="noteId" open="(" separator="," close=")">
|
|
#{noteId}
|
|
</foreach>
|
|
AND user_id = #{userId}
|
|
</if>
|
|
<if test="noteIds == null or noteIds.size == 0">
|
|
SELECT note_id FROM note_like WHERE 1 = 0
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findByUserIdAndNoteId" resultType="com.example.copykamanotes.model.entity.NoteLike">
|
|
SELECT *
|
|
FROM note_like
|
|
WHERE user_id = #{userId}
|
|
AND note_id = #{noteId}
|
|
</select>
|
|
|
|
<insert id="insert">
|
|
INSERT INTO note_like (user_id, note_id)
|
|
VALUES (#{userId}, #{noteId})
|
|
</insert>
|
|
|
|
<delete id="delete">
|
|
DELETE
|
|
FROM note_like
|
|
WHERE user_id = #{userId}
|
|
AND note_id = #{noteId}
|
|
</delete>
|
|
</mapper>
|