Commit 5ffea937314d9cb7b5a5a4fdb7f2acb5a6dfa0b8
1 parent
846405d8
mall + product:
1、完善商品评论列表的 mock
Showing
4 changed files
with
6 additions
and
9 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/AppProductCommentController.java
| ... | ... | @@ -85,7 +85,7 @@ public class AppProductCommentController { |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // TODO 芋艿:需要搞下 |
| 88 | - @GetMapping("/getCommentStatistics") | |
| 88 | + @GetMapping("/statistics") | |
| 89 | 89 | @Operation(summary = "获得商品的评价统计") |
| 90 | 90 | public CommonResult<AppCommentStatisticsRespVO> getCommentStatistics(@Valid @RequestParam("spuId") Long spuId) { |
| 91 | 91 | return success(productCommentService.getCommentStatistics(spuId, Boolean.TRUE)); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/comment/vo/AppCommentStatisticsRespVO.java
| ... | ... | @@ -9,9 +9,6 @@ import lombok.ToString; |
| 9 | 9 | @ToString(callSuper = true) |
| 10 | 10 | public class AppCommentStatisticsRespVO { |
| 11 | 11 | |
| 12 | - @Schema(description = "所有评论数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721") | |
| 13 | - private Long allCount; | |
| 14 | - | |
| 15 | 12 | @Schema(description = "好评数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721") |
| 16 | 13 | private Long goodCount; |
| 17 | 14 | |
| ... | ... | @@ -21,4 +18,7 @@ public class AppCommentStatisticsRespVO { |
| 21 | 18 | @Schema(description = "差评数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15721") |
| 22 | 19 | private Long negativeCount; |
| 23 | 20 | |
| 21 | + @Schema(description = "总平均分", requiredMode = Schema.RequiredMode.REQUIRED, example = "3.55") | |
| 22 | + private Double scores; | |
| 23 | + | |
| 24 | 24 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/comment/ProductCommentConvert.java
| ... | ... | @@ -33,11 +33,10 @@ public interface ProductCommentConvert { |
| 33 | 33 | ProductCommentRespVO convert(ProductCommentDO bean); |
| 34 | 34 | |
| 35 | 35 | // TODO @puhui999:这里貌似字段对上,就不用 mapping 了;可以测试下看看哈 |
| 36 | - @Mapping(target = "allCount", source = "allCount") | |
| 37 | 36 | @Mapping(target = "goodCount", source = "goodCount") |
| 38 | 37 | @Mapping(target = "mediocreCount", source = "mediocreCount") |
| 39 | 38 | @Mapping(target = "negativeCount", source = "negativeCount") |
| 40 | - AppCommentStatisticsRespVO convert(Long allCount, Long goodCount, Long mediocreCount, Long negativeCount); | |
| 39 | + AppCommentStatisticsRespVO convert(Long goodCount, Long mediocreCount, Long negativeCount); | |
| 41 | 40 | |
| 42 | 41 | List<ProductCommentRespVO> convertList(List<ProductCommentDO> list); |
| 43 | 42 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImpl.java
| ... | ... | @@ -135,15 +135,13 @@ public class ProductCommentServiceImpl implements ProductCommentService { |
| 135 | 135 | @Override |
| 136 | 136 | public AppCommentStatisticsRespVO getCommentStatistics(Long spuId, Boolean visible) { |
| 137 | 137 | return ProductCommentConvert.INSTANCE.convert( |
| 138 | - // 查询商品 id = spuId 的所有评论数量 | |
| 139 | - productCommentMapper.selectCountBySpuId(spuId, visible, null), | |
| 140 | 138 | // 查询商品 id = spuId 的所有好评数量 |
| 141 | 139 | productCommentMapper.selectCountBySpuId(spuId, visible, AppCommentPageReqVO.GOOD_COMMENT), |
| 142 | 140 | // 查询商品 id = spuId 的所有中评数量 |
| 143 | 141 | productCommentMapper.selectCountBySpuId(spuId, visible, AppCommentPageReqVO.MEDIOCRE_COMMENT), |
| 144 | 142 | // 查询商品 id = spuId 的所有差评数量 |
| 145 | 143 | productCommentMapper.selectCountBySpuId(spuId, visible, AppCommentPageReqVO.NEGATIVE_COMMENT) |
| 146 | - ); | |
| 144 | + ).setScores(3.0); // TODO @puhui999:这里要实现下;; | |
| 147 | 145 | } |
| 148 | 146 | |
| 149 | 147 | @Override | ... | ... |