|
@@ -1,114 +0,0 @@
|
|
|
-package com.chelvc.cloud.maintain.controller;
|
|
|
-
|
|
|
-import com.chelvc.cloud.vehicle.api.dto.CommentDTO;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.CommentModifyParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.CommentPagingParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.service.CommentService;
|
|
|
-import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
|
-import com.chelvc.framework.base.model.Pagination;
|
|
|
-import com.chelvc.framework.base.util.ErrorUtils;
|
|
|
-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.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import javax.validation.Valid;
|
|
|
-import javax.validation.constraints.Min;
|
|
|
-
|
|
|
-/**
|
|
|
- * 商家评论业务接口
|
|
|
- *
|
|
|
- * @author liude
|
|
|
- * @date 2023/5/24
|
|
|
- */
|
|
|
-@Validated
|
|
|
-@RestController
|
|
|
-@UnifiedResponseBody
|
|
|
-public class CommentController {
|
|
|
- @DubboReference
|
|
|
- private CommentService commentService;
|
|
|
-
|
|
|
- /**
|
|
|
- * id查找商家评论信息
|
|
|
- *
|
|
|
- * @param id 主键
|
|
|
- * @return 信息
|
|
|
- */
|
|
|
- @GetMapping("/comment/{id}")
|
|
|
- public CommentDTO getComment(@PathVariable("id") @Min(value = 1, message = "主键不能小于1") Long id) {
|
|
|
- CommentDTO comment = this.commentService.getComment(id);
|
|
|
- ErrorUtils.requireResource(comment, "该商家评论不存在");
|
|
|
- return comment;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * 更新商家评论
|
|
|
- * @param param 更新参数
|
|
|
- * @param id 主键
|
|
|
- */
|
|
|
- @PostMapping("/comment/{id}")
|
|
|
- public void updateComment(@PathVariable("id") @Min(value = 1, message = "主键不能小于1") Long id,
|
|
|
- @RequestBody @Valid CommentModifyParam param) {
|
|
|
- this.commentService.updateComment(id, param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加商家评论
|
|
|
- * @param param 修改参数
|
|
|
- */
|
|
|
- @PostMapping("/comment")
|
|
|
- public void addComment(@RequestBody @Valid CommentModifyParam param) {
|
|
|
- this.commentService.addComment(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 分页查询 主键
|
|
|
- *
|
|
|
- * @param param 分页参数
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/comment/paging")
|
|
|
- public Pagination<CommentDTO> getCommentPaging(@RequestBody @Valid CommentPagingParam param) {
|
|
|
- return this.commentService.getCommentPaging(param);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 浏览量加一
|
|
|
- *
|
|
|
- * @param id 主键
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("/comment/addViewNumOne")
|
|
|
- public boolean addViewNumOne(@PathVariable("id") @Min(value = 1, message = "主键不能小于1") Long id) {
|
|
|
- return this.commentService.addViewNumOne(id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 点赞
|
|
|
- *
|
|
|
- * @param id 主键
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("/comment/addThumbsUpOne")
|
|
|
- public boolean addThumbsUpOne(@PathVariable("id") @Min(value = 1, message = "主键不能小于1") Long id) {
|
|
|
- return this.commentService.addThumbsUpOne(id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 取消点赞
|
|
|
- *
|
|
|
- * @param id 主键
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("/comment/cancelThumbsUp")
|
|
|
- public boolean cancelThumbsUp(@PathVariable("id") @Min(value = 1, message = "主键不能小于1") Long id) {
|
|
|
- return this.commentService.cancelThumbsUp(id);
|
|
|
- }
|
|
|
-}
|