<?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.task.ProPackagePrintRecordMapper">

    <resultMap type="ProPackagePrintRecord" id="ProPackagePrintRecordResult">
        <result property="recordId"    column="record_id"    />
        <result property="taskWorkunitId"    column="task_workunit_id"    />
        <result property="workorderId"    column="workorder_id"    />
        <result property="workorderSoDirectiveId"    column="workorder_so_directive_id"    />
        <result property="workorderSoSizeItemId"    column="workorder_so_size_item_id"    />
        <result property="feedbackId"    column="feedback_id"    />
        <result property="sheetCount"    column="sheet_count"    />
        <result property="totalCount"    column="total_count"    />
        <result property="barcode"    column="barcode"    />
        <result property="qrcode"    column="qrcode"    />
        <result property="minTotalCount"    column="min_total_count"    />
        <result property="minSheetCount"    column="min_sheet_count"    />
        <result property="minPackageNum"    column="min_package_num"    />
        <result property="checkBy"    column="check_by"    />
        <result property="inputBy"    column="input_by"    />
        <result property="netWeight"    column="net_weight"    />
        <result property="packageNum"    column="package_num"    />
        <result property="packageNum2"    column="package_num2"    />
        <result property="lossNum"    column="loss_num"    />
        <result property="printTime"    column="print_time"    />
        <result property="blGroup"    column="blGroup"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="printBy"    column="print_by"    />
        <result property="printDate"    column="print_date"    />
        <result property="grossWeight"    column="gross_weight"    />
        <result property="boxWeight"    column="box_weight"    />
        <result property="packageStandard"    column="package_standard"    />
        <result property="packVolume"    column="pack_volume"    />
    </resultMap>

    <sql id="selectProPackagePrintRecordVo">
        select * from pro_package_print_record
    </sql>

    <select id="selectProPackagePrintRecordList" parameterType="ProPackagePrintRecordQuery" resultMap="ProPackagePrintRecordResult">
        <include refid="selectProPackagePrintRecordVo"/>
        <where>
            <if test="taskWorkunitId != null "> and task_workunit_id = #{taskWorkunitId}</if>
            <if test="workorderId != null "> and workorder_id = #{workorderId}</if>
            <if test="workorderSoDirectiveId != null "> and workorder_so_directive_id = #{workorderSoDirectiveId}</if>
            <if test="workorderSoSizeItemId != null "> and workorder_so_size_item_id = #{workorderSoSizeItemId}</if>
            <if test="feedbackId != null "> and feedback_id = #{feedbackId}</if>
            <if test="barcode != null "> and barcode = #{barcode}</if>
            <if test="qrcode != null "> and qrcode = #{qrcode}</if>
        </where>
    </select>

    <select id="selectProPackagePrintRecordByRecordId" parameterType="Long" resultMap="ProPackagePrintRecordResult">
        <include refid="selectProPackagePrintRecordVo"/>
        where record_id = #{recordId}
    </select>

    <insert id="insertProPackagePrintRecord" parameterType="ProPackagePrintRecord" useGeneratedKeys="true" keyProperty="recordId">
        insert into pro_package_print_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskWorkunitId != null">task_workunit_id,</if>
            <if test="workorderId != null">workorder_id,</if>
            <if test="workorderSoDirectiveId != null">workorder_so_directive_id,</if>
            <if test="workorderSoSizeItemId != null">workorder_so_size_item_id,</if>
            <if test="feedbackId != null">feedback_id,</if>
            <if test="sheetCount != null">sheet_count,</if>
            <if test="barcode != null">barcode,</if>
            <if test="qrcode != null">qrcode,</if>
            <if test="minTotalCount != null">min_total_count,</if>
            <if test="minSheetCount != null">min_sheet_count,</if>
            <if test="minPackageNum != null">min_package_num,</if>
            <if test="totalCount != null">total_count,</if>
            <if test="packageNum != null">package_num,</if>
            <if test="packageNum2 != null">package_num2,</if>
            <if test="netWeight != null">net_weight,</if>
            <if test="checkBy != null">check_by,</if>
            <if test="inputBy != null">input_by,</if>
            <if test="printTime != null">print_time,</if>
            <if test="lossNum != null">loss_num,</if>
            <if test="blGroup != null">bl_group,</if>
            <if test="workorderSoSizeItemIds != null">workorder_so_size_item_ids,</if>
            <if test="workorderSoSizes != null">workorder_so_sizes,</if>
            <if test="remark != null">create_by,</if>
            <if test="isSurplus != null">is_surplus,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="printBy != null">print_by,</if>
            <if test="printDate != null">print_date,</if>
            <if test="grossWeight != null">gross_weight,</if>
            <if test="boxWeight != null">box_weight,</if>
            <if test="packageStandard != null">package_standard,</if>
            <if test="packVolume != null">pack_volume,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskWorkunitId != null">#{taskWorkunitId},</if>
            <if test="workorderId != null">#{workorderId},</if>
            <if test="workorderSoDirectiveId != null">#{workorderSoDirectiveId},</if>
            <if test="workorderSoSizeItemId != null">#{workorderSoSizeItemId},</if>
            <if test="feedbackId != null">#{feedbackId},</if>
            <if test="sheetCount != null">#{sheetCount},</if>
            <if test="barcode != null">#{barcode},</if>
            <if test="qrcode != null">#{qrcode},</if>
            <if test="minTotalCount != null">#{minTotalCount},</if>
            <if test="minSheetCount != null">#{minSheetCount},</if>
            <if test="minPackageNum != null">#{minPackageNum},</if>
            <if test="totalCount != null">#{totalCount},</if>
            <if test="packageNum != null">#{packageNum},</if>
            <if test="packageNum2 != null">#{packageNum2},</if>
            <if test="netWeight != null">#{netWeight},</if>
            <if test="checkBy != null">#{checkBy},</if>
            <if test="inputBy != null">#{inputBy},</if>
            <if test="printTime != null">#{printTime},</if>
            <if test="lossNum != null">#{lossNum},</if>
            <if test="blGroup != null">#{blGroup},</if>
            <if test="workorderSoSizeItemIds != null">#{workorderSoSizeItemIds},</if>
            <if test="workorderSoSizes != null">#{workorderSoSizes},</if>
            <if test="remark != null">#{remark},</if>
            <if test="isSurplus != null">#{isSurplus},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="printBy != null">#{printBy},</if>
            <if test="printDate != null">#{printDate},</if>
            <if test="grossWeight != null">#{grossWeight},</if>
            <if test="boxWeight != null">#{boxWeight},</if>
            <if test="packageStandard != null">#{packageStandard},</if>
            <if test="packVolume != null">#{packVolume},</if>
        </trim>
    </insert>

    <update id="updateProPackagePrintRecord" parameterType="ProPackagePrintRecord">
        update pro_package_print_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskWorkunitId != null">task_workunit_id = #{taskWorkunitId},</if>
            <if test="workorderId != null">workorder_id = #{workorderId},</if>
            <if test="workorderSoDirectiveId != null">workorder_so_directive_id = #{workorderSoDirectiveId},</if>
            <if test="workorderSoSizeItemId != null">workorder_so_size_item_id = #{workorderSoSizeItemId},</if>
            <if test="feedbackId != null">feedback_id = #{feedbackId},</if>
            <if test="sheetCount != null">sheet_count = #{sheetCount},</if>
            <if test="barcode != null">barcode=#{barcode},</if>
            <if test="qrcode != null">qrcode=#{qrcode},</if>
            <if test="minTotalCount != null">min_total_count=#{minTotalCount},</if>
            <if test="minSheetCount != null">min_sheet_count=#{minSheetCount},</if>
            <if test="minPackageNum != null">min_package_num=#{minPackageNum},</if>
            <if test="totalCount != null">total_count=#{totalCount},</if>
            <if test="packageNum != null">package_num=#{packageNum},</if>
            <if test="packageNum2 != null">package_num2=#{packageNum2},</if>
            <if test="netWeight != null">net_weight=#{netWeight},</if>
            <if test="checkBy != null">check_by=#{checkBy},</if>
            <if test="inputBy != null">input_by=#{inputBy},</if>
            <if test="printTime != null">print_time=#{printTime},</if>
            <if test="lossNum != null">loss_num=#{lossNum},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="printBy != null">print_by=#{printBy},</if>
            <if test="printDate != null">print_date=#{printDate},</if>
            <if test="grossWeight != null">gross_weight=#{grossWeight},</if>
            <if test="boxWeight != null">box_weight=#{boxWeight},</if>
            <if test="packageStandard != null">package_standard = #{packageStandard},</if>
            <if test="packVolume != null">pack_volume = #{packVolume},</if>
        </trim>
        where record_id = #{recordId}
    </update>

    <delete id="deleteProPackagePrintRecordByRecordId" parameterType="Long">
        delete from pro_package_print_record where record_id = #{recordId}
    </delete>

    <delete id="deleteProPackagePrintRecordByRecordIds" parameterType="String">
        delete from pro_package_print_record where record_id in
        <foreach item="recordId" collection="array" open="(" separator="," close=")">
            #{recordId}
        </foreach>
    </delete>
</mapper>
