ludu-cloud/order/order-service-impl/target/classes/mapper/OrderCommentReplayMapper.xml
2019-05-31 17:54:40 +08:00

61 lines
2.4 KiB
XML

<?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="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
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" 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>
<!--根据评论 id 查询商家最新的评论列表-->
<select id="selectCommentNewMerchantReplyByCommentIds" resultType="cn.iocoder.mall.order.biz.dataobject.OrderCommentReplyDO">
</select>
</mapper>