<?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.prototypeRequest.ProPrototypeRequestProcessQcindexMapper">

    <resultMap type="ProPrototypeRequestProcessQcindex" id="ProPrototypeRequestProcessQcindexResult">
        <result property="prototypeRequestProcessQcindexId"    column="prototype_request_process_qcindex_id"    />
        <result property="prototypeRequestId"    column="prototype_request_id"    />
        <result property="prototypeRequestProcessId"    column="prototype_request_process_id"    />
        <result property="qcindexId"    column="qcindex_id"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectProPrototypeRequestProcessQcindexVo">
        select prototype_request_process_qcindex_id, prototype_request_id, prototype_request_process_id, qcindex_id, remark from pro_prototype_request_process_qcindex
    </sql>

    <select id="selectProPrototypeRequestProcessQcindexList" parameterType="ProPrototypeRequestProcessQcindex" resultMap="ProPrototypeRequestProcessQcindexResult">
        <include refid="selectProPrototypeRequestProcessQcindexVo"/>
        <where>
            <if test="prototypeRequestProcessId != null ">and prototype_request_process_id =
                #{prototypeRequestProcessId}
            </if>
            <if test="prototypeRequestProcessQcindexId != null ">and prototype_request_process_qcindex_id = #{prototypeRequestProcessQcindexId}</if>
        </where>
    </select>

    <select id="selectProPrototypeRequestProcessQcindexByPrototypeRequestProcessQcindexId" parameterType="Long" resultMap="ProPrototypeRequestProcessQcindexResult">
        <include refid="selectProPrototypeRequestProcessQcindexVo"/>
        where prototype_request_process_qcindex_id = #{prototypeRequestProcessQcindexId}
    </select>

    <insert id="insertProPrototypeRequestProcessQcindex" parameterType="ProPrototypeRequestProcessQcindex" useGeneratedKeys="true" keyProperty="prototypeRequestProcessQcindexId">
        insert into pro_prototype_request_process_qcindex
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="prototypeRequestId != null">prototype_request_id,</if>
            <if test="prototypeRequestProcessId != null">prototype_request_process_id,</if>
            <if test="qcindexId != null">qcindex_id,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="prototypeRequestId != null">#{prototypeRequestId},</if>
            <if test="prototypeRequestProcessId != null">#{prototypeRequestProcessId},</if>
            <if test="qcindexId != null">#{qcindexId},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateProPrototypeRequestProcessQcindex" parameterType="ProPrototypeRequestProcessQcindex">
        update pro_prototype_request_process_qcindex
        <trim prefix="SET" suffixOverrides=",">
            <if test="prototypeRequestId != null">prototype_request_id = #{prototypeRequestId},</if>
            <if test="prototypeRequestProcessId != null">prototype_request_process_id = #{prototypeRequestProcessId},</if>
            <if test="qcindexId != null">qcindex_id = #{qcindexId},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where prototype_request_process_qcindex_id = #{prototypeRequestProcessQcindexId}
    </update>

    <delete id="deleteProPrototypeRequestProcessQcindexByPrototypeRequestProcessQcindexId" parameterType="Long">
        delete from pro_prototype_request_process_qcindex where prototype_request_process_qcindex_id = #{prototypeRequestProcessQcindexId}
    </delete>

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