|  | @@ -0,0 +1,202 @@
 | 
	
		
			
				|  |  | +<?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="com.fs.his.mapper.FsStoreOrderScrmCommentMapper">
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    <resultMap type="FsStoreOrderScrmComment" id="FsStoreOrderScrmCommentResult">
 | 
	
		
			
				|  |  | +        <result property="commentId"    column="comment_id"    />
 | 
	
		
			
				|  |  | +        <result property="orderId"    column="order_id"    />
 | 
	
		
			
				|  |  | +        <result property="content"    column="content"    />
 | 
	
		
			
				|  |  | +        <result property="nickName"    column="nick_name"    />
 | 
	
		
			
				|  |  | +        <result property="userId"    column="user_id"    />
 | 
	
		
			
				|  |  | +        <result property="isAnonymous"    column="is_anonymous"    />
 | 
	
		
			
				|  |  | +        <result property="isShow"    column="is_show"    />
 | 
	
		
			
				|  |  | +        <result property="rating"    column="rating"    />
 | 
	
		
			
				|  |  | +        <result property="merchantReply"    column="merchant_reply"    />
 | 
	
		
			
				|  |  | +        <result property="imageUrl"    column="image_url"    />
 | 
	
		
			
				|  |  | +        <result property="videoUrl"    column="video_url"    />
 | 
	
		
			
				|  |  | +        <result property="productIds"    column="product_ids"    />
 | 
	
		
			
				|  |  | +        <result property="isDel"    column="is_del"    />
 | 
	
		
			
				|  |  | +        <result property="storeId"    column="store_id"    />
 | 
	
		
			
				|  |  | +        <result property="storeName"    column="store_name"    />
 | 
	
		
			
				|  |  | +        <result property="createTime"    column="create_time"    />
 | 
	
		
			
				|  |  | +        <result property="updateTime"    column="update_time"    />
 | 
	
		
			
				|  |  | +    </resultMap>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <sql id="selectFsStoreOrderScrmCommentVo">
 | 
	
		
			
				|  |  | +        select comment_id, order_id, content, nick_name, user_id, is_anonymous, is_show, rating, merchant_reply, image_url, video_url, product_ids, is_del, store_id, store_name, create_time, update_time from fs_store_order_scrm_comment
 | 
	
		
			
				|  |  | +    </sql>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectFsStoreOrderScrmCommentList" parameterType="FsStoreOrderScrmComment" resultMap="FsStoreOrderScrmCommentResult">
 | 
	
		
			
				|  |  | +        <include refid="selectFsStoreOrderScrmCommentVo"/>
 | 
	
		
			
				|  |  | +        <where>  
 | 
	
		
			
				|  |  | +            <if test="orderId != null "> and order_id = #{orderId}</if>
 | 
	
		
			
				|  |  | +            <if test="content != null  and content != ''"> and content = #{content}</if>
 | 
	
		
			
				|  |  | +            <if test="nickName != null  and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
 | 
	
		
			
				|  |  | +            <if test="userId != null "> and user_id = #{userId}</if>
 | 
	
		
			
				|  |  | +            <if test="isAnonymous != null "> and is_anonymous = #{isAnonymous}</if>
 | 
	
		
			
				|  |  | +            <if test="isShow != null "> and is_show = #{isShow}</if>
 | 
	
		
			
				|  |  | +            <if test="rating != null  and rating != ''"> and rating = #{rating}</if>
 | 
	
		
			
				|  |  | +            <if test="merchantReply != null  and merchantReply != ''"> and merchant_reply = #{merchantReply}</if>
 | 
	
		
			
				|  |  | +            <if test="imageUrl != null  and imageUrl != ''"> and image_url = #{imageUrl}</if>
 | 
	
		
			
				|  |  | +            <if test="videoUrl != null  and videoUrl != ''"> and video_url = #{videoUrl}</if>
 | 
	
		
			
				|  |  | +            <if test="productIds != null  and productIds != ''"> and product_ids = #{productIds}</if>
 | 
	
		
			
				|  |  | +            <if test="isDel != null "> and is_del = #{isDel}</if>
 | 
	
		
			
				|  |  | +            <if test="storeId != null "> and store_id = #{storeId}</if>
 | 
	
		
			
				|  |  | +            <if test="storeName != null  and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
 | 
	
		
			
				|  |  | +        </where>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="selectFsStoreOrderScrmCommentByUser" parameterType="FsStoreOrderScrmComment" resultMap="FsStoreOrderScrmCommentResult">
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        t1.comment_id,
 | 
	
		
			
				|  |  | +        t1.order_id,
 | 
	
		
			
				|  |  | +        t1.content,
 | 
	
		
			
				|  |  | +        case when  t1.is_anonymous != 1 then t1.nick_name else '匿名用户' end as nick_name,
 | 
	
		
			
				|  |  | +        t1.user_id,
 | 
	
		
			
				|  |  | +        t1.is_anonymous,
 | 
	
		
			
				|  |  | +        t1.is_show,
 | 
	
		
			
				|  |  | +        t1.rating,
 | 
	
		
			
				|  |  | +        t1.merchant_reply,
 | 
	
		
			
				|  |  | +        t1.image_url,
 | 
	
		
			
				|  |  | +        t1.video_url,
 | 
	
		
			
				|  |  | +        t1.product_ids,
 | 
	
		
			
				|  |  | +        t1.is_del,
 | 
	
		
			
				|  |  | +        t1.store_id,
 | 
	
		
			
				|  |  | +        t1.store_name,
 | 
	
		
			
				|  |  | +        t1.create_time,
 | 
	
		
			
				|  |  | +        t1.update_time,
 | 
	
		
			
				|  |  | +        t2.avatar as user_avatar
 | 
	
		
			
				|  |  | +        from fs_store_order_scrm_comment t1
 | 
	
		
			
				|  |  | +        left join fs_user t2 on t1.user_id = t2.user_id
 | 
	
		
			
				|  |  | +        where  t1.is_del != 1 and (t1.is_show = 1 or t1.user_id = #{userId})
 | 
	
		
			
				|  |  | +            <if test="orderId != null and orderId != '' "> and t1.order_id = #{orderId}</if>
 | 
	
		
			
				|  |  | +            <if test="showSelf != null and showSelf != 0"> and t1.user_id = #{userId}</if>
 | 
	
		
			
				|  |  | +            <if test="content != null  and content != ''"> and t1.content = #{content}</if>
 | 
	
		
			
				|  |  | +            <if test="nickName != null  and nickName != ''"> and t1.nick_name like concat('%', #{nickName}, '%')</if>
 | 
	
		
			
				|  |  | +            <if test="isAnonymous != null "> and t1.is_anonymous = #{isAnonymous}</if>
 | 
	
		
			
				|  |  | +            <if test="rating != null  and rating != ''"> and t1.rating = #{rating}</if>
 | 
	
		
			
				|  |  | +            <if test="merchantReply != null  and merchantReply != ''"> and t1.merchant_reply = #{merchantReply}</if>
 | 
	
		
			
				|  |  | +            <if test="imageUrl != null  and imageUrl != ''"> and t1.image_url = #{imageUrl}</if>
 | 
	
		
			
				|  |  | +            <if test="videoUrl != null  and videoUrl != ''"> and t1.video_url = #{videoUrl}</if>
 | 
	
		
			
				|  |  | +            <if test="productIds != null  and productIds != ''"> and find_in_set(#{productIds}, t1.product_ids) > 0</if>
 | 
	
		
			
				|  |  | +            <if test="storeId != null "> and t1.store_id = #{storeId}</if>
 | 
	
		
			
				|  |  | +            <if test="storeName != null  and storeName != ''"> and t1.store_name like concat('%', #{storeName}, '%')</if>
 | 
	
		
			
				|  |  | +            order by t1.create_time desc
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectFsStoreOrderScrmCommentByManager"  parameterType="FsStoreOrderScrmComment" resultMap="FsStoreOrderScrmCommentResult">
 | 
	
		
			
				|  |  | +        select comment_id,
 | 
	
		
			
				|  |  | +            order_id,
 | 
	
		
			
				|  |  | +            content,
 | 
	
		
			
				|  |  | +            case when  is_anonymous != 1 then nick_name else '匿名用户' end as nick_name,
 | 
	
		
			
				|  |  | +            user_id,
 | 
	
		
			
				|  |  | +            is_anonymous,
 | 
	
		
			
				|  |  | +            is_show,
 | 
	
		
			
				|  |  | +            rating,
 | 
	
		
			
				|  |  | +            merchant_reply,
 | 
	
		
			
				|  |  | +            image_url,
 | 
	
		
			
				|  |  | +            video_url,
 | 
	
		
			
				|  |  | +            product_ids,
 | 
	
		
			
				|  |  | +            is_del,
 | 
	
		
			
				|  |  | +            store_id,
 | 
	
		
			
				|  |  | +            store_name,
 | 
	
		
			
				|  |  | +            create_time,
 | 
	
		
			
				|  |  | +            update_time
 | 
	
		
			
				|  |  | +        from fs_store_order_scrm_comment
 | 
	
		
			
				|  |  | +        where  1=1
 | 
	
		
			
				|  |  | +        <if test="orderId != null "> and order_id = #{orderId}</if>
 | 
	
		
			
				|  |  | +        <if test="content != null  and content != ''"> and content = #{content}</if>
 | 
	
		
			
				|  |  | +        <if test="nickName != null  and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
 | 
	
		
			
				|  |  | +        <if test="isAnonymous != null "> and is_anonymous = #{isAnonymous}</if>
 | 
	
		
			
				|  |  | +        <if test="rating != null  and rating != ''"> and rating = #{rating}</if>
 | 
	
		
			
				|  |  | +        <if test="merchantReply != null  and merchantReply != ''"> and merchant_reply = #{merchantReply}</if>
 | 
	
		
			
				|  |  | +        <if test="imageUrl != null  and imageUrl != ''"> and image_url = #{imageUrl}</if>
 | 
	
		
			
				|  |  | +        <if test="videoUrl != null  and videoUrl != ''"> and video_url = #{videoUrl}</if>
 | 
	
		
			
				|  |  | +        <if test="productIds != null  and productIds != ''"> and find_in_set(#{productId}, product_ids) > 0</if>
 | 
	
		
			
				|  |  | +        <if test="storeId != null "> and store_id = #{storeId}</if>
 | 
	
		
			
				|  |  | +        <if test="storeName != null  and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
 | 
	
		
			
				|  |  | +        order by create_time desc
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectFsStoreOrderScrmCommentByCommentId" parameterType="Long" resultMap="FsStoreOrderScrmCommentResult">
 | 
	
		
			
				|  |  | +        <include refid="selectFsStoreOrderScrmCommentVo"/>
 | 
	
		
			
				|  |  | +        where comment_id = #{commentId}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +    <insert id="insertFsStoreOrderScrmComment" parameterType="FsStoreOrderScrmComment" useGeneratedKeys="true" keyProperty="commentId">
 | 
	
		
			
				|  |  | +        insert into fs_store_order_scrm_comment
 | 
	
		
			
				|  |  | +        <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="orderId != null">order_id,</if>
 | 
	
		
			
				|  |  | +            <if test="content != null">content,</if>
 | 
	
		
			
				|  |  | +            <if test="nickName != null">nick_name,</if>
 | 
	
		
			
				|  |  | +            <if test="userId != null">user_id,</if>
 | 
	
		
			
				|  |  | +            <if test="isAnonymous != null">is_anonymous,</if>
 | 
	
		
			
				|  |  | +            <if test="isShow != null">is_show,</if>
 | 
	
		
			
				|  |  | +            <if test="rating != null">rating,</if>
 | 
	
		
			
				|  |  | +            <if test="merchantReply != null">merchant_reply,</if>
 | 
	
		
			
				|  |  | +            <if test="imageUrl != null">image_url,</if>
 | 
	
		
			
				|  |  | +            <if test="videoUrl != null">video_url,</if>
 | 
	
		
			
				|  |  | +            <if test="productIds != null">product_ids,</if>
 | 
	
		
			
				|  |  | +            <if test="isDel != null">is_del,</if>
 | 
	
		
			
				|  |  | +            <if test="storeId != null">store_id,</if>
 | 
	
		
			
				|  |  | +            <if test="storeName != null">store_name,</if>
 | 
	
		
			
				|  |  | +            <if test="createTime != null">create_time,</if>
 | 
	
		
			
				|  |  | +            <if test="updateTime != null">update_time,</if>
 | 
	
		
			
				|  |  | +         </trim>
 | 
	
		
			
				|  |  | +        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="orderId != null">#{orderId},</if>
 | 
	
		
			
				|  |  | +            <if test="content != null">#{content},</if>
 | 
	
		
			
				|  |  | +            <if test="nickName != null">#{nickName},</if>
 | 
	
		
			
				|  |  | +            <if test="userId != null">#{userId},</if>
 | 
	
		
			
				|  |  | +            <if test="isAnonymous != null">#{isAnonymous},</if>
 | 
	
		
			
				|  |  | +            <if test="isShow != null">#{isShow},</if>
 | 
	
		
			
				|  |  | +            <if test="rating != null">#{rating},</if>
 | 
	
		
			
				|  |  | +            <if test="merchantReply != null">#{merchantReply},</if>
 | 
	
		
			
				|  |  | +            <if test="imageUrl != null">#{imageUrl},</if>
 | 
	
		
			
				|  |  | +            <if test="videoUrl != null">#{videoUrl},</if>
 | 
	
		
			
				|  |  | +            <if test="productIds != null">#{productIds},</if>
 | 
	
		
			
				|  |  | +            <if test="isDel != null">#{isDel},</if>
 | 
	
		
			
				|  |  | +            <if test="storeId != null">#{storeId},</if>
 | 
	
		
			
				|  |  | +            <if test="storeName != null">#{storeName},</if>
 | 
	
		
			
				|  |  | +            <if test="createTime != null">#{createTime},</if>
 | 
	
		
			
				|  |  | +            <if test="updateTime != null">#{updateTime},</if>
 | 
	
		
			
				|  |  | +         </trim>
 | 
	
		
			
				|  |  | +    </insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <update id="updateFsStoreOrderScrmComment" parameterType="FsStoreOrderScrmComment">
 | 
	
		
			
				|  |  | +        update fs_store_order_scrm_comment
 | 
	
		
			
				|  |  | +        <trim prefix="SET" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="orderId != null">order_id = #{orderId},</if>
 | 
	
		
			
				|  |  | +            <if test="content != null">content = #{content},</if>
 | 
	
		
			
				|  |  | +            <if test="nickName != null">nick_name = #{nickName},</if>
 | 
	
		
			
				|  |  | +            <if test="userId != null">user_id = #{userId},</if>
 | 
	
		
			
				|  |  | +            <if test="isAnonymous != null">is_anonymous = #{isAnonymous},</if>
 | 
	
		
			
				|  |  | +            <if test="isShow != null">is_show = #{isShow},</if>
 | 
	
		
			
				|  |  | +            <if test="rating != null">rating = #{rating},</if>
 | 
	
		
			
				|  |  | +            <if test="merchantReply != null">merchant_reply = #{merchantReply},</if>
 | 
	
		
			
				|  |  | +            <if test="imageUrl != null">image_url = #{imageUrl},</if>
 | 
	
		
			
				|  |  | +            <if test="videoUrl != null">video_url = #{videoUrl},</if>
 | 
	
		
			
				|  |  | +            <if test="productIds != null">product_ids = #{productIds},</if>
 | 
	
		
			
				|  |  | +            <if test="isDel != null">is_del = #{isDel},</if>
 | 
	
		
			
				|  |  | +            <if test="storeId != null">store_id = #{storeId},</if>
 | 
	
		
			
				|  |  | +            <if test="storeName != null">store_name = #{storeName},</if>
 | 
	
		
			
				|  |  | +            <if test="createTime != null">create_time = #{createTime},</if>
 | 
	
		
			
				|  |  | +            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
	
		
			
				|  |  | +        </trim>
 | 
	
		
			
				|  |  | +        where comment_id = #{commentId}
 | 
	
		
			
				|  |  | +    </update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <delete id="deleteFsStoreOrderScrmCommentByCommentId" parameterType="Long">
 | 
	
		
			
				|  |  | +        delete from fs_store_order_scrm_comment where comment_id = #{commentId}
 | 
	
		
			
				|  |  | +    </delete>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <delete id="deleteFsStoreOrderScrmCommentByCommentIds" parameterType="String">
 | 
	
		
			
				|  |  | +        delete from fs_store_order_scrm_comment where comment_id in 
 | 
	
		
			
				|  |  | +        <foreach item="commentId" collection="array" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +            #{commentId}
 | 
	
		
			
				|  |  | +        </foreach>
 | 
	
		
			
				|  |  | +    </delete>
 | 
	
		
			
				|  |  | +</mapper>
 |