实现增加评论接口和一些实体和mapper更改

This commit is contained in:
wangtongzhou
2019-05-28 18:14:10 +08:00
parent e1292e3867
commit fcd70c2bac
13 changed files with 156 additions and 95 deletions

View File

@@ -1,13 +1,15 @@
package cn.iocoder.mall.order.biz.convert;
import cn.iocoder.mall.order.api.bo.OrderCommentBO;
import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO;
import cn.iocoder.mall.order.api.bo.OrderCommentPageBO;
import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO;
import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO;
import org.apache.ibatis.annotations.Mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 订单评论 convert
*/
@@ -21,4 +23,7 @@ public interface OrderCommentConvert {
@Mappings({})
OrderCommentCreateBO convert(OrderCommentDO orderCommentDO);
@Mappings({})
List<OrderCommentPageBO.OrderCommentItem> convert(List<OrderCommentDO> orderCommentDOList);
}

View File

@@ -7,6 +7,7 @@ import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
/**
@@ -50,4 +51,13 @@ public interface OrderCommentReplayMapper {
int selectCommentReplyTotalCountByCommentId(@Param("commentId") Integer commentId,
@Param("userType") Integer userType);
/**
* 根据评论 id 查询最新的商家回复
* @param commentIds
* @return
*/
List<OrderCommentReplyDO> selectCommentNewMerchantReplyByCommentIds(@Param("commentIds") Collection<Integer> commentIds,
@Param("userType") Integer userType);
}

View File

@@ -12,9 +12,9 @@ import lombok.experimental.Accessors;
* @time 2019-05-14 20:48
*
*/
@TableName(value = "order_comment")
@Data
@Accessors(chain = true)
@TableName(value = "order_comment")
public class OrderCommentDO extends BaseDO {
/**

View File

@@ -6,7 +6,6 @@ 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;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
import cn.iocoder.mall.order.biz.convert.OrderCommentConvert;
import cn.iocoder.mall.order.biz.dao.OrderCommentMapper;
import cn.iocoder.mall.order.biz.dao.OrderCommentReplayMapper;
@@ -15,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
*
@@ -24,14 +24,15 @@ import java.util.Date;
* @time 2019
*/
@Service
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderService.version}")
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OrderCommentService.version}")
public class OrderCommentServiceImpl implements OrderCommentService {
@Autowired
private OrderCommentMapper orderCommentMapper;
@Autowired
private OrderCommentReplayMapper orderCommentReplayMapper;
private OrderCommentService orderCommentService;
@Override
public OrderCommentCreateBO createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO) {
@@ -40,18 +41,22 @@ public class OrderCommentServiceImpl implements OrderCommentService {
//接下来就是入库
OrderCommentDO orderCommentDO=OrderCommentConvert.INSTANCE.convert(orderCommentCreateDTO);
orderCommentDO.setCreateTime(new Date());
orderCommentDO.setUpdateTime(new Date());
orderCommentMapper.insert(orderCommentDO);
return OrderCommentConvert.INSTANCE.convert(orderCommentDO);
}
@Override
public Boolean createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO) {
return null;
}
@Override
public OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO) {
return null;
OrderCommentPageBO orderCommentPageBO=new OrderCommentPageBO();
//分页内容
List<OrderCommentDO> orderCommentDOList=orderCommentMapper.selectCommentPage(orderCommentPageDTO);
//查询商家的回复
//总数
int totalCount=orderCommentMapper.selectCommentTotalCountByProductSkuId(orderCommentPageDTO.getProductSkuId());
orderCommentPageBO.setOrderCommentItems(OrderCommentConvert.INSTANCE.convert(orderCommentDOList));
orderCommentPageBO.setTotal(totalCount);
return orderCommentPageBO;
}
@Override

View File

@@ -9,7 +9,7 @@
<!--插入-->
<insert id="insert" parameterType="OrderCommentReplyDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO `order_comment_replay`(comment_id,reply_type,parent_id,parent_user_id,parent_user_nick_name,parent_user_avatar,reply_content,reply_user_id
INSERT INTO order_comment_replay(comment_id,reply_type,parent_id,parent_user_id,parent_user_nick_name,parent_user_avatar,reply_content,reply_user_id
reply_user_nick_name,reply_user_avatar,user_type,create_time,update_time)
VALUES (#{commentId},#{replyType},#{parentId},#{parentUserId},#{parentUserNickName},#{parentUserAvatar},#{replyContent},#{replyUserId},
#{replyUserNickName},#{replyUserAvatar},#{userType},#{createTime},#{updateTime})
@@ -51,4 +51,10 @@
LIMIT ${pageNo * pageSize}, ${pageSize}
</select>
<!--根据评论 id 查询商家最新的评论列表-->
<select id="selectCommentNewMerchantReplyByCommentIds" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO">
</select>
</mapper>