<?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.zehong.system.mapper.TComplainDealEvaluateMapper">
    
    <resultMap type="TComplainDealEvaluate" id="TComplainDealEvaluateResult">
        <result property="complainDealEvaluateId"    column="complain_deal_evaluate_id"    />
        <result property="evaluateContent"    column="evaluate_content"    />
        <result property="evaluateRate"    column="evaluate_rate"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="complainDealId"    column="complain_deal_id"    />
    </resultMap>

    <sql id="selectTComplainDealEvaluateVo">
        select complain_deal_evaluate_id, evaluate_content, evaluate_rate, create_by, create_time,complain_deal_id from t_complain_deal_evaluate
    </sql>

    <select id="selectTComplainDealEvaluateList" parameterType="TComplainDealEvaluate" resultMap="TComplainDealEvaluateResult">
        <include refid="selectTComplainDealEvaluateVo"/>
        <where>  
            <if test="evaluateContent != null  and evaluateContent != ''"> and evaluate_content = #{evaluateContent}</if>
            <if test="evaluateRate != null  and evaluateRate != ''"> and evaluate_rate = #{evaluateRate}</if>
        </where>
    </select>
    
    <select id="selectTComplainDealEvaluateById" parameterType="Long" resultMap="TComplainDealEvaluateResult">
        <include refid="selectTComplainDealEvaluateVo"/>
        where complain_deal_evaluate_id = #{complainDealEvaluateId}
    </select>
    <select id="selectTComplainDealEvaluateByComplainDealId" parameterType="Long" resultMap="TComplainDealEvaluateResult">
        <include refid="selectTComplainDealEvaluateVo"/>
        where complain_deal_id = #{complainDealId}
    </select>
        
    <insert id="insertTComplainDealEvaluate" parameterType="TComplainDealEvaluate" useGeneratedKeys="true" keyProperty="complainDealEvaluateId">
        insert into t_complain_deal_evaluate
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="evaluateContent != null and evaluateContent != ''">evaluate_content,</if>
            <if test="evaluateRate != null">evaluate_rate,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="complainDealId != null">complain_deal_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="evaluateContent != null and evaluateContent != ''">#{evaluateContent},</if>
            <if test="evaluateRate != null">#{evaluateRate},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="complainDealId != null">#{complainDealId},</if>
         </trim>
    </insert>

    <update id="updateTComplainDealEvaluate" parameterType="TComplainDealEvaluate">
        update t_complain_deal_evaluate
        <trim prefix="SET" suffixOverrides=",">
            <if test="evaluateContent != null and evaluateContent != ''">evaluate_content = #{evaluateContent},</if>
            <if test="evaluateRate != null">evaluate_rate = #{evaluateRate},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="complainDealId != null">complain_deal_id = #{complainDealId},</if>
        </trim>
        where complain_deal_evaluate_id = #{complainDealEvaluateId}
    </update>

    <delete id="deleteTComplainDealEvaluateById" parameterType="Long">
        delete from t_complain_deal_evaluate where complain_deal_evaluate_id = #{complainDealEvaluateId}
    </delete>

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