<?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.md.mapper.MdProductPublishedConfMapper">

    <resultMap type="MdProductPublishedConf" id="MdProductPublishedConfResult">
        <result property="itemId"    column="item_id"    />
        <result property="modulus"    column="modulus"    />
        <result property="rowNum"    column="row_num"    />
        <result property="columnNum"    column="column_num"    />
        <result property="contactNum"    column="contact_num"    />
        <result property="rowDoubleBlade"    column="row_double_blade"    />
        <result property="columnDoubleBlade"    column="column_double_blade"    />
        <result property="dispatchMultiple"    column="dispatch_multiple"    />
        <result property="sheetLength"    column="sheet_length"    />
        <result property="sheetWidth"    column="sheet_width"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectMdProductPublishedConfVo">
        select item_id, modulus, row_num, column_num, contact_num, row_double_blade, column_double_blade, dispatch_multiple, sheet_length, sheet_width, create_by, create_time, update_by, update_time from md_product_published_conf
    </sql>

    <select id="selectMdProductPublishedConfList" parameterType="MdProductPublishedConf" resultMap="MdProductPublishedConfResult">
        <include refid="selectMdProductPublishedConfVo"/>
        <where>
            <if test="itemId != null "> and item_id = #{itemId}</if>
            <if test="modulus != null "> and modulus = #{modulus}</if>
            <if test="rowNum != null "> and row_num = #{rowNum}</if>
            <if test="columnNum != null "> and column_num = #{columnNum}</if>
            <if test="contactNum != null "> and contact_num = #{contactNum}</if>
            <if test="rowDoubleBlade != null "> and row_double_blade = #{rowDoubleBlade}</if>
            <if test="columnDoubleBlade != null "> and column_double_blade = #{columnDoubleBlade}</if>
            <if test="dispatchMultiple != null "> and dispatch_multiple = #{dispatchMultiple}</if>
            <if test="sheetLength != null "> and sheet_length = #{sheetLength}</if>
            <if test="sheetWidth != null "> and sheet_width = #{sheetWidth}</if>
        </where>
    </select>

    <select id="selectMdProductPublishedConfByItemId" parameterType="Long" resultMap="MdProductPublishedConfResult">
        <include refid="selectMdProductPublishedConfVo"/>
        where item_id = #{itemId}
    </select>

    <insert id="insertMdProductPublishedConf" parameterType="MdProductPublishedConf">
        insert into md_product_published_conf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="itemId != null">item_id,</if>
            <if test="modulus != null">modulus,</if>
            <if test="rowNum != null">row_num,</if>
            <if test="columnNum != null">column_num,</if>
            <if test="contactNum != null">contact_num,</if>
            <if test="rowDoubleBlade != null">row_double_blade,</if>
            <if test="columnDoubleBlade != null">column_double_blade,</if>
            <if test="dispatchMultiple != null">dispatch_multiple,</if>
            <if test="sheetLength != null">sheet_length,</if>
            <if test="sheetWidth != null">sheet_width,</if>
            <if test="createBy != null">create_by,</if>
            create_time
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="itemId != null">#{itemId},</if>
            <if test="modulus != null">#{modulus},</if>
            <if test="rowNum != null">#{rowNum},</if>
            <if test="columnNum != null">#{columnNum},</if>
            <if test="contactNum != null">#{contactNum},</if>
            <if test="rowDoubleBlade != null">#{rowDoubleBlade},</if>
            <if test="columnDoubleBlade != null">#{columnDoubleBlade},</if>
            <if test="dispatchMultiple != null">#{dispatchMultiple},</if>
            <if test="sheetLength != null">#{sheetLength},</if>
            <if test="sheetWidth != null">#{sheetWidth},</if>
            <if test="createBy != null">#{createBy},</if>
            sysdate()
         </trim>
    </insert>

    <update id="updateMdProductPublishedConf" parameterType="MdProductPublishedConf">
        update md_product_published_conf
        <trim prefix="SET" suffixOverrides=",">
            <if test="modulus != null">modulus = #{modulus},</if>
            <if test="rowNum != null">row_num = #{rowNum},</if>
            <if test="columnNum != null">column_num = #{columnNum},</if>
            <if test="contactNum != null">contact_num = #{contactNum},</if>
            <if test="rowDoubleBlade != null">row_double_blade = #{rowDoubleBlade},</if>
            <if test="columnDoubleBlade != null">column_double_blade = #{columnDoubleBlade},</if>
            <if test="dispatchMultiple != null">dispatch_multiple = #{dispatchMultiple},</if>
            <if test="sheetLength != null">sheet_length = #{sheetLength},</if>
            <if test="sheetWidth != null">sheet_width = #{sheetWidth},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            update_time = sysdate()
        </trim>
        where item_id = #{itemId}
    </update>

    <delete id="deleteMdProductPublishedConfByItemId" parameterType="Long">
        delete from md_product_published_conf where item_id = #{itemId}
    </delete>

    <delete id="deleteMdProductPublishedConfByItemIds" parameterType="String">
        delete from md_product_published_conf where item_id in
        <foreach item="itemId" collection="array" open="(" separator="," close=")">
            #{itemId}
        </foreach>
    </delete>
</mapper>
