diff --git a/src/main/java/io/linfeng/modules/admin/controller/CommentController.java b/src/main/java/io/linfeng/modules/admin/controller/CommentController.java index ec84279..d9c4cec 100644 --- a/src/main/java/io/linfeng/modules/admin/controller/CommentController.java +++ b/src/main/java/io/linfeng/modules/admin/controller/CommentController.java @@ -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") diff --git a/src/main/java/io/linfeng/modules/admin/service/impl/CommentServiceImpl.java b/src/main/java/io/linfeng/modules/admin/service/impl/CommentServiceImpl.java index aff1cd5..ecb8a93 100644 --- a/src/main/java/io/linfeng/modules/admin/service/impl/CommentServiceImpl.java +++ b/src/main/java/io/linfeng/modules/admin/service/impl/CommentServiceImpl.java @@ -54,9 +54,11 @@ public class CommentServiceImpl extends ServiceImpl i @Override public PageUtils queryPage(Map params) { + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.lambda().orderByDesc(CommentEntity::getId); IPage page = this.page( new Query().getPage(params), - new QueryWrapper<>() + queryWrapper ); return new PageUtils(page); @@ -90,10 +92,9 @@ public class CommentServiceImpl extends ServiceImpl i @Override public Integer getCountByPostId(Integer id) { - return baseMapper.selectCount( - new LambdaQueryWrapper() - .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