<?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.ximai.mes.dv.mapper.devBrandQuotation.DevBrandQuotationProcessQcindexMapper">

    <resultMap type="DevBrandQuotationProcessQcindex" id="DevBrandQuotationProcessQcindexResult">
        <result property="brandQuotationProcessQcindexId"    column="brand_quotation_process_qcindex_id"    />
        <result property="brandQuotationId"    column="brand_quotation_id"    />
        <result property="brandQuotationProcessId"    column="brand_quotation_process_id"    />
        <result property="qcindexId"    column="qcindex_id"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectDevBrandQuotationProcessQcindexVo">
        select brand_quotation_process_qcindex_id, brand_quotation_id, brand_quotation_process_id, qcindex_id, remark from dev_brand_quotation_process_qcindex
    </sql>

    <select id="selectDevBrandQuotationProcessQcindexList" parameterType="DevBrandQuotationProcessQcindex" resultMap="DevBrandQuotationProcessQcindexResult">
        <include refid="selectDevBrandQuotationProcessQcindexVo"/>
        <where>
            <if test="brandQuotationId != null "> and brand_quotation_id = #{brandQuotationId}</if>
            <if test="brandQuotationProcessId != null "> and brand_quotation_process_id = #{brandQuotationProcessId}</if>
            <if test="qcindexId != null "> and qcindex_id = #{qcindexId}</if>
        </where>
    </select>

    <select id="selectDevBrandQuotationProcessQcindexByBrandQuotationProcessQcindexId" parameterType="Long" resultMap="DevBrandQuotationProcessQcindexResult">
        <include refid="selectDevBrandQuotationProcessQcindexVo"/>
        where brand_quotation_process_qcindex_id = #{brandQuotationProcessQcindexId}
    </select>

    <insert id="insertDevBrandQuotationProcessQcindex" parameterType="DevBrandQuotationProcessQcindex" useGeneratedKeys="true" keyProperty="brandQuotationProcessQcindexId">
        insert into dev_brand_quotation_process_qcindex
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="brandQuotationId != null">brand_quotation_id,</if>
            <if test="brandQuotationProcessId != null">brand_quotation_process_id,</if>
            <if test="qcindexId != null">qcindex_id,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="brandQuotationId != null">#{brandQuotationId},</if>
            <if test="brandQuotationProcessId != null">#{brandQuotationProcessId},</if>
            <if test="qcindexId != null">#{qcindexId},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateDevBrandQuotationProcessQcindex" parameterType="DevBrandQuotationProcessQcindex">
        update dev_brand_quotation_process_qcindex
        <trim prefix="SET" suffixOverrides=",">
            <if test="brandQuotationId != null">brand_quotation_id = #{brandQuotationId},</if>
            <if test="brandQuotationProcessId != null">brand_quotation_process_id = #{brandQuotationProcessId},</if>
            <if test="qcindexId != null">qcindex_id = #{qcindexId},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where brand_quotation_process_qcindex_id = #{brandQuotationProcessQcindexId}
    </update>

    <delete id="deleteDevBrandQuotationProcessQcindexByBrandQuotationProcessQcindexId" parameterType="Long">
        delete from dev_brand_quotation_process_qcindex where brand_quotation_process_qcindex_id = #{brandQuotationProcessQcindexId}
    </delete>

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