订单评价和回复接口定义以及mapper实现

pull/1/head
wangtongzhou 2019-05-19 16:00:08 +08:00
parent 7905541501
commit 304c436e49
21 changed files with 581 additions and 242 deletions

View File

@ -0,0 +1,24 @@
package cn.iocoder.mall.order.api;
import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO;
import java.util.List;
/**
*
*
*
* @author wtz
* @time 2019-05-29 14:30
*
*/
public interface OrderCommentReplyService {
/**
*
* @param orderCommentReplyPageDTO
* @return
*/
List<OrderCommentReplyPageBO> getOrderCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO);
}

View File

@ -1,11 +1,10 @@
package cn.iocoder.mall.order.api;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO;
import cn.iocoder.mall.order.api.bo.OrderCommentInfoBO;
import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO;
import cn.iocoder.mall.order.api.bo.OrderCommentPageBO;
import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO;
import cn.iocoder.mall.order.api.constant.OrderReplyUserTypeEnum;
import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
/**
@ -21,7 +20,7 @@ public interface OrderCommentService {
* @param orderCommentCreateDTO
* @return
*/
CommonResult<OrderCommentCreateBO> createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO);
Boolean createOrderComment(OrderCommentCreateDTO orderCommentCreateDTO);
/**
@ -29,22 +28,31 @@ public interface OrderCommentService {
* @param orderCommentReplyCreateDTO
* @return
*/
CommonResult<OrderCommentReplyCreateBO> createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO);
Boolean createOrderCommentReply(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO);
/**
*
* @param productSpuId
* @param orderCommentPageDTO
* @return
*/
CommonResult<OrderCommentPageBO> getOrderCommentPage(Integer productSpuId);
OrderCommentPageBO getOrderCommentPage(OrderCommentPageDTO orderCommentPageDTO);
/**
*
*
* @param commentId
* @return
*/
CommonResult<OrderCommentInfoBO> getOrderCommentInfo(Integer commentId);
OrderCommentInfoAndMerchantReplyBO getOrderCommentInfo(Integer commentId, Integer userType);
/**
*
*
* @return
*/
Boolean OrderCommentTimeOutProductCommentTask();

View File

