<?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.fizz.business.mapper.PdiSetupMapper">

    <resultMap type="PdiSetup" id="PdiSetupResult">
        <result property="ID"    column="ID"    />
        <result property="COILID"    column="COILID"    />
        <result property="PLANID"    column="PLANID"    />
        <result property="porTension"    column="POR_TENSION"    />
        <result property="celTension"    column="CEL_TENSION"    />
        <result property="cleanTension"    column="CLEAN_TENSION"    />
        <result property="furTension"    column="FUR_TENSION"    />
        <result property="towerTension"    column="TOWER_TENSION"    />
        <result property="tmNoneTension"    column="TM_NONE_TENSION"    />
        <result property="tmEntryTension"    column="TM_ENTRY_TENSION"    />
        <result property="tmExitTension"    column="TM_EXIT_TENSION"    />
        <result property="tmRollforce"    column="TM_ROLLFORCE"    />
        <result property="tmBendforce"    column="TM_BENDFORCE"    />
        <result property="tmAcrMesh"    column="TM_ACR_MESH"    />
        <result property="tmBrMesh"    column="TM_BR_MESH"    />
        <result property="tlNoneTension"    column="TL_NONE_TENSION"    />
        <result property="tlExitTension"    column="TL_EXIT_TENSION"    />
        <result property="tlElong"    column="TL_ELONG"    />
        <result property="tlLvlMesh1"    column="TL_LVL_MESH1"    />
        <result property="tlLvlMesh2"    column="TL_LVL_MESH2"    />
        <result property="tlAcbMesh"    column="TL_ACB_MESH"    />
        <result property="coatTension"    column="COAT_TENSION"    />
        <result property="cxlTension"    column="CXL_TENSION"    />
        <result property="trTension"    column="TR_TENSION"    />
        <result property="createTime"    column="CREATE_TIME"    />
        <result property="updateTime"    column="UPDATE_TIME"    />
        <result property="TYPE"    column="TYPE"    />
    </resultMap>

    <sql id="selectPdiSetupVo">
        select ID, COILID, PLANID, POR_TENSION, CEL_TENSION, CLEAN_TENSION, FUR_TENSION, TOWER_TENSION, TM_NONE_TENSION, TM_ENTRY_TENSION, TM_EXIT_TENSION, TM_ROLLFORCE, TM_BENDFORCE, TM_ACR_MESH, TM_BR_MESH, TL_NONE_TENSION, TL_EXIT_TENSION, TL_ELONG, TL_LVL_MESH1, TL_LVL_MESH2, TL_ACB_MESH, COAT_TENSION, CXL_TENSION, TR_TENSION, CREATE_TIME, UPDATE_TIME, TYPE from pdi_setup
    </sql>

    <select id="selectPdiSetupList" parameterType="PdiSetup" resultMap="PdiSetupResult">
        <include refid="selectPdiSetupVo"/>
        <where>
            <if test="COILID != null  and COILID != ''"> and COILID = #{COILID}</if>
            <if test="PLANID != null  and PLANID != ''"> and PLANID = #{PLANID}</if>
            <if test="porTension != null "> and POR_TENSION = #{porTension}</if>
            <if test="celTension != null "> and CEL_TENSION = #{celTension}</if>
            <if test="cleanTension != null "> and CLEAN_TENSION = #{cleanTension}</if>
            <if test="furTension != null "> and FUR_TENSION = #{furTension}</if>
            <if test="towerTension != null "> and TOWER_TENSION = #{towerTension}</if>
            <if test="tmNoneTension != null "> and TM_NONE_TENSION = #{tmNoneTension}</if>
            <if test="tmEntryTension != null "> and TM_ENTRY_TENSION = #{tmEntryTension}</if>
            <if test="tmExitTension != null "> and TM_EXIT_TENSION = #{tmExitTension}</if>
            <if test="tmRollforce != null "> and TM_ROLLFORCE = #{tmRollforce}</if>
            <if test="tmBendforce != null "> and TM_BENDFORCE = #{tmBendforce}</if>
            <if test="tmAcrMesh != null "> and TM_ACR_MESH = #{tmAcrMesh}</if>
            <if test="tmBrMesh != null "> and TM_BR_MESH = #{tmBrMesh}</if>
            <if test="tlNoneTension != null "> and TL_NONE_TENSION = #{tlNoneTension}</if>
            <if test="tlExitTension != null "> and TL_EXIT_TENSION = #{tlExitTension}</if>
            <if test="tlElong != null "> and TL_ELONG = #{tlElong}</if>
            <if test="tlLvlMesh1 != null "> and TL_LVL_MESH1 = #{tlLvlMesh1}</if>
            <if test="tlLvlMesh2 != null "> and TL_LVL_MESH2 = #{tlLvlMesh2}</if>
            <if test="tlAcbMesh != null "> and TL_ACB_MESH = #{tlAcbMesh}</if>
            <if test="coatTension != null "> and COAT_TENSION = #{coatTension}</if>
            <if test="cxlTension != null "> and CXL_TENSION = #{cxlTension}</if>
            <if test="trTension != null "> and TR_TENSION = #{trTension}</if>
            <if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
            <if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
            <if test="TYPE != null "> and TYPE = #{TYPE}</if>
        </where>
    </select>

    <select id="selectPdiSetupById" parameterType="Long" resultMap="PdiSetupResult">
        <include refid="selectPdiSetupVo"/>
        where ID = #{id}
    </select>

    <insert id="insertPdiSetup" parameterType="PdiSetup" useGeneratedKeys="true" keyProperty="ID">
        insert into pdi_setup
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="COILID != null">COILID,</if>
            <if test="PLANID != null">PLANID,</if>
            <if test="porTension != null">POR_TENSION,</if>
            <if test="celTension != null">CEL_TENSION,</if>
            <if test="cleanTension != null">CLEAN_TENSION,</if>
            <if test="furTension != null">FUR_TENSION,</if>
            <if test="towerTension != null">TOWER_TENSION,</if>
            <if test="tmNoneTension != null">TM_NONE_TENSION,</if>
            <if test="tmEntryTension != null">TM_ENTRY_TENSION,</if>
            <if test="tmExitTension != null">TM_EXIT_TENSION,</if>
            <if test="tmRollforce != null">TM_ROLLFORCE,</if>
            <if test="tmBendforce != null">TM_BENDFORCE,</if>
            <if test="tmAcrMesh != null">TM_ACR_MESH,</if>
            <if test="tmBrMesh != null">TM_BR_MESH,</if>
            <if test="tlNoneTension != null">TL_NONE_TENSION,</if>
            <if test="tlExitTension != null">TL_EXIT_TENSION,</if>
            <if test="tlElong != null">TL_ELONG,</if>
            <if test="tlLvlMesh1 != null">TL_LVL_MESH1,</if>
            <if test="tlLvlMesh2 != null">TL_LVL_MESH2,</if>
            <if test="tlAcbMesh != null">TL_ACB_MESH,</if>
            <if test="coatTension != null">COAT_TENSION,</if>
            <if test="cxlTension != null">CXL_TENSION,</if>
            <if test="trTension != null">TR_TENSION,</if>
            <if test="createTime != null">CREATE_TIME,</if>
            <if test="updateTime != null">UPDATE_TIME,</if>
            <if test="TYPE != null">TYPE,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="COILID != null">#{COILID},</if>
            <if test="PLANID != null">#{PLANID},</if>
            <if test="porTension != null">#{porTension},</if>
            <if test="celTension != null">#{celTension},</if>
            <if test="cleanTension != null">#{cleanTension},</if>
            <if test="furTension != null">#{furTension},</if>
            <if test="towerTension != null">#{towerTension},</if>
            <if test="tmNoneTension != null">#{tmNoneTension},</if>
            <if test="tmEntryTension != null">#{tmEntryTension},</if>
            <if test="tmExitTension != null">#{tmExitTension},</if>
            <if test="tmRollforce != null">#{tmRollforce},</if>
            <if test="tmBendforce != null">#{tmBendforce},</if>
            <if test="tmAcrMesh != null">#{tmAcrMesh},</if>
            <if test="tmBrMesh != null">#{tmBrMesh},</if>
            <if test="tlNoneTension != null">#{tlNoneTension},</if>
            <if test="tlExitTension != null">#{tlExitTension},</if>
            <if test="tlElong != null">#{tlElong},</if>
            <if test="tlLvlMesh1 != null">#{tlLvlMesh1},</if>
            <if test="tlLvlMesh2 != null">#{tlLvlMesh2},</if>
            <if test="tlAcbMesh != null">#{tlAcbMesh},</if>
            <if test="coatTension != null">#{coatTension},</if>
            <if test="cxlTension != null">#{cxlTension},</if>
            <if test="trTension != null">#{trTension},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="TYPE != null">#{TYPE},</if>
        </trim>
    </insert>

    <update id="updatePdiSetup" parameterType="PdiSetup">
        update pdi_setup
        <trim prefix="SET" suffixOverrides=",">
            <if test="COILID != null">COILID = #{COILID},</if>
            <if test="PLANID != null">PLANID = #{PLANID},</if>
            <if test="porTension != null">POR_TENSION = #{porTension},</if>
            <if test="celTension != null">CEL_TENSION = #{celTension},</if>
            <if test="cleanTension != null">CLEAN_TENSION = #{cleanTension},</if>
            <if test="furTension != null">FUR_TENSION = #{furTension},</if>
            <if test="towerTension != null">TOWER_TENSION = #{towerTension},</if>
            <if test="tmNoneTension != null">TM_NONE_TENSION = #{tmNoneTension},</if>
            <if test="tmEntryTension != null">TM_ENTRY_TENSION = #{tmEntryTension},</if>
            <if test="tmExitTension != null">TM_EXIT_TENSION = #{tmExitTension},</if>
            <if test="tmRollforce != null">TM_ROLLFORCE = #{tmRollforce},</if>
            <if test="tmBendforce != null">TM_BENDFORCE = #{tmBendforce},</if>
            <if test="tmAcrMesh != null">TM_ACR_MESH = #{tmAcrMesh},</if>
            <if test="tmBrMesh != null">TM_BR_MESH = #{tmBrMesh},</if>
            <if test="tlNoneTension != null">TL_NONE_TENSION = #{tlNoneTension},</if>
            <if test="tlExitTension != null">TL_EXIT_TENSION = #{tlExitTension},</if>
            <if test="tlElong != null">TL_ELONG = #{tlElong},</if>
            <if test="tlLvlMesh1 != null">TL_LVL_MESH1 = #{tlLvlMesh1},</if>
            <if test="tlLvlMesh2 != null">TL_LVL_MESH2 = #{tlLvlMesh2},</if>
            <if test="tlAcbMesh != null">TL_ACB_MESH = #{tlAcbMesh},</if>
            <if test="coatTension != null">COAT_TENSION = #{coatTension},</if>
            <if test="cxlTension != null">CXL_TENSION = #{cxlTension},</if>
            <if test="trTension != null">TR_TENSION = #{trTension},</if>
            <if test="createTime != null">CREATE_TIME = #{createTime},</if>
            <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
            <if test="TYPE != null">TYPE = #{TYPE},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deletePdiSetupById" parameterType="Long">
        delete from pdi_setup where ID = #{id}
    </delete>

    <delete id="deletePdiSetupByIds" parameterType="String">
        delete from pdi_setup where ID in
        <foreach item="ID" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>