<?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.xisc.pm.infra.mapper.PmContMscTechMapper">


    <sql id = "BaseSql">
        PCMT.CONT_MSC_ID,
        PCMT.ORDER_NO,
        PCMT.PRO_CONT_ID,
        PCMT.MSC_LINE_NO,
        PCMT.PLATE_PD_QTY,
        PCMT.SLAB_PD_QTY,
        PCMT.CC_PD_QTY,
        PCMT.WHOLE_BACKLOG,
        PCMT.WHOLE_BACKLOG_CODE,
        PCMT.ST_NO,
        PCMT.ST_NO1,
        PCMT.ST_NO2,
        PCMT.ST_NO3,
        PCMT.ST_NO4,
        PCMT.ST_NO5,
        PCMT.ST_NO6,
        PCMT.ST_NO7,
        PCMT.ST_NO8,
        PCMT.ST_NO9,
        PCMT.SLAB_PLACE_STD,
        PCMT.SLAB_FINISH_CODE,
        PCMT.FLAME_CLEAN_DIV,
        PCMT.SLAB_DEST,
        PCMT.EXPAND_QUOT,
        PCMT.AD_TYPE_CODE,
        PCMT.PLATE_DT_CODE,
        PCMT.GAUGE_MUL_MIN1,
        PCMT.MIN_CR1_THICK,
        PCMT.ROLL_DIRECT_CODE,
        PCMT.CTRL_ROLL_CODE,
        PCMT.CTRL_ROLL_CODE1,
        PCMT.CTRL_ROLL_CODE34,
        PCMT.AD_MODE_CODE,
        PCMT.AD_MODE_CODE34,
        PCMT.ROLL_MODE,
        PCMT.COMPRESS_MIN,
        PCMT.MULTI_PLATE_FLAG,
        PCMT.RF_PATH,
        PCMT.FUR_TYPE,
        PCMT.WIDEN_MIN,
        PCMT.MIDDLE_COOL_MODE,
        PCMT.MAX_MIDDLE_COOL_SPEED,
        PCMT.HOT_RECTIFY_FLAG,
        PCMT.HOT_RECTIFY_METHOD_CODE,
        PCMT.HOT_SEND_DIV,
        PCMT.HOT_CHARGE_FLAG,
        PCMT.G_FLAG,
        PCMT.CS_FLAG,
        PCMT.DSS_FLAG,
        PCMT.SS_FLAG,
        PCMT.DS_FLAG,
        PCMT.HEAD_CUT,
        PCMT.TAIL_CUT,
        PCMT.ULT_DETECT_METHOD_CODE,
        PCMT.ULT_STG_CODE,
        PCMT.ULT_CODE,
        PCMT.COOL_CODE,
        PCMT.CUT_MODE_CODE,
        PCMT.HEAT_TREAT_MODE,
        PCMT.KEEP_TEMP_AIM,
        PCMT.TENANT_ID,
        PCMT.ATTRIBUTE1,
        PCMT.ATTRIBUTE2,
        PCMT.ATTRIBUTE3,
        PCMT.ATTRIBUTE4,
        PCMT.ATTRIBUTE5,
        PCMT.WHOLE_HEAT_TREATMENT_TYPE,
        PCMT.SLAB_PLACE_CODE,
        PCMT.SLAB_THK_MIN,
        PCMT.SLAB_THK_MAX,
        PCMT.creation_date,        PCMT.created_by,        PCMT.last_updated_by,        PCMT.last_update_date,        PCMT.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmContMscTech">
        select
        <include refid = "BaseSql"/>
        from PM_CONT_MSC_TECH PCMT
        <where>
            <if test="contMscId !=null">
                and PCMT.CONT_MSC_ID = #{contMscId,jdbcType = INTEGER}
            </if>
            <if test="orderNo !=null">
                and PCMT.ORDER_NO = #{orderNo,jdbcType = VARCHAR}
            </if>
            <if test="proContId !=null">
                and PCMT.PRO_CONT_ID = #{proContId,jdbcType = INTEGER}
            </if>
            <if test="mscLineNo !=null">
                and PCMT.MSC_LINE_NO = #{mscLineNo,jdbcType = VARCHAR}
            </if>
            <if test="platePdQty !=null">
                and PCMT.PLATE_PD_QTY = #{platePdQty,jdbcType = INTEGER}
            </if>
            <if test="slabPdQty !=null">
                and PCMT.SLAB_PD_QTY = #{slabPdQty,jdbcType = INTEGER}
            </if>
            <if test="ccPdQty !=null">
                and PCMT.CC_PD_QTY = #{ccPdQty,jdbcType = INTEGER}
            </if>
            <if test="wholeBacklog !=null">
                and PCMT.WHOLE_BACKLOG = #{wholeBacklog,jdbcType = VARCHAR}
            </if>
            <if test="wholeBacklogCode !=null">
                and PCMT.WHOLE_BACKLOG_CODE = #{wholeBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="stNo !=null">
                and PCMT.ST_NO = #{stNo,jdbcType = VARCHAR}
            </if>
            <if test="stNo1 !=null">
                and PCMT.ST_NO1 = #{stNo1,jdbcType = VARCHAR}
            </if>
            <if test="stNo2 !=null">
                and PCMT.ST_NO2 = #{stNo2,jdbcType = VARCHAR}
            </if>
            <if test="stNo3 !=null">
                and PCMT.ST_NO3 = #{stNo3,jdbcType = VARCHAR}
            </if>
            <if test="stNo4 !=null">
                and PCMT.ST_NO4 = #{stNo4,jdbcType = VARCHAR}
            </if>
            <if test="stNo5 !=null">
                and PCMT.ST_NO5 = #{stNo5,jdbcType = VARCHAR}
            </if>
            <if test="stNo6 !=null">
                and PCMT.ST_NO6 = #{stNo6,jdbcType = VARCHAR}
            </if>
            <if test="stNo7 !=null">
                and PCMT.ST_NO7 = #{stNo7,jdbcType = VARCHAR}
            </if>
            <if test="stNo8 !=null">
                and PCMT.ST_NO8 = #{stNo8,jdbcType = VARCHAR}
            </if>
            <if test="stNo9 !=null">
                and PCMT.ST_NO9 = #{stNo9,jdbcType = VARCHAR}
            </if>
            <if test="slabPlaceStd !=null">
                and PCMT.SLAB_PLACE_STD = #{slabPlaceStd,jdbcType = VARCHAR}
            </if>
            <if test="slabFinishCode !=null">
                and PCMT.SLAB_FINISH_CODE = #{slabFinishCode,jdbcType = VARCHAR}
            </if>
            <if test="flameCleanDiv !=null">
                and PCMT.FLAME_CLEAN_DIV = #{flameCleanDiv,jdbcType = VARCHAR}
            </if>
            <if test="slabDest !=null">
                and PCMT.SLAB_DEST = #{slabDest,jdbcType = VARCHAR}
            </if>
            <if test="expandQuot !=null">
                and PCMT.EXPAND_QUOT = #{expandQuot,jdbcType = INTEGER}
            </if>
            <if test="adTypeCode !=null">
                and PCMT.AD_TYPE_CODE = #{adTypeCode,jdbcType = VARCHAR}
            </if>
            <if test="plateDtCode !=null">
                and PCMT.PLATE_DT_CODE = #{plateDtCode,jdbcType = VARCHAR}
            </if>
            <if test="gaugeMulMin1 !=null">
                and PCMT.GAUGE_MUL_MIN1 = #{gaugeMulMin1,jdbcType = INTEGER}
            </if>
            <if test="minCr1Thick !=null">
                and PCMT.MIN_CR1_THICK = #{minCr1Thick,jdbcType = INTEGER}
            </if>
            <if test="rollDirectCode !=null">
                and PCMT.ROLL_DIRECT_CODE = #{rollDirectCode,jdbcType = VARCHAR}
            </if>
            <if test="ctrlRollCode !=null">
                and PCMT.CTRL_ROLL_CODE = #{ctrlRollCode,jdbcType = VARCHAR}
            </if>
            <if test="ctrlRollCode1 !=null">
                and PCMT.CTRL_ROLL_CODE1 = #{ctrlRollCode1,jdbcType = VARCHAR}
            </if>
            <if test="ctrlRollCode34 !=null">
                and PCMT.CTRL_ROLL_CODE34 = #{ctrlRollCode34,jdbcType = VARCHAR}
            </if>
            <if test="adModeCode !=null">
                and PCMT.AD_MODE_CODE = #{adModeCode,jdbcType = VARCHAR}
            </if>
            <if test="adModeCode34 !=null">
                and PCMT.AD_MODE_CODE34 = #{adModeCode34,jdbcType = VARCHAR}
            </if>
            <if test="rollMode !=null">
                and PCMT.ROLL_MODE = #{rollMode,jdbcType = VARCHAR}
            </if>
            <if test="compressMin !=null">
                and PCMT.COMPRESS_MIN = #{compressMin,jdbcType = INTEGER}
            </if>
            <if test="multiPlateFlag !=null">
                and PCMT.MULTI_PLATE_FLAG = #{multiPlateFlag,jdbcType = INTEGER}
            </if>
            <if test="rfPath !=null">
                and PCMT.RF_PATH = #{rfPath,jdbcType = VARCHAR}
            </if>
            <if test="furType !=null">
                and PCMT.FUR_TYPE = #{furType,jdbcType = VARCHAR}
            </if>
            <if test="widenMin !=null">
                and PCMT.WIDEN_MIN = #{widenMin,jdbcType = INTEGER}
            </if>
            <if test="middleCoolMode !=null">
                and PCMT.MIDDLE_COOL_MODE = #{middleCoolMode,jdbcType = VARCHAR}
            </if>
            <if test="maxMiddleCoolSpeed !=null">
                and PCMT.MAX_MIDDLE_COOL_SPEED = #{maxMiddleCoolSpeed,jdbcType = INTEGER}
            </if>
            <if test="hotRectifyFlag !=null">
                and PCMT.HOT_RECTIFY_FLAG = #{hotRectifyFlag,jdbcType = INTEGER}
            </if>
            <if test="hotRectifyMethodCode !=null">
                and PCMT.HOT_RECTIFY_METHOD_CODE = #{hotRectifyMethodCode,jdbcType = VARCHAR}
            </if>
            <if test="hotSendDiv !=null">
                and PCMT.HOT_SEND_DIV = #{hotSendDiv,jdbcType = VARCHAR}
            </if>
            <if test="hotChargeFlag !=null">
                and PCMT.HOT_CHARGE_FLAG = #{hotChargeFlag,jdbcType = VARCHAR}
            </if>
            <if test="gFlag !=null">
                and PCMT.G_FLAG = #{gFlag,jdbcType = INTEGER}
            </if>
            <if test="csFlag !=null">
                and PCMT.CS_FLAG = #{csFlag,jdbcType = INTEGER}
            </if>
            <if test="dssFlag !=null">
                and PCMT.DSS_FLAG = #{dssFlag,jdbcType = INTEGER}
            </if>
            <if test="ssFlag !=null">
                and PCMT.SS_FLAG = #{ssFlag,jdbcType = INTEGER}
            </if>
            <if test="dsFlag !=null">
                and PCMT.DS_FLAG = #{dsFlag,jdbcType = INTEGER}
            </if>
            <if test="headCut !=null">
                and PCMT.HEAD_CUT = #{headCut,jdbcType = INTEGER}
            </if>
            <if test="tailCut !=null">
                and PCMT.TAIL_CUT = #{tailCut,jdbcType = INTEGER}
            </if>
            <if test="ultDetectMethodCode !=null">
                and PCMT.ULT_DETECT_METHOD_CODE = #{ultDetectMethodCode,jdbcType = VARCHAR}
            </if>
            <if test="ultStgCode !=null">
                and PCMT.ULT_STG_CODE = #{ultStgCode,jdbcType = VARCHAR}
            </if>
            <if test="ultCode !=null">
                and PCMT.ULT_CODE = #{ultCode,jdbcType = VARCHAR}
            </if>
            <if test="coolCode !=null">
                and PCMT.COOL_CODE = #{coolCode,jdbcType = VARCHAR}
            </if>
            <if test="cutModeCode !=null">
                and PCMT.CUT_MODE_CODE = #{cutModeCode,jdbcType = VARCHAR}
            </if>
            <if test="heatTreatMode !=null">
                and PCMT.HEAT_TREAT_MODE = #{heatTreatMode,jdbcType = VARCHAR}
            </if>
            <if test="keepTempAim !=null">
                and PCMT.KEEP_TEMP_AIM = #{keepTempAim,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PCMT.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PCMT.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PCMT.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PCMT.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PCMT.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PCMT.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
            <if test="wholeHeatTreatmentType !=null">
                and PCMT.WHOLE_HEAT_TREATMENT_TYPE = #{wholeHeatTreatmentType,jdbcType = VARCHAR}
            </if>
            <if test="slabPlaceCode !=null">
                and PCMT.SLAB_PLACE_CODE = #{slabPlaceCode,jdbcType = VARCHAR}
            </if>
        </where>
    </select>

    <select id="queryList" resultType = "com.xisc.pm.domain.entity.PmContMscTech">
         select
        <include refid = "BaseSql"/>
        from PM_CONT_MSC_TECH PCMT
        <where>
           <if test="orderNoList != null and orderNoList.size()>0">
                and  (PCMT.ORDER_NO in
                <foreach collection="orderNoList" item="orderNo" open="(" close=")" separator="," index="index">
                    <if test="(index % 999) == 998"> NULL ) OR PCMT.ORDER_NO in (</if> #{orderNo}
                </foreach>)
            </if>
            <if test="tenantId !=null">
                and PCMT.TENANT_ID = #{tenantId}
            </if>
         <if test="designProdLineCodeList != null and designProdLineCodeList.size() > 0">
				and PCMT.MSC_LINE_NO in
				<foreach collection="designProdLineCodeList" item="designProdLineCode" open="(" close=")" separator="," >
					#{designProdLineCode}
				</foreach>
         </if>
        </where>
    </select>
</mapper>