@ -16,7 +16,7 @@ import java.util.List;
*/
@Data
@Accessors(chain = true)
public class OrderCommentBo implements Serializable {
public class OrderCommentBO implements Serializable {
/**
*
@ -39,7 +39,7 @@ public class OrderCommentBo implements Serializable {
private Integer negativeTotal;
/**
* id
* id
*/
private Integer id;

View File

@ -1,23 +0,0 @@
package cn.iocoder.mall.order.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
/**
*
*
*
* @author wtz
* @time 2019-05-15 20:35
*
*/
@Data
@Accessors(chain = true)
public class OrderCommentCreateBO {
/**
* id
*/
private Integer id;
}

View File

@ -0,0 +1,99 @@
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
*
*/
public class OrderCommentInfoAndMerchantReplyBO {
/**
* 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;
/**
*
*/
List<OrderCommentReplayMerchantItem> orderCommentReplayMerchantItems;
@Data
@Accessors(chain = true)
private static class OrderCommentReplayMerchantItem{
/**
*
*/
private String replyContent;
}
}

View File

@ -1,158 +0,0 @@
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
*
*/
public class OrderCommentInfoBO {
/**
* id
*/
private Integer id;
/**
*
*/
private String userAvatar;
/**
*
*/
private String userNickName;
/**
*
*/
private Integer star;
/**
*
*/
private String commentContent;
/**
*
*/
private String commentPics;
/**
*
*/
private Integer replayCount;
/**
*
*/
private Integer collectCount;
/**
*
*/
private Date createTime;
/**
* SKUid
*/
private int productSkuId;
/**
* SKU
*/
private String productSkuAttrs;
/**
* SKU
*/
private String productSkuPrice;
/**
* SKU
*/
private String productSkuPicUrl;
/**
*
*/
List<OrderCommentReplayMerchantItem> orderCommentReplayMerchantItems;
/**
*
*/
List<OrderCommentReplayUserItem> orderCommentReplayUserItems;
@Data
@Accessors(chain = true)
private static class OrderCommentReplayMerchantItem{
/**
*
*/
private String replyContent;
}
@Data
@Accessors(chain = true)
private static class OrderCommentReplayUserItem{
/**
* id
*/
private Integer id;
/**
*
*/
private Integer replyType;
/**
*
*/
private String replyContent;
/**
* id
*/
private int replyUserId;
/**
*
*/
private String replyUserNickName;
/**
*
*/
private String replyUserAvatar;
/**
*
*/
private int replyCollectCount;
/**
*
*/
private String parentUserNickName;
/**
*
*/
private Date createTime;
}
}

View File

@ -49,7 +49,7 @@ public class OrderCommentPageBO implements Serializable {
@Accessors(chain = true)
private static class OrderCommentItem{
/**
* id
* id
*/
private Integer id;

View File

@ -1,16 +0,0 @@
package cn.iocoder.mall.order.api.bo;
/**
*
*
*
* @author wtz
* @time 2019-05-16 18:00:00
*/
public class OrderCommentReplyCreateBO {
/**
* id
*/
private Integer id;
}

View File

@ -0,0 +1,77 @@
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-19 14:19
*
*/
public class OrderCommentReplyPageBO {
private Integer total;
/**
*
*/
List<OrderCommentReplayUserItem> orderCommentReplayUserItems;
@Data
@Accessors(chain = true)
private static class OrderCommentReplayUserItem{
/**
* id
*/
private Integer id;
/**
*
*/
private Integer replyType;
/**
*
*/
private String replyContent;
/**
* id
*/
private int replyUserId;
/**
*
*/
private String replyUserNickName;
/**
*
*/
private String replyUserAvatar;
/**
*
*/
private int replyCollectCount;
/**
*
*/
private String parentUserNickName;
/**
*
*/
private Date createTime;
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.mall.order.api.constant;
/**
*
* -
*
* @author wtz
* @time 2019-05-19 15:19
*/
public enum OrderReplyUserTypeEnum {
USER(1, "普通用户"),
MERCHANT(2, "商家");
/**
*
*/
private Integer value;
/**
*
*/
private String name;
OrderReplyUserTypeEnum(Integer value, String name) {
this.value = value;
this.name = name;
}
public Integer getValue() {
return value;
}
public String getName() {
return name;
}
}

View File

@ -17,7 +17,7 @@ import java.io.Serializable;
public class OrderCommentCreateDTO implements Serializable {
/**
* id
* id
*/
private int orderId;
@ -27,37 +27,37 @@ public class OrderCommentCreateDTO implements Serializable {
private String orderNo;
/**
* SPU id
* spu id
*/
private int productSpuId;
/**
* SPU SPU
* spu spu
*/
private String productSpuName;
/**
* SKU id
* sku id
*/
private int productSkuId;
/**
* SKU
* sku
*/
private String productSkuAttrs;
/**
* SKU
* sku
*/
private int productSkuPrice;
/**
* SKU
* sku
*/
private String productSkuPicUrl;
/**
* id
* id
*/
private Integer userId;
@ -95,4 +95,9 @@ public class OrderCommentCreateDTO implements Serializable {
*
*/
private String commentContent;
/**
*
*/
private String commentPics;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.mall.order.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
*
* query
*
*/
@Data
@Accessors(chain = true)
public class OrderCommentPageDTO {
/**
* sku id
*/
private Integer productSkuId;
/**
*
*/
private Integer pageNo;
/**
*
*/
private Integer pageSize;
}

View File

@ -1,5 +1,8 @@
package cn.iocoder.mall.order.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
@ -10,20 +13,22 @@ import java.io.Serializable;
* @time 2019-05-16 19:07
*
*/
@Data
@Accessors(chain = true)
public class OrderCommentReplyCreateDTO implements Serializable {
/**
* id
* id
*/
private Integer commentId;
/**
* id
* id
*/
private Integer parentId;
/**
* id
* id
*/
private Integer parentUserId;
@ -43,7 +48,7 @@ public class OrderCommentReplyCreateDTO implements Serializable {
private String replyContent;
/**
* id
* id
*/
private Integer replyUserId;
@ -60,6 +65,6 @@ public class OrderCommentReplyCreateDTO implements Serializable {
/**
*
*/
private Integer replyUserType;
private Integer userType;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.mall.order.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
*
* query
*
* @author wtz
* @time 2019-05-19 10:16
*/
@Data
@Accessors(chain = true)
public class OrderCommentReplyPageDTO {
/**
* id
*/
private Integer commentId;
/**
*
*/
private Integer userType;
/**
*
*/
private Integer pageNo;
/**
*
*/
private Integer pageSize;
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.mall.order.biz.dao;
import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO;
import cn.iocoder.mall.order.biz.dataobject.OrderCommentDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
*
* mapper
*
* @author wtz
* @time 2019-05-16 20:52
*/
@Repository
public interface OrderCommentMapper extends BaseMapper<OrderCommentDO> {
/**
*
* @param orderCommentCreateDTO
* @return
*/
int insert(OrderCommentCreateDTO orderCommentCreateDTO);
/**
* sku id
* @param productSkuId
* @return
*/
int selectCommentTotalCountByProductSkuId(@Param("productSkuId") Integer productSkuId);
/**
* sku id
* @param orderCommentPageDTO
* @return
*/
List<OrderCommentDO> selectCommentPage(OrderCommentPageDTO orderCommentPageDTO);
/**
* id
* @param id
* @return
*/
OrderCommentDO selectCommentInfoByCommentId(@Param("id") Integer id);
}

View File

@ -0,0 +1,51 @@
package cn.iocoder.mall.order.biz.dao;
import cn.iocoder.mall.order.api.bo.OrderCommentBO;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO;
import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO;
import cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* mapper
*
* @author wtz
* @time 2019-05-16 21:33
*/
public interface OrderCommentReplayMapper {
/**
*
* @param orderCommentReplyCreateDTO
* @return
*/
int insert(OrderCommentReplyCreateDTO orderCommentReplyCreateDTO);
/**
* id
* @param commentId,userType
* @return
*/
List<OrderCommentReplyDO> selectCommentMerchantReplyByCommentId(@Param("commentId") Integer commentId,
@Param("userType") Integer userType);
/**
*
* @param orderCommentReplyPageDTO
* @return
*/
List<OrderCommentReplyDO> selectCommentReplyPage(OrderCommentReplyPageDTO orderCommentReplyPageDTO);
/**
* id
* @param commentId,userType
* @return
*/
int selectCommentReplyTotalCountByCommentId(@Param("commentId") Integer commentId,
@Param("userType") Integer userType);
}

View File

@ -8,7 +8,7 @@ import lombok.experimental.Accessors;
/**
*
*
* @author wtz
* @author wtz
* @time 2019-05-14 20:48
*
*/
@ -18,12 +18,12 @@ import lombok.experimental.Accessors;
public class OrderCommentDO extends BaseDO {
/**
* id // TODO FROM 芋艿 TO wtz 中英文之间,要有空格
* id // TODO FROM 芋艿 TO wtz 中英文之间,要有空格
*/
private Integer id;
/**
* id
* id
*/
private Integer orderId;
@ -33,7 +33,7 @@ public class OrderCommentDO extends BaseDO {
private String orderNo;
/**
* id
* id
*/
private Integer productSpuId;
@ -43,22 +43,22 @@ public class OrderCommentDO extends BaseDO {
private String productSpuName;
/**
* SKUid
* sku id
*/
private Integer productSkuId;
/**
* SKU
* sku
*/
private String productSkuAttrs;
/**
* SKU
* sku
*/
private Integer productSkuPrice;
/**
* SKU URL
* sku url
*/
private String productSkuPicUrl;
@ -105,7 +105,7 @@ public class OrderCommentDO extends BaseDO {
/**
* // TODO FROM 芋艿 TO wtz collect 是收藏的意思,最好换个单词噢。
*/
private Integer collectCount;
private Integer likeCount;
/**
*

View File

@ -17,15 +17,15 @@ import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName(value = "order_comment_replay")
public class OrderCommentReplayDO extends BaseDO {
public class OrderCommentReplyDO extends BaseDO {
/**
* id
* id
*/
private Integer id;
/**
* id
* id
*/
private Integer commentId;
@ -35,12 +35,12 @@ public class OrderCommentReplayDO extends BaseDO {
private Integer replyType;
/**
* id
* id
*/
private Integer parentId;
/**
* id
* id
*/
private Integer parentUserId;
@ -60,7 +60,7 @@ public class OrderCommentReplayDO extends BaseDO {
private String replyContent;
/**
* id
* id
*/
private Integer replyUserId;
@ -77,11 +77,11 @@ public class OrderCommentReplayDO extends BaseDO {
/**
* // TODO FROM 芋艿 TO wtz 【提示】userType 和 UserTypeEnum 记录保持一致。
*/
private Integer replyUserType;
private Integer userType;
/**
*
*/
private Integer replyCollectCount;
private Integer replyLikeCount;
}

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderCommentMapper">
<sql id="FIELDS">
id,order_id,order_no,product_spu_id,product_spu_name,product_sku_id,product_sku_attrs,product_sku_price,product_sku_pic_url,
user_id,user_avatar,user_nick_name,star,product_description_star,logistics_star,merchant_star,replay_count,like_count,comment_content,
comment_pics,create_time,update_time
</sql>
<!--插入-->
<insert id="insert" parameterType="OrderCommentCreateDTO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO order_comment(order_id,order_no,product_spu_id,product_spu_name,product_sku_id,
product_sku_attrs,product_sku_price,product_sku_pic_url,user_id,user_avatar,user_nick_name,star,
product_description_star,logistics_star,merchant_star,comment_content,comment_pics,create_time,update_time)
VALUES (#{orderId},#{orderNo},#{productSpuId},#{productSpuName},#{productSkuId},#{productSkuAttrs},
#{productSkuPrice},#{productSkuPicUrl},#{userId},#{userAvatar},#{userNickName},#{star},
#{productDescriptionStar},#{logisticsStar},#{merchantStar},#{commentContent},#{commentPics},#{createTime}, #{updateTime});
</insert>
<!--根据 sku id 获取评论总数-->
<select id="selectCommentTotalCountByProductSkuId" parameterType="Integer" resultType="java.lang.Integer">
SELECT
COUNT (*)
FROM order_comment
WHERE
product_sku_id = #{productSkuId}
</select>
<!--分页获取评论分页-->
<select id="selectCommentPage" parameterType="OrderCommentQueryDTO" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentDO">
SELECT
<include refid="FIELDS" />
FROM order_comment
WHERE
product_sku_id = #{productSkuId}
ORDER BY create_time DESC
LIMIT ${pageNo * pageSize}, ${pageSize}
</select>
<!--根据评论 id 获取用户详情-->
<select id="selectCommentInfoByCommentId" parameterType="Integer" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentDO">
SELECT
<include refid="FIELDS" />
FROM order_comment
WHERE
id = #{id}
ORDER BY create_time DESC
LIMIT ${pageNo * pageSize}, ${pageSize}
</select>
</mapper>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderCommentReplayMapper">
<sql id="FIELDS">
id,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,reply_like_count,create_time,update_time
</sql>
<!--插入-->
<insert id="insert" parameterType="OrderCommentReplyCreateDTO" 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
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})
</insert>
<!--根据评论 id 和用户类型获取商家回复列表-->
<select id="selectCommentMerchantReplyByCommentId" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO">
SELECT
<include refid="FIELDS" />
FROM order_comment_replay
WHERE
comment_id = #{commentId}
AND
user_type = #{userType}
ORDER BY create_time DESC
</select>
<!--根据评论 id 和用户类型获取评论总数-->
<select id="selectCommentReplyTotalCountByCommentId" parameterType="Integer" resultType="java.lang.Integer">
SELECT
COUNT (*)
FROM order_comment_replay
WHERE
comment_id = #{commentId}
AND
user_type = #{userType}
</select>
<!--分页用户回复-->
<select id="selectCommentReplyPage" parameterType="OrderCommentReplyPageDTO" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO">
SELECT
<include refid="FIELDS" />
FROM order_comment_replay
WHERE
comment_id = #{commentId}
AND
user_type = #{userType}
ORDER BY create_time DESC
LIMIT ${pageNo * pageSize}, ${pageSize}
</select>
</mapper>

View File

@ -3,8 +3,7 @@
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderLogisticsDetailMapper">
<sql id="FIELDS">
id
,
id,
order_logistics_id,
logistics_time,
logistics_information,