Commit c48f52ec9a30857ffc0fa3bac734a9f834bb5b4d

Authored by YunaiV
1 parent cb015642

feat(mall):评论详情接口

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 7 import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO;
8 8 import cn.iocoder.yudao.module.product.service.comment.ProductCommentService;
9 9 import io.swagger.v3.oas.annotations.Operation;
  10 +import io.swagger.v3.oas.annotations.Parameter;
10 11 import io.swagger.v3.oas.annotations.tags.Tag;
11 12 import jakarta.annotation.Resource;
12 13 import jakarta.validation.Valid;
... ... @@ -34,6 +35,15 @@ public class ProductCommentController {
34 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 47 @PutMapping("/update-visible")
38 48 @Operation(summary = "显示 / 隐藏评论")
39 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 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 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 140 }
141 141  
142 142 @Override
  143 + public ProductCommentDO getComment(Long id) {
  144 + return validateCommentExists(id);
  145 + }
  146 +
  147 + @Override
143 148 public PageResult<ProductCommentDO> getCommentPage(ProductCommentPageReqVO pageReqVO) {
144 149 return productCommentMapper.selectPage(pageReqVO);
145 150 }
... ...