完成评论回复列表和评论商家详情列表,用户验证暂时等下次增加点赞接口以后加上
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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<OrderCommentMerchantReplyBO> convert(List<OrderCommentReplyDO> orderCommentReplyDOList);
|
||||
|
||||
@Mappings({})
|
||||
List<OrderCommentReplyPageBO.OrderCommentReplayItem> convertOrderCommentReplayItem(List<OrderCommentReplyDO> orderCommentReplyDOList);
|
||||
}
|
||||
|
||||
@@ -38,15 +38,11 @@ public interface OrderCommentMapper{
|
||||
|
||||
|
||||
/**
|
||||
* 根据 sku id 分页查询评论
|
||||
* @param productSkuId
|
||||
* @param offset
|
||||
* @param limit
|
||||
* 分页获取评论
|
||||
* @param orderCommentPageDTO
|
||||
* @return
|
||||
*/
|
||||
List<OrderCommentDO> selectCommentPage(@Param("productSkuId") Integer productSkuId,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
List<OrderCommentDO> selectCommentPage(OrderCommentPageDTO orderCommentPageDTO);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,12 +31,12 @@ public interface OrderCommentReplayMapper {
|
||||
* @param commentId,userType
|
||||
* @return
|
||||
*/
|
||||
List<OrderCommentReplyDO> selectCommentMerchantReplyByCommentId(@Param("commentId") Integer commentId,
|
||||
@Param("userType") Integer userType);
|
||||
List<OrderCommentReplyDO> selectCommentMerchantReplyByCommentIdAndUserType(@Param("commentId") Integer commentId,
|
||||
@Param("userType") Integer userType);
|
||||
|
||||
|
||||
/**
|
||||
* 评论回复分页
|
||||
* 分页获取评论回复
|
||||
* @param orderCommentReplyPageDTO
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -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<OrderCommentReplyPageBO> getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO) {
|
||||
return null;
|
||||
public OrderCommentReplyPageBO getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO) {
|
||||
OrderCommentReplyPageBO orderCommentReplyPageBO=new OrderCommentReplyPageBO();
|
||||
//评论回复总数
|
||||
Integer totalCount=orderCommentReplayMapper.selectCommentReplyTotalCountByCommentId(orderCommentReplyPageDTO.getCommentId(),
|
||||
orderCommentReplyPageDTO.getUserType());
|
||||
//分页获取评论回复
|
||||
List<OrderCommentReplyDO> 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<OrderCommentMerchantReplyBO> getOrderCommentMerchantReply(Integer commentId) {
|
||||
List<OrderCommentReplyDO> orderCommentReplyDOList=orderCommentReplayMapper.selectCommentMerchantReplyByCommentIdAndUserType(commentId,
|
||||
OrderReplyUserTypeEnum.MERCHANT.getValue());
|
||||
return OrderCommentReplyConvert.INSTANCE.convert(orderCommentReplyDOList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<OrderCommentDO> orderCommentDOList=orderCommentMapper.selectCommentPage(orderCommentPageDTO.getProductSkuId(),
|
||||
offset,orderCommentPageDTO.getPageSize());
|
||||
List<OrderCommentDO> orderCommentDOList=orderCommentMapper.selectCommentPage(orderCommentPageDTO);
|
||||
//分页评论的 id
|
||||
List<Integer> 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
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
WHERE
|
||||
product_sku_id = #{productSkuId}
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
LIMIT ${pageNo*pageSize},${pageSize}
|
||||
</select>
|
||||
|
||||
<!--根据评论 id 获取用户详情-->
|
||||
@@ -45,8 +45,6 @@
|
||||
FROM order_comment
|
||||
WHERE
|
||||
id = #{id}
|
||||
ORDER BY create_time DESC
|
||||
LIMIT ${ pageNo * pageSize },${ pageSize }
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -16,7 +16,7 @@
|
||||
</insert>
|
||||
|
||||
<!--根据评论 id 和用户类型获取商家回复列表-->
|
||||
<select id="selectCommentMerchantReplyByCommentId" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO">
|
||||
<select id="selectCommentMerchantReplyByCommentIdAndUserType" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM order_comment_replay
|
||||
@@ -30,7 +30,7 @@
|
||||
<!--根据评论 id 和用户类型获取评论总数-->
|
||||
<select id="selectCommentReplyTotalCountByCommentId" parameterType="Integer" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT (*)
|
||||
COUNT(*)
|
||||
FROM order_comment_replay
|
||||
WHERE
|
||||
comment_id = #{commentId}
|
||||
@@ -48,7 +48,7 @@
|
||||
AND
|
||||
user_type = #{userType}
|
||||
ORDER BY create_time DESC
|
||||
LIMIT ${pageNo * pageSize}, ${pageSize}
|
||||
LIMIT ${pageNo*pageSize},${pageSize}
|
||||
</select>
|
||||
|
||||
<!--根据评论 id 查询商家最新的评论列表-->
|
||||
|
||||
Reference in New Issue
Block a user