This repository has been archived on 2025-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
copy-kamanote/src/main/java/com/example/copykamanotes/mapper/NoteLikeMapper.java
LingandRX 9a8263b051 feat(service): 实现收藏夹、评论和消息相关功能
- 新增 CollectionService、CommentService 和 MessageService 接口实现类
- 实现了收藏夹、评论和消息相关的业务逻辑
- 更新了 NoteLikeService 和 NoteMapper 接口,增加了点赞和笔记相关方法
- 修改了 application.properties 文件,更新了数据库连接配置
2025-05-11 22:02:12 +08:00

53 lines
1.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.example.copykamanotes.mapper;
import com.example.copykamanotes.model.entity.NoteLike;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface NoteLikeMapper {
/**
* 插入一个点赞记录
*
* @param noteLike 要插入的点赞记录对象包含了用户ID和笔记ID等信息
* @return 返回影响的行数,表示插入操作是否成功
*/
int insert(NoteLike noteLike);
/**
* 删除一个点赞记录对象
*
* @param noteLike 要删除的点赞记录通常包含用户ID和笔记ID以定位数据库中的记录
* @return 返回影响的行数,表示删除操作是否成功
*/
int delete(NoteLike noteLike);
/**
* 根据用户ID和笔记ID列表查找用户点赞过笔记ID列表
* 此方法用于过滤给定的笔记ID列表仅返回该用户标记为点赞过笔记ID
*
* @param userId 用户ID用于标识用户
* @param noteIds 笔记ID列表待过滤的笔记ID集合
* @return 用户点赞过笔记ID列表
*/
List<Integer> findUserLikedNoteIds(
@Param("userId") Long userId,
@Param("noteIds") List<Integer> noteIds
);
/**
* 根据用户ID和笔记ID查找特定的笔记点赞记录
* 此方法用于验证用户是否点赞特定的笔记通过用户ID和笔记ID的组合来查询
*
* @param userId 用户ID用于标识用户
* @param noteId 笔记ID用于标识笔记
* @return 笔记点赞记录如果找到则返回否则返回null
*/
NoteLike findByUserIdAndNoteId(
@Param("userId") Long userId,
@Param("noteId") Integer noteId
);
}