|
@@ -0,0 +1,44 @@
|
|
|
|
+package com.chelvc.cloud.maintain.controller;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
+import javax.validation.constraints.Min;
|
|
|
|
+
|
|
|
|
+import com.chelvc.cloud.maintain.copier.CommentCopier;
|
|
|
|
+import com.chelvc.cloud.maintain.vo.CommentVO;
|
|
|
|
+import com.chelvc.cloud.vehicle.api.param.CommentQueryParam;
|
|
|
|
+import com.chelvc.cloud.vehicle.api.service.CommentService;
|
|
|
|
+import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 商品评价接口
|
|
|
|
+ *
|
|
|
|
+ * @author Woody
|
|
|
|
+ * @date 2023/8/7
|
|
|
|
+ */
|
|
|
|
+@Validated
|
|
|
|
+@RestController
|
|
|
|
+@UnifiedResponseBody
|
|
|
|
+public class CommentController {
|
|
|
|
+ @DubboReference
|
|
|
|
+ private CommentService commentService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取商品评价列表
|
|
|
|
+ *
|
|
|
|
+ * @param goodsId 商品ID
|
|
|
|
+ * @param param 查询参数
|
|
|
|
+ * @return 商品评价列表
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/goods/{goodsId}/comments")
|
|
|
|
+ public List<CommentVO> listGoodsComments(
|
|
|
|
+ @PathVariable("goodsId") @Min(value = 1, message = "商品ID不能小于1") Long goodsId,
|
|
|
|
+ @Valid CommentQueryParam param) {
|
|
|
|
+ return CommentCopier.INSTANCE.copying(this.commentService.listGoodsComments(goodsId, param));
|
|
|
|
+ }
|
|
|
|
+}
|