牛客网社区项目——p3.5显示评论

本文介绍了如何通过编程实现牛客网社区项目的评论显示功能。首先创建了Comment实体类,接着编写了DAO层和mapper配置文件,然后实现了业务逻辑层,最后在表现层进行处理并配置了模板文件。
摘要由CSDN通过智能技术生成

编程思路如下
在这里插入图片描述先建立实体类Comment,代码:略

DAO层代码

@Mapper
public interface CommentMapper {
   
    List<Comment> selectCommentsByEntity(int entityType, int entityId, int offset, int limit);
    int selectCountByEntity(int entityType, int entityId);
}

配置对应的comment-mapper.xml文件

业务层代码如下

@Service
public class CommentService implements CommunityConstant {
   
    @Autowired(required = false)
    private CommentMapper commentMapper;
    public List<Comment> findCommentsByEntity(int entityType, int entityId, int offset, int limit){
   
        return commentMapper.selectCommentsByEntity(entityType, entityId, offset, limit);
    }
    public int findCommentCount(int entityType, int entityId)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值