Commit c48f52ec9a30857ffc0fa3bac734a9f834bb5b4d
1 parent
cb015642
feat(mall):评论详情接口
Showing
3 changed files
with
23 additions
and
0 deletions
yudao-module-mall/yudao-module-product/src/main/java/cn/iocoder/yudao/module/product/controller/admin/comment/ProductCommentController.java
| @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.product.controller.admin.comment.vo.*; | @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.product.controller.admin.comment.vo.*; | ||
| 7 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 7 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 8 | import cn.iocoder.yudao.module.product.service.comment.ProductCommentService; | 8 | import cn.iocoder.yudao.module.product.service.comment.ProductCommentService; |
| 9 | import io.swagger.v3.oas.annotations.Operation; | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 10 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 10 | import io.swagger.v3.oas.annotations.tags.Tag; | 11 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 11 | import jakarta.annotation.Resource; | 12 | import jakarta.annotation.Resource; |
| 12 | import jakarta.validation.Valid; | 13 | import jakarta.validation.Valid; |
| @@ -34,6 +35,15 @@ public class ProductCommentController { | @@ -34,6 +35,15 @@ public class ProductCommentController { | ||
| 34 | return success(BeanUtils.toBean(pageResult, ProductCommentRespVO.class)); | 35 | return success(BeanUtils.toBean(pageResult, ProductCommentRespVO.class)); |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 38 | + @GetMapping("/get") | ||
| 39 | + @Operation(summary = "获得商品评价") | ||
| 40 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('product:comment:query')") | ||
| 42 | + public CommonResult<ProductCommentRespVO> getComment(@RequestParam("id") Long id) { | ||
| 43 | + ProductCommentDO comment = productCommentService.getComment(id); | ||
| 44 | + return success(BeanUtils.toBean(comment, ProductCommentRespVO.class)); | ||
| 45 | + } | ||
| 46 | + | ||
| 37 | @PutMapping("/update-visible") | 47 | @PutMapping("/update-visible") |
| 38 | @Operation(summary = "显示 / 隐藏评论") | 48 | @Operation(summary = "显示 / 隐藏评论") |
| 39 | @PreAuthorize("@ss.hasPermission('product:comment:update')") | 49 | @PreAuthorize("@ss.hasPermission('product:comment:update')") |
yudao-module-mall/yudao-module-product/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentService.java
| @@ -53,6 +53,14 @@ public interface ProductCommentService { | @@ -53,6 +53,14 @@ public interface ProductCommentService { | ||
| 53 | void replyComment(ProductCommentReplyReqVO replyVO, Long userId); | 53 | void replyComment(ProductCommentReplyReqVO replyVO, Long userId); |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | + * 【管理员】获得商品评价 | ||
| 57 | + * | ||
| 58 | + * @param id 评价编号 | ||
| 59 | + * @return 商品评价 | ||
| 60 | + */ | ||
| 61 | + ProductCommentDO getComment(Long id); | ||
| 62 | + | ||
| 63 | + /** | ||
| 56 | * 【管理员】获得商品评价分页 | 64 | * 【管理员】获得商品评价分页 |
| 57 | * | 65 | * |
| 58 | * @param pageReqVO 分页查询 | 66 | * @param pageReqVO 分页查询 |
yudao-module-mall/yudao-module-product/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImpl.java
| @@ -140,6 +140,11 @@ public class ProductCommentServiceImpl implements ProductCommentService { | @@ -140,6 +140,11 @@ public class ProductCommentServiceImpl implements ProductCommentService { | ||
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | @Override | 142 | @Override |
| 143 | + public ProductCommentDO getComment(Long id) { | ||
| 144 | + return validateCommentExists(id); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + @Override | ||
| 143 | public PageResult<ProductCommentDO> getCommentPage(ProductCommentPageReqVO pageReqVO) { | 148 | public PageResult<ProductCommentDO> getCommentPage(ProductCommentPageReqVO pageReqVO) { |
| 144 | return productCommentMapper.selectPage(pageReqVO); | 149 | return productCommentMapper.selectPage(pageReqVO); |
| 145 | } | 150 | } |