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")
|
@PostMapping("/update")
|
||||||
@RequiresPermissions("admin:comment:update")
|
@RequiresPermissions("admin:comment:update")
|
||||||
|
@ -54,9 +54,11 @@ public class CommentServiceImpl extends ServiceImpl<CommentDao, CommentEntity> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
|
QueryWrapper<CommentEntity> queryWrapper=new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().orderByDesc(CommentEntity::getId);
|
||||||
IPage<CommentEntity> page = this.page(
|
IPage<CommentEntity> page = this.page(
|
||||||
new Query<CommentEntity>().getPage(params),
|
new Query<CommentEntity>().getPage(params),
|
||||||
new QueryWrapper<>()
|
queryWrapper
|
||||||
);
|
);
|
||||||
|
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
@ -90,10 +92,9 @@ public class CommentServiceImpl extends ServiceImpl<CommentDao, CommentEntity> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getCountByPostId(Integer id) {
|
public Integer getCountByPostId(Integer id) {
|
||||||
return baseMapper.selectCount(
|
return this.lambdaQuery()
|
||||||
new LambdaQueryWrapper<CommentEntity>()
|
|
||||||
.eq(CommentEntity::getStatus, Constant.COMMENT_NORMAL)
|
.eq(CommentEntity::getStatus, Constant.COMMENT_NORMAL)
|
||||||
.eq(CommentEntity::getPostId, id));
|
.eq(CommentEntity::getPostId, id).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user