This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
packagecom.example.mapper;
importcom.example.entity.Comment;
importorg.apache.ibatis.annotations.Select;
importjava.util.List;
// 评论数据访问接口
publicinterfaceCommentMapper{
// 新增评论
intinsert(Commentcomment);
// 根据ID删除评论
intdeleteById(Integerid);
// 根据ID修改评论
intupdateById(Commentcomment);
// 根据ID查询评论
CommentselectById(Integerid);
// 查询所有评论(可条件查询)
List<Comment>selectAll(Commentcomment);
// 根据商品ID查询评论(关联查询用户信息)
@Select("select comment.*, user.avatar as userAvatar, user.name as userName from comment left join user on comment.user_id = user.id where comment.goods_id = #{id}")