From 2c57d294280992f1d53a5387f97ae1a8e27b50cc Mon Sep 17 00:00:00 2001 From: wangtongzhou Date: Mon, 3 Jun 2019 21:49:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AF=84=E8=AE=BA=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=88=97=E8=A1=A8=E5=92=8C=E8=AF=84=E8=AE=BA=E5=95=86?= =?UTF-8?q?=E5=AE=B6=E8=AF=A6=E6=83=85=E5=88=97=E8=A1=A8,=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=AA=8C=E8=AF=81=E6=9A=82=E6=97=B6=E7=AD=89=E4=B8=8B?= =?UTF-8?q?=E6=AC=A1=E5=A2=9E=E5=8A=A0=E7=82=B9=E8=B5=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BB=A5=E5=90=8E=E5=8A=A0=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/OrderCommentController.java | 17 +++- .../users/OrderCommentReplyController.java | 19 ++-- .../order/api/OrderCommentReplyService.java | 14 ++- .../mall/order/api/OrderCommentService.java | 6 +- .../OrderCommentInfoAndMerchantReplyBO.java | 86 ++----------------- .../mall/order/api/bo/OrderCommentInfoBO.java | 83 ++++++++++++++++++ .../api/bo/OrderCommentMerchantReplyBO.java | 21 +++++ .../order/api/bo/OrderCommentReplyPageBO.java | 9 +- .../biz/convert/OrderCommentConvert.java | 4 + .../biz/convert/OrderCommentReplyConvert.java | 11 +++ .../order/biz/dao/OrderCommentMapper.java | 10 +-- .../biz/dao/OrderCommentReplayMapper.java | 6 +- .../service/OrderCommentReplyServiceImpl.java | 32 ++++++- .../biz/service/OrderCommentServiceImpl.java | 14 +-- .../resources/mapper/OrderCommentMapper.xml | 4 +- .../mapper/OrderCommentReplayMapper.xml | 6 +- 16 files changed, 225 insertions(+), 117 deletions(-) create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java create mode 100644 order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentController.java index 9687484cf..c821e3588 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentController.java @@ -2,8 +2,10 @@ package cn.iocoder.mall.order.application.controller.users; import cn.iocoder.common.framework.constant.MallConstants; import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.order.api.OrderCommentReplyService; import cn.iocoder.mall.order.api.OrderCommentService; import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; +import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO; import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO; @@ -31,6 +33,9 @@ public class OrderCommentController { @Reference(validation = "true", version = "${dubbo.provider.OrderCommentService.version}") private OrderCommentService orderCommentService; + @Reference(validation = "true", version = "${dubbo.provider.OrderCommentReplyService.version}") + private OrderCommentReplyService orderCommentReplyService; + @PostMapping("create_order_comment") //@RequiresLogin @@ -39,11 +44,21 @@ public class OrderCommentController { return success(orderCommentService.createOrderComment(orderCommentCreateDTO)); } - @GetMapping("getOrderCommentPage") + @GetMapping("order_comment_page") //@RequiresLogin @ApiOperation(value = "获取评论分页") public CommonResult getOrderCommentPage(@Validated OrderCommentPageDTO orderCommentPageDTO){ return success(orderCommentService.getOrderCommentPage(orderCommentPageDTO)); } + @GetMapping("order_comment_info_merchant_reply") + //@RequiresLogin + @ApiOperation(value = "获取评论和商家回复") + public CommonResult geOrderCommentInfoAndMerchantReply(@RequestParam("commentId") Integer commentId){ + OrderCommentInfoAndMerchantReplyBO orderCommentInfoAndMerchantReplyBO=new OrderCommentInfoAndMerchantReplyBO(); + orderCommentInfoAndMerchantReplyBO.setOrderCommentInfoBO(orderCommentService.getOrderCommentInfo(commentId)); + orderCommentInfoAndMerchantReplyBO.setOrderCommentMerchantReplyBOS(orderCommentReplyService.getOrderCommentMerchantReply(commentId)); + return success(orderCommentInfoAndMerchantReplyBO); + } + } diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentReplyController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentReplyController.java index 0aefbce1a..37c147b65 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentReplyController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentReplyController.java @@ -3,17 +3,15 @@ package cn.iocoder.mall.order.application.controller.users; import cn.iocoder.common.framework.constant.MallConstants; import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.order.api.OrderCommentReplyService; -import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO; +import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO; import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO; +import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.dubbo.config.annotation.Reference; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import static cn.iocoder.common.framework.vo.CommonResult.success; @@ -33,10 +31,17 @@ public class OrderCommentReplyController { @Reference(validation = "true", version = "${dubbo.provider.OrderCommentService.version}") private OrderCommentReplyService orderCommentReplyService; - @PostMapping("create_order_comment") + @PostMapping("create_order_comment_reply") //@RequiresLogin - @ApiOperation(value = "创建订单") + @ApiOperation(value = "创建订单回复") public CommonResult createOrderCommentReply(@RequestBody @Validated OrderCommentReplyCreateDTO orderCommentReplyCreateDTO){ return success(orderCommentReplyService.createOrderCommentReply(orderCommentReplyCreateDTO)); } + + @GetMapping("order_comment_reply_page") + //@RequiresLogin + @ApiOperation(value = "分页获取评论回复") + public CommonResult getOrderCommentReplyPage(@Validated OrderCommentReplyPageDTO orderCommentReplyCreateDTO){ + return success(orderCommentReplyService.getOrderCommentReplyPage(orderCommentReplyCreateDTO)); + } } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java index 5ea73ea9a..71be604da 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentReplyService.java @@ -1,5 +1,6 @@ package cn.iocoder.mall.order.api; +import cn.iocoder.mall.order.api.bo.OrderCommentMerchantReplyBO; import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO; import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO; import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO; @@ -22,7 +23,7 @@ public interface OrderCommentReplyService { * @param orderCommentReplyPageDTO * @return */ - List getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO); + OrderCommentReplyPageBO getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO); /** @@ -31,4 +32,15 @@ public interface OrderCommentReplyService { * @return */ OrderCommentReplyCreateBO createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO); + + + /** + * 获取商家评论回复 + * @param commentId + * @return + */ + List getOrderCommentMerchantReply(Integer commentId); + + + } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java index dbd0ec4d3..698f578c8 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderCommentService.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.order.api; import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; -import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO; +import cn.iocoder.mall.order.api.bo.OrderCommentInfoBO; import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO; @@ -32,11 +32,11 @@ public interface OrderCommentService { /** - * 获取评论详情和商家回复 + * 获取评论详情 * @param commentId * @return */ - OrderCommentInfoAndMerchantReplyBO getOrderCommentInfo(Integer commentId, Integer userType); + OrderCommentInfoBO getOrderCommentInfo(Integer commentId); diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java index 5e317a36b..467232260 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoAndMerchantReplyBO.java @@ -3,97 +3,27 @@ package cn.iocoder.mall.order.api.bo; import lombok.Data; import lombok.experimental.Accessors; -import java.util.Date; import java.util.List; /** * - * 订单回复评价详情和商加回复 + * 评论详情和商家评论回复 * * @author wtz - * @time 2019-05-16 18:40 - * + * @time 2019-06-03 20:30 */ +@Data +@Accessors(chain = true) public class OrderCommentInfoAndMerchantReplyBO { /** - * 评论 id + * 评论详情 */ - private Integer id; + private OrderCommentInfoBO orderCommentInfoBO; /** - * 用户头像 + * 商家评论回复 */ - private String userAvatar; - - /** - * 用户昵称 - */ - private String userNickName; - - /** - * 评价星 - */ - private Integer star; - - /** - * 评论的内容 - */ - private String commentContent; - - /** - * 评论的图片地址 - */ - private String commentPics; - - - /** - * 点赞数 - */ - private Integer collectCount; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 商品 sku id - */ - private int productSkuId; - - /** - * 商品 sku 属性 - */ - private String productSkuAttrs; - - /** - * 商品 sku 价格 - */ - private String productSkuPrice; - - /** - * 商品 sku 地址 - */ - private String productSkuPicUrl; - - - /** - * 商家回复 - */ - List orderCommentReplayMerchantItems; - - - @Data - @Accessors(chain = true) - public static class OrderCommentReplayMerchantItem{ - /** - * 回复的内容 - */ - private String replyContent; - } - - - + private List orderCommentMerchantReplyBOS; } diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java new file mode 100644 index 000000000..1fac20969 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentInfoBO.java @@ -0,0 +1,83 @@ +package cn.iocoder.mall.order.api.bo; + + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * + * 订单回复评价详情 + * + * @author wtz + * @time 2019-05-16 18:40 + * + */ +@Data +@Accessors(chain = true) +public class OrderCommentInfoBO { + + /** + * 评论 id + */ + private Integer id; + + /** + * 用户头像 + */ + private String userAvatar; + + /** + * 用户昵称 + */ + private String userNickName; + + /** + * 评价星 + */ + private Integer star; + + /** + * 评论的内容 + */ + private String commentContent; + + /** + * 评论的图片地址 + */ + private String commentPics; + + + /** + * 点赞数 + */ + private Integer collectCount; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 商品 sku id + */ + private int productSkuId; + + /** + * 商品 sku 属性 + */ + private String productSkuAttrs; + + /** + * 商品 sku 价格 + */ + private String productSkuPrice; + + /** + * 商品 sku 地址 + */ + private String productSkuPicUrl; + + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java new file mode 100644 index 000000000..85d86b744 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentMerchantReplyBO.java @@ -0,0 +1,21 @@ +package cn.iocoder.mall.order.api.bo; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * + * 商家评论回复 + * + * @author wtz + * @time 2019-06-03 19:30 + */ +@Data +@Accessors(chain = true) +public class OrderCommentMerchantReplyBO { + + /** + * 商家评论回复 + */ + private String replyContent; +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java index ee04d2be8..7e9f4191f 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/OrderCommentReplyPageBO.java @@ -15,19 +15,24 @@ import java.util.List; * @time 2019-05-19 14:19 * */ +@Data +@Accessors(chain = true) public class OrderCommentReplyPageBO { + /** + * 评论回复总数 + */ private Integer total; /** * 用户回复 */ - List orderCommentReplayUserItems; + List orderCommentReplayItems; @Data @Accessors(chain = true) - private static class OrderCommentReplayUserItem{ + public static class OrderCommentReplayItem{ /** * 回复 id */ diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java index 964cabbdd..4453e7382 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentConvert.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.order.biz.convert; import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; +import cn.iocoder.mall.order.api.bo.OrderCommentInfoBO; import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO; @@ -27,4 +28,7 @@ public interface OrderCommentConvert { @Mappings({}) OrderCommentCreateBO convert(OrderCommentDO orderCommentDO); + @Mappings({}) + OrderCommentInfoBO convertOrderCommentInfoBO(OrderCommentDO orderCommentDO); + } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentReplyConvert.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentReplyConvert.java index 4149da6da..4a35b1933 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentReplyConvert.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/convert/OrderCommentReplyConvert.java @@ -1,12 +1,17 @@ package cn.iocoder.mall.order.biz.convert; +import cn.iocoder.mall.order.api.bo.OrderCommentMerchantReplyBO; import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO; +import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO; import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO; import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO; import org.mapstruct.Mapper; import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; +import javax.validation.constraints.Max; +import java.util.List; + /** * * 评论回复 convert @@ -24,4 +29,10 @@ public interface OrderCommentReplyConvert { @Mappings({}) OrderCommentReplyCreateBO convert(OrderCommentReplyDO orderCommentReplyDO); + + @Mappings({}) + List convert(List orderCommentReplyDOList); + + @Mappings({}) + List convertOrderCommentReplayItem(List orderCommentReplyDOList); } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java index 7c030b20f..0e3d898d3 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentMapper.java @@ -38,15 +38,11 @@ public interface OrderCommentMapper{ /** - * 根据 sku id 分页查询评论 - * @param productSkuId - * @param offset - * @param limit + * 分页获取评论 + * @param orderCommentPageDTO * @return */ - List selectCommentPage(@Param("productSkuId") Integer productSkuId, - @Param("offset") Integer offset, - @Param("limit") Integer limit); + List selectCommentPage(OrderCommentPageDTO orderCommentPageDTO); /** diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java index 5345c1d9e..c707249d5 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dao/OrderCommentReplayMapper.java @@ -31,12 +31,12 @@ public interface OrderCommentReplayMapper { * @param commentId,userType * @return */ - List selectCommentMerchantReplyByCommentId(@Param("commentId") Integer commentId, - @Param("userType") Integer userType); + List selectCommentMerchantReplyByCommentIdAndUserType(@Param("commentId") Integer commentId, + @Param("userType") Integer userType); /** - * 评论回复分页 + * 分页获取评论回复 * @param orderCommentReplyPageDTO * @return */ diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyServiceImpl.java index 21c689b56..8680452fc 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentReplyServiceImpl.java @@ -1,9 +1,11 @@ package cn.iocoder.mall.order.biz.service; import cn.iocoder.mall.order.api.OrderCommentReplyService; +import cn.iocoder.mall.order.api.bo.OrderCommentMerchantReplyBO; import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO; import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO; import cn.iocoder.mall.order.api.constant.OrderCommentRelpyTypeEnum; +import cn.iocoder.mall.order.api.constant.OrderReplyUserTypeEnum; import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO; import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO; import cn.iocoder.mall.order.biz.convert.OrderCommentReplyConvert; @@ -12,6 +14,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -29,9 +32,22 @@ public class OrderCommentReplyServiceImpl implements OrderCommentReplyService { @Autowired private OrderCommentReplayMapper orderCommentReplayMapper; + /** + * 分页获取评论回复 + * @param orderCommentReplyPageDTO + * @return + */ @Override - public List getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO) { - return null; + public OrderCommentReplyPageBO getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO) { + OrderCommentReplyPageBO orderCommentReplyPageBO=new OrderCommentReplyPageBO(); + //评论回复总数 + Integer totalCount=orderCommentReplayMapper.selectCommentReplyTotalCountByCommentId(orderCommentReplyPageDTO.getCommentId(), + orderCommentReplyPageDTO.getUserType()); + //分页获取评论回复 + List orderCommentReplyDOList=orderCommentReplayMapper.selectCommentReplyPage(orderCommentReplyPageDTO); + orderCommentReplyPageBO.setTotal(totalCount); + orderCommentReplyPageBO.setOrderCommentReplayItems(OrderCommentReplyConvert.INSTANCE.convertOrderCommentReplayItem(orderCommentReplyDOList)); + return orderCommentReplyPageBO; } @@ -55,4 +71,16 @@ public class OrderCommentReplyServiceImpl implements OrderCommentReplyService { return OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyDO); } + + /** + * 获取商家评论回复 + * @param commentId + * @return + */ + @Override + public List getOrderCommentMerchantReply(Integer commentId) { + List orderCommentReplyDOList=orderCommentReplayMapper.selectCommentMerchantReplyByCommentIdAndUserType(commentId, + OrderReplyUserTypeEnum.MERCHANT.getValue()); + return OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyDOList); + } } diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java index 670007fd5..d5cc21ea1 100644 --- a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/service/OrderCommentServiceImpl.java @@ -2,7 +2,7 @@ package cn.iocoder.mall.order.biz.service; import cn.iocoder.mall.order.api.OrderCommentService; import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; -import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO; +import cn.iocoder.mall.order.api.bo.OrderCommentInfoBO; import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; import cn.iocoder.mall.order.api.constant.OrderReplyUserTypeEnum; import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; @@ -15,7 +15,6 @@ import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -57,9 +56,7 @@ public class OrderCommentServiceImpl implements OrderCommentService { public OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO) { OrderCommentPageBO orderCommentPageBO=new OrderCommentPageBO(); //分页内容 - int offset = (orderCommentPageDTO.getPageNo() - 1) * orderCommentPageDTO.getPageSize(); - List orderCommentDOList=orderCommentMapper.selectCommentPage(orderCommentPageDTO.getProductSkuId(), - offset,orderCommentPageDTO.getPageSize()); + List orderCommentDOList=orderCommentMapper.selectCommentPage(orderCommentPageDTO); //分页评论的 id List commentIds=orderCommentDOList.stream().map(x->x.getId()).collect(Collectors.toList()); //获取商家最新的评论回复 @@ -79,9 +76,12 @@ public class OrderCommentServiceImpl implements OrderCommentService { return orderCommentPageBO; } + @Override - public OrderCommentInfoAndMerchantReplyBO getOrderCommentInfo(Integer commentId, Integer userType) { - return null; + public OrderCommentInfoBO getOrderCommentInfo(Integer commentId) { + //查询评论详情 + OrderCommentDO orderCommentDO=orderCommentMapper.selectCommentInfoByCommentId(commentId); + return OrderCommentConvert.INSTANCE.convertOrderCommentInfoBO(orderCommentDO); } @Override diff --git a/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml index 5a1d5292f..bf3b2a6be 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderCommentMapper.xml @@ -35,7 +35,7 @@ WHERE product_sku_id = #{productSkuId} ORDER BY create_time DESC - LIMIT #{offset}, #{limit} + LIMIT ${pageNo*pageSize},${pageSize} @@ -45,8 +45,6 @@ FROM order_comment WHERE id = #{id} - ORDER BY create_time DESC - LIMIT ${ pageNo * pageSize },${ pageSize } \ No newline at end of file diff --git a/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml b/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml index aa917b97c..f84cabe3c 100644 --- a/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml +++ b/order/order-service-impl/src/main/resources/mapper/OrderCommentReplayMapper.xml @@ -16,7 +16,7 @@ - SELECT FROM order_comment_replay @@ -30,7 +30,7 @@