lambda化
This commit is contained in:
parent
34a2f412d1
commit
18b9c514a3
@ -65,15 +65,6 @@ public class CommentController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("admin:comment:save")
|
||||
@ApiOperation("评论保存")
|
||||
public R save(@RequestBody CommentEntity comment){
|
||||
commentService.save(comment);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/update")
|
||||
@RequiresPermissions("admin:comment:update")
|
||||
|
@ -54,9 +54,11 @@ public class CommentServiceImpl extends ServiceImpl<CommentDao, CommentEntity> i
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
QueryWrapper<CommentEntity> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().orderByDesc(CommentEntity::getId);
|
||||
IPage<CommentEntity> page = this.page(
|
||||
new Query<CommentEntity>().getPage(params),
|
||||
new QueryWrapper<>()
|
||||
queryWrapper
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
@ -90,10 +92,9 @@ public class CommentServiceImpl extends ServiceImpl<CommentDao, CommentEntity> i
|
||||
|
||||
@Override
|
||||
public Integer getCountByPostId(Integer id) {
|
||||
return baseMapper.selectCount(
|
||||
new LambdaQueryWrapper<CommentEntity>()
|
||||
.eq(CommentEntity::getStatus, Constant.COMMENT_NORMAL)
|
||||
.eq(CommentEntity::getPostId, id));
|
||||
return this.lambdaQuery()
|
||||
.eq(CommentEntity::getStatus, Constant.COMMENT_NORMAL)
|
||||
.eq(CommentEntity::getPostId, id).count();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user