<?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.ruoyi.abuwx.mapper.UserFeedbackReplyMapper">
    
    <resultMap type="UserFeedbackReply" id="UserFeedbackReplyResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="content"    column="content"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="feedbackId"    column="feedback_id"    />
    </resultMap>

    <sql id="selectUserFeedbackReplyVo">
        select id, user_id, content, remark, create_time, update_time, create_by, update_by, feedback_id from user_feedback_reply
    </sql>

    <select id="selectUserFeedbackReplyList" parameterType="UserFeedbackReply" resultMap="UserFeedbackReplyResult">
        <include refid="selectUserFeedbackReplyVo"/>
        <where>  
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="feedbackId != null "> and feedback_id = #{feedbackId}</if>
        </where>
    </select>
    
    <select id="selectUserFeedbackReplyById" parameterType="Long" resultMap="UserFeedbackReplyResult">
        <include refid="selectUserFeedbackReplyVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertUserFeedbackReply" parameterType="UserFeedbackReply" useGeneratedKeys="true" keyProperty="id">
        insert into user_feedback_reply
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null">user_id,</if>
            <if test="content != null">content,</if>
            <if test="remark != null">remark,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="feedbackId != null">feedback_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null">#{userId},</if>
            <if test="content != null">#{content},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="feedbackId != null">#{feedbackId},</if>
         </trim>
    </insert>

    <update id="updateUserFeedbackReply" parameterType="UserFeedbackReply">
        update user_feedback_reply
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null">user_id = #{userId},</if>
            <if test="content != null">content = #{content},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="feedbackId != null">feedback_id = #{feedbackId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteUserFeedbackReplyById" parameterType="Long">
        delete from user_feedback_reply where id = #{id}
    </delete>

    <delete id="deleteUserFeedbackReplyByIds" parameterType="String">
        delete from user_feedback_reply where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>