<?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.pro.mapper.productionMake.ProProductionMakeProcessQcindexMapper">

    <resultMap type="ProProductionMakeProcessQcindex" id="ProProductionMakeProcessQcindexResult">
        <result property="productionMakeProcessQcindexId"    column="production_make_process_qcindex_id"    />
        <result property="productionMakeId"    column="production_make_id"    />
        <result property="productionMakeProcessId"    column="production_make_process_id"    />
        <result property="qcindexId"    column="qcindex_id"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectProProductionMakeProcessQcindexVo">
        select production_make_process_qcindex_id, production_make_id, production_make_process_id, qcindex_id, remark from pro_production_make_process_qcindex
    </sql>

    <select id="selectProProductionMakeProcessQcindexList" parameterType="ProProductionMakeProcessQcindex" resultMap="ProProductionMakeProcessQcindexResult">
        <include refid="selectProProductionMakeProcessQcindexVo"/>
        <where>
            <if test="productionMakeId != null ">and production_make_id =
                #{productionMakeId}
            </if>
            <if test="productionMakeProcessId != null ">and production_make_process_id =
                #{productionMakeProcessId}
            </if>
            <if test="productionMakeProcessQcindexId != null ">and production_make_process_qcindex_id = #{productionMakeProcessQcindexId}</if>
        </where>
    </select>

    <select id="selectProProductionMakeProcessQcindexByProductionMakeProcessQcindexId" parameterType="Long" resultMap="ProProductionMakeProcessQcindexResult">
        <include refid="selectProProductionMakeProcessQcindexVo"/>
        where production_make_process_qcindex_id = #{productionMakeProcessQcindexId}
    </select>

    <insert id="insertProProductionMakeProcessQcindex" parameterType="ProProductionMakeProcessQcindex" useGeneratedKeys="true" keyProperty="productionMakeProcessQcindexId">
        insert into pro_production_make_process_qcindex
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="productionMakeId != null">production_make_id,</if>
            <if test="productionMakeProcessId != null">production_make_process_id,</if>
            <if test="qcindexId != null">qcindex_id,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="productionMakeId != null">#{productionMakeId},</if>
            <if test="productionMakeProcessId != null">#{productionMakeProcessId},</if>
            <if test="qcindexId != null">#{qcindexId},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateProProductionMakeProcessQcindex" parameterType="ProProductionMakeProcessQcindex">
        update pro_production_make_process_qcindex
        <trim prefix="SET" suffixOverrides=",">
            <if test="productionMakeId != null">production_make_id = #{productionMakeId},</if>
            <if test="productionMakeProcessId != null">production_make_process_id = #{productionMakeProcessId},</if>
            <if test="qcindexId != null">qcindex_id = #{qcindexId},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where production_make_process_qcindex_id = #{productionMakeProcessQcindexId}
    </update>

    <delete id="deleteProProductionMakeProcessQcindexByProductionMakeProcessQcindexId" parameterType="Long">
        delete from pro_production_make_process_qcindex where production_make_process_qcindex_id = #{productionMakeProcessQcindexId}
    </delete>

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