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

This commit is contained in:
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,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,