<?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.system.mapper.DoumuEvaluateMapper">
    
    <resultMap type="DoumuEvaluate" id="DoumuEvaluateResult">
        <result property="evaluateId"    column="evaluate_id"    />
        <result property="productId"    column="product_id"    />
        <result property="orderNumber"    column="order_number"    />
        <result property="synthesisEvaluate"    column="synthesis_evaluate"    />
        <result property="productEvaluate"    column="product_evaluate"    />
        <result property="serviceEvaluate"    column="service_evaluate"    />
        <result property="flowEvaluate"    column="flow_evaluate"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectDoumuEvaluateVo">
        select evaluate_id, product_id, order_number, synthesis_evaluate, product_evaluate, service_evaluate, flow_evaluate, create_by, create_time, update_by, update_time, remark from doumu_evaluate
    </sql>

    <select id="selectDoumuEvaluateList" parameterType="DoumuEvaluate" resultMap="DoumuEvaluateResult">
        <include refid="selectDoumuEvaluateVo"/>
        <where>  
            <if test="productId != null "> and product_id = #{productId}</if>
            <if test="orderNumber != null  and orderNumber != ''"> and order_number = #{orderNumber}</if>
            <if test="synthesisEvaluate != null  and synthesisEvaluate != ''"> and synthesis_evaluate = #{synthesisEvaluate}</if>
            <if test="productEvaluate != null  and productEvaluate != ''"> and product_evaluate = #{productEvaluate}</if>
            <if test="serviceEvaluate != null  and serviceEvaluate != ''"> and service_evaluate = #{serviceEvaluate}</if>
            <if test="flowEvaluate != null  and flowEvaluate != ''"> and flow_evaluate = #{flowEvaluate}</if>
        </where>
    </select>
    
    <select id="selectDoumuEvaluateByEvaluateId" parameterType="Long" resultMap="DoumuEvaluateResult">
        <include refid="selectDoumuEvaluateVo"/>
        where evaluate_id = #{evaluateId}
    </select>
    <select id="selectDoumuEvaluateByProductId" resultType="com.ruoyi.system.domain.DoumuEvaluate">
        <include refid="selectDoumuEvaluateVo"/>
        where product_id = #{productId}
    </select>

    <insert id="insertDoumuEvaluate" parameterType="DoumuEvaluate" useGeneratedKeys="true" keyProperty="evaluateId">
        insert into doumu_evaluate
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="productId != null">product_id,</if>
            <if test="orderNumber != null">order_number,</if>
            <if test="synthesisEvaluate != null">synthesis_evaluate,</if>
            <if test="productEvaluate != null">product_evaluate,</if>
            <if test="serviceEvaluate != null">service_evaluate,</if>
            <if test="flowEvaluate != null">flow_evaluate,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="productId != null">#{productId},</if>
            <if test="orderNumber != null">#{orderNumber},</if>
            <if test="synthesisEvaluate != null">#{synthesisEvaluate},</if>
            <if test="productEvaluate != null">#{productEvaluate},</if>
            <if test="serviceEvaluate != null">#{serviceEvaluate},</if>
            <if test="flowEvaluate != null">#{flowEvaluate},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateDoumuEvaluate" parameterType="DoumuEvaluate">
        update doumu_evaluate
        <trim prefix="SET" suffixOverrides=",">
            <if test="productId != null">product_id = #{productId},</if>
            <if test="orderNumber != null">order_number = #{orderNumber},</if>
            <if test="synthesisEvaluate != null">synthesis_evaluate = #{synthesisEvaluate},</if>
            <if test="productEvaluate != null">product_evaluate = #{productEvaluate},</if>
            <if test="serviceEvaluate != null">service_evaluate = #{serviceEvaluate},</if>
            <if test="flowEvaluate != null">flow_evaluate = #{flowEvaluate},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where evaluate_id = #{evaluateId}
    </update>

    <delete id="deleteDoumuEvaluateByEvaluateId" parameterType="Long">
        delete from doumu_evaluate where evaluate_id = #{evaluateId}
    </delete>

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