You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
817 B

This file contains ambiguous Unicode characters!

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.

package com.example.mapper;
import com.example.entity.Comment;
import org.apache.ibatis.annotations.Select;
import java.util.List;
// 评论数据访问接口
public interface CommentMapper {
// 新增评论
int insert(Comment comment);
// 根据ID删除评论
int deleteById(Integer id);
// 根据ID修改评论
int updateById(Comment comment);
// 根据ID查询评论
Comment selectById(Integer id);
// 查询所有评论(可条件查询)
List<Comment> selectAll(Comment comment);
// 根据商品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}")
List<Comment> selectByGoodsId(Integer id);
}