<?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.PmCmdContTraMapper">


    <sql id = "BaseSql">
        PCCT.TRA_ID,
        PCCT.OPERATION_TYPE,
        PCCT.OPERATION_USER,
        PCCT.OPERATION_TIME,
        PCCT.PM_CMD_CONT_ID,
        PCCT.PONO_SLAB_NO,
        PCCT.TMP_SLAB_NO,
        PCCT.ORDER_NO,
        PCCT.ORDER_SEQ_NO,
        PCCT.AXIS_FLAG,
        PCCT.WHOLE_BACKLOG_NO,
        PCCT.WHOLE_BACKLOG,
        PCCT.PD_BACKLOG_SEQ,
        PCCT.PD_BACKLOG_CODE,
        PCCT.PLATE_NO,
        PCCT.SLAB_NO,
        PCCT.MAT_DESIGN_KIND,
        PCCT.ORDER_TYPE_CODE,
        PCCT.EXPORT_FLAG,
        PCCT.TWO_ROLL_INTERIM_FLAG,
        PCCT.FIN_CUST_CODE,
        PCCT.PSC,
        PCCT.APN,
        PCCT.MSC,
        PCCT.PROD_CODE_HP,
        PCCT.SG_STD,
        PCCT.SG_SIGN,
        PCCT.ST_NO,
        PCCT.UOE_FLAG,
        PCCT.SHP_CODE,
        PCCT.SMALL_PLATE_NUM,
        PCCT.ROLL_MODE,
        PCCT.PROD_SR_MARK,
        PCCT.PROD_SIDE_MARK,
        PCCT.PROD_SHOT_MARK,
        PCCT.PROD_N_MARK,
        PCCT.PROD_Q_MARK,
        PCCT.PROD_T_MARK,
        PCCT.PROD_A_MARK,
        PCCT.BACKLOG_UT_MARK,
        PCCT.BACKLOG_N_MARK,
        PCCT.BACKLOG_Q_MARK,
        PCCT.BACKLOG_T_MARK,
        PCCT.BACKLOG_A_MARK,
        PCCT.BACKLOG_DEMAG_MARK,
        PCCT.BACKLOG_PT_MARK,
        PCCT.BACKLOG_MT_MARK,
        PCCT.BACKLOG_TMCP_MARK,
        PCCT.UNIT_WT_MAX,
        PCCT.UNIT_WT_MIN,
        PCCT.UNIT_WT_AIM,
        PCCT.ORDER_THICK,
        PCCT.ORDER_WIDTH,
        PCCT.ORDER_LEN,
        PCCT.WIDTH_DIV,
        PCCT.WIDTH_MAX,
        PCCT.WIDTH_MIN,
        PCCT.LEN_DIV,
        PCCT.ORDER_LEN_MIN,
        PCCT.ORDER_LEN_MAX,
        PCCT.SMALL_PLATE_THICK,
        PCCT.SMALL_PLATE_WIDTH,
        PCCT.SMALL_PLATE_LEN,
        PCCT.THICK1,
        PCCT.THICK2,
        PCCT.THICK3,
        PCCT.LEN1,
        PCCT.LEN2,
        PCCT.LEN3,
        PCCT.LEN4,
        PCCT.LEN5,
        PCCT.THICK_TOL1_MAX,
        PCCT.THICK_TOL1_MIN,
        PCCT.THICK_TOL2_MAX,
        PCCT.THICK_TOL2_MIN,
        PCCT.THICK_TOL3_MAX,
        PCCT.THICK_TOL3_MIN,
        PCCT.PLATE_PRE_PROC1,
        PCCT.PLATE_PRE_PROC2,
        PCCT.PLATE_PRE_PROC3,
        PCCT.PLATE_PRE_PROC4,
        PCCT.PLATE_PRE_PROC5,
        PCCT.PLATE_PRE_PROC6,
        PCCT.PLATE_PRE_PROC7,
        PCCT.PLATE_PRE_PROC8,
        PCCT.PLATE_PRE_PROC9,
        PCCT.PLATE_PRE_PROC10,
        PCCT.PLATE_PRE_PROC11,
        PCCT.PLATE_PRE_PROC12,
        PCCT.PLATE_PRE_PROC13,
        PCCT.PLATE_PRE_PROC14,
        PCCT.PLATE_PRE_PROC15,
        PCCT.PLATE_PRE_PROC16,
        PCCT.PLATE_PRE_PROC17,
        PCCT.PLATE_PRE_PROC18,
        PCCT.PLATE_PRE_PROC19,
        PCCT.PLATE_PRE_PROC20,
        PCCT.PLATE_PRE_PROC21,
        PCCT.PLATE_PRE_PROC22,
        PCCT.PLATE_PRE_PROC23,
        PCCT.PLATE_PRE_PROC24,
        PCCT.PLATE_PRE_PROC25,
        PCCT.PLATE_PRE_PROC26,
        PCCT.PLATE_PRE_PROC27,
        PCCT.PLATE_PRE_PROC28,
        PCCT.PLATE_PRE_PROC29,
        PCCT.PLATE_PRE_PROC30,
        PCCT.TRIM_CODE,
        PCCT.WIDEN_MIN,
        PCCT.COMPRESS_MIN,
        PCCT.ROLL_DIRECT_CODE,
        PCCT.CTRL_ROLL_CODE,
        PCCT.AD_TYPE_CODE,
        PCCT.AD_MODE_CODE,
        PCCT.HOT_RECTIFY_FLAG,
        PCCT.COLD_RECTIFY_FLAG,
        PCCT.WARM_RECTIFY_FLAG,
        PCCT.WARM_PRESS_FLAG,
        PCCT.CAN_PRESS_FLAG,
        PCCT.WP_TEMP_MIN,
        PCCT.HEAD_CUT,
        PCCT.TAIL_CUT,
        PCCT.HARD_AIM,
        PCCT.CUT_MODE_CODE,
        PCCT.G_FLAG,
        PCCT.CS_FLAG,
        PCCT.DSS_FLAG,
        PCCT.SS_FLAG,
        PCCT.DS_FLAG,
        PCCT.HEAT_TREAT_MODE,
        PCCT.KEEP_TEMP_MAX1,
        PCCT.KEEP_TEMP_MIN1,
        PCCT.KEEP_TEMP_MAX2,
        PCCT.KEEP_TEMP_MIN2,
        PCCT.KEEP_TEMP_MAX3,
        PCCT.KEEP_TEMP_MIN3,
        PCCT.KEEP_TEMP_MAX4,
        PCCT.KEEP_TEMP_MIN4,
        PCCT.KEEP_TEMP_MAX5,
        PCCT.KEEP_TEMP_MIN5,
        PCCT.KEEP_TEMP_MAX6,
        PCCT.KEEP_TEMP_MIN6,
        PCCT.BACKFIRE_MAX1,
        PCCT.BACKFIRE_MIN1,
        PCCT.BACKFIRE_MAX2,
        PCCT.BACKFIRE_MIN2,
        PCCT.BACKFIRE_MAX3,
        PCCT.BACKFIRE_MIN3,
        PCCT.BACKFIRE_MAX4,
        PCCT.BACKFIRE_MIN4,
        PCCT.BACKFIRE_MAX5,
        PCCT.BACKFIRE_MIN5,
        PCCT.BACKFIRE_MAX6,
        PCCT.BACKFIRE_MIN6,
        PCCT.WIDTH_BEFORE_QN,
        PCCT.LEN_BEFORE_QN,
        PCCT.CROP_TYPE_HP,
        PCCT.BETTER_SURF_WARD_CODE,
        PCCT.ULT_DETECT_METHOD_CODE,
        PCCT.ULT_CODE,
        PCCT.URG_ORDER_FLAG,
        PCCT.MSC_LINE_NO,
        PCCT.TENANT_ID,
        PCCT.ATTRIBUTE1,
        PCCT.ATTRIBUTE2,
        PCCT.ATTRIBUTE3,
        PCCT.ATTRIBUTE4,
        PCCT.ATTRIBUTE5,
        PCCT.UT_CHECK_CODE,
        PCCT.UT_PD_CODE,
        PCCT.creation_date,        PCCT.created_by,        PCCT.last_updated_by,        PCCT.last_update_date,        PCCT.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmCmdContTra">
        select
        <include refid = "BaseSql"/>
        from PM_CMD_CONT_TRA PCCT
        <where>
            <if test="traId !=null">
                and PCCT.TRA_ID = #{traId,jdbcType = INTEGER}
            </if>
            <if test="operationType !=null">
                and PCCT.OPERATION_TYPE = #{operationType,jdbcType = VARCHAR}
            </if>
            <if test="operationUser !=null">
                and PCCT.OPERATION_USER = #{operationUser,jdbcType = VARCHAR}
            </if>
            <if test="operationTime !=null">
                and PCCT.OPERATION_TIME = #{operationTime,jdbcType = OTHER}
            </if>
            <if test="pmCmdContId !=null">
                and PCCT.PM_CMD_CONT_ID = #{pmCmdContId,jdbcType = INTEGER}
            </if>
            <if test="ponoSlabNo !=null">
                and PCCT.PONO_SLAB_NO = #{ponoSlabNo,jdbcType = VARCHAR}
            </if>
            <if test="tmpSlabNo !=null">
                and PCCT.TMP_SLAB_NO = #{tmpSlabNo,jdbcType = VARCHAR}
            </if>
            <if test="orderNo !=null">
                and PCCT.ORDER_NO = #{orderNo,jdbcType = VARCHAR}
            </if>
            <if test="orderSeqNo !=null">
                and PCCT.ORDER_SEQ_NO = #{orderSeqNo,jdbcType = INTEGER}
            </if>
            <if test="axisFlag !=null">
                and PCCT.AXIS_FLAG = #{axisFlag,jdbcType = INTEGER}
            </if>
            <if test="wholeBacklogNo !=null">
                and PCCT.WHOLE_BACKLOG_NO = #{wholeBacklogNo,jdbcType = INTEGER}
            </if>
            <if test="wholeBacklog !=null">
                and PCCT.WHOLE_BACKLOG = #{wholeBacklog,jdbcType = VARCHAR}
            </if>
            <if test="pdBacklogSeq !=null">
                and PCCT.PD_BACKLOG_SEQ = #{pdBacklogSeq,jdbcType = INTEGER}
            </if>
            <if test="pdBacklogCode !=null">
                and PCCT.PD_BACKLOG_CODE = #{pdBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="plateNo !=null">
                and PCCT.PLATE_NO = #{plateNo,jdbcType = VARCHAR}
            </if>
            <if test="slabNo !=null">
                and PCCT.SLAB_NO = #{slabNo,jdbcType = VARCHAR}
            </if>
            <if test="matDesignKind !=null">
                and PCCT.MAT_DESIGN_KIND = #{matDesignKind,jdbcType = VARCHAR}
            </if>
            <if test="orderTypeCode !=null">
                and PCCT.ORDER_TYPE_CODE = #{orderTypeCode,jdbcType = VARCHAR}
            </if>
            <if test="exportFlag !=null">
                and PCCT.EXPORT_FLAG = #{exportFlag,jdbcType = VARCHAR}
            </if>
            <if test="twoRollInterimFlag !=null">
                and PCCT.TWO_ROLL_INTERIM_FLAG = #{twoRollInterimFlag,jdbcType = VARCHAR}
            </if>
            <if test="finCustCode !=null">
                and PCCT.FIN_CUST_CODE = #{finCustCode,jdbcType = VARCHAR}
            </if>
            <if test="psc !=null">
                and PCCT.PSC = #{psc,jdbcType = VARCHAR}
            </if>
            <if test="apn !=null">
                and PCCT.APN = #{apn,jdbcType = VARCHAR}
            </if>
            <if test="msc !=null">
                and PCCT.MSC = #{msc,jdbcType = VARCHAR}
            </if>
            <if test="prodCodeHp !=null">
                and PCCT.PROD_CODE_HP = #{prodCodeHp,jdbcType = VARCHAR}
            </if>
            <if test="sgStd !=null">
                and PCCT.SG_STD = #{sgStd,jdbcType = VARCHAR}
            </if>
            <if test="sgSign !=null">
                and PCCT.SG_SIGN = #{sgSign,jdbcType = VARCHAR}
            </if>
            <if test="stNo !=null">
                and PCCT.ST_NO = #{stNo,jdbcType = VARCHAR}
            </if>
            <if test="uoeFlag !=null">
                and PCCT.UOE_FLAG = #{uoeFlag,jdbcType = VARCHAR}
            </if>
            <if test="shpCode !=null">
                and PCCT.SHP_CODE = #{shpCode,jdbcType = VARCHAR}
            </if>
            <if test="smallPlateNum !=null">
                and PCCT.SMALL_PLATE_NUM = #{smallPlateNum,jdbcType = INTEGER}
            </if>
            <if test="rollMode !=null">
                and PCCT.ROLL_MODE = #{rollMode,jdbcType = VARCHAR}
            </if>
            <if test="prodSrMark !=null">
                and PCCT.PROD_SR_MARK = #{prodSrMark,jdbcType = VARCHAR}
            </if>
            <if test="prodSideMark !=null">
                and PCCT.PROD_SIDE_MARK = #{prodSideMark,jdbcType = VARCHAR}
            </if>
            <if test="prodShotMark !=null">
                and PCCT.PROD_SHOT_MARK = #{prodShotMark,jdbcType = VARCHAR}
            </if>
            <if test="prodNMark !=null">
                and PCCT.PROD_N_MARK = #{prodNMark,jdbcType = VARCHAR}
            </if>
            <if test="prodQMark !=null">
                and PCCT.PROD_Q_MARK = #{prodQMark,jdbcType = VARCHAR}
            </if>
            <if test="prodTMark !=null">
                and PCCT.PROD_T_MARK = #{prodTMark,jdbcType = VARCHAR}
            </if>
            <if test="prodAMark !=null">
                and PCCT.PROD_A_MARK = #{prodAMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogUtMark !=null">
                and PCCT.BACKLOG_UT_MARK = #{backlogUtMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogNMark !=null">
                and PCCT.BACKLOG_N_MARK = #{backlogNMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogQMark !=null">
                and PCCT.BACKLOG_Q_MARK = #{backlogQMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogTMark !=null">
                and PCCT.BACKLOG_T_MARK = #{backlogTMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogAMark !=null">
                and PCCT.BACKLOG_A_MARK = #{backlogAMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogDemagMark !=null">
                and PCCT.BACKLOG_DEMAG_MARK = #{backlogDemagMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogPtMark !=null">
                and PCCT.BACKLOG_PT_MARK = #{backlogPtMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogMtMark !=null">
                and PCCT.BACKLOG_MT_MARK = #{backlogMtMark,jdbcType = VARCHAR}
            </if>
            <if test="backlogTmcpMark !=null">
                and PCCT.BACKLOG_TMCP_MARK = #{backlogTmcpMark,jdbcType = VARCHAR}
            </if>
            <if test="unitWtMax !=null">
                and PCCT.UNIT_WT_MAX = #{unitWtMax,jdbcType = INTEGER}
            </if>
            <if test="unitWtMin !=null">
                and PCCT.UNIT_WT_MIN = #{unitWtMin,jdbcType = INTEGER}
            </if>
            <if test="unitWtAim !=null">
                and PCCT.UNIT_WT_AIM = #{unitWtAim,jdbcType = INTEGER}
            </if>
            <if test="orderThick !=null">
                and PCCT.ORDER_THICK = #{orderThick,jdbcType = INTEGER}
            </if>
            <if test="orderWidth !=null">
                and PCCT.ORDER_WIDTH = #{orderWidth,jdbcType = INTEGER}
            </if>
            <if test="orderLen !=null">
                and PCCT.ORDER_LEN = #{orderLen,jdbcType = INTEGER}
            </if>
            <if test="widthDiv !=null">
                and PCCT.WIDTH_DIV = #{widthDiv,jdbcType = VARCHAR}
            </if>
            <if test="widthMax !=null">
                and PCCT.WIDTH_MAX = #{widthMax,jdbcType = INTEGER}
            </if>
            <if test="widthMin !=null">
                and PCCT.WIDTH_MIN = #{widthMin,jdbcType = INTEGER}
            </if>
            <if test="lenDiv !=null">
                and PCCT.LEN_DIV = #{lenDiv,jdbcType = VARCHAR}
            </if>
            <if test="orderLenMin !=null">
                and PCCT.ORDER_LEN_MIN = #{orderLenMin,jdbcType = INTEGER}
            </if>
            <if test="orderLenMax !=null">
                and PCCT.ORDER_LEN_MAX = #{orderLenMax,jdbcType = INTEGER}
            </if>
            <if test="smallPlateThick !=null">
                and PCCT.SMALL_PLATE_THICK = #{smallPlateThick,jdbcType = INTEGER}
            </if>
            <if test="smallPlateWidth !=null">
                and PCCT.SMALL_PLATE_WIDTH = #{smallPlateWidth,jdbcType = INTEGER}
            </if>
            <if test="smallPlateLen !=null">
                and PCCT.SMALL_PLATE_LEN = #{smallPlateLen,jdbcType = INTEGER}
            </if>
            <if test="thick1 !=null">
                and PCCT.THICK1 = #{thick1,jdbcType = INTEGER}
            </if>
            <if test="thick2 !=null">
                and PCCT.THICK2 = #{thick2,jdbcType = INTEGER}
            </if>
            <if test="thick3 !=null">
                and PCCT.THICK3 = #{thick3,jdbcType = INTEGER}
            </if>
            <if test="len1 !=null">
                and PCCT.LEN1 = #{len1,jdbcType = INTEGER}
            </if>
            <if test="len2 !=null">
                and PCCT.LEN2 = #{len2,jdbcType = INTEGER}
            </if>
            <if test="len3 !=null">
                and PCCT.LEN3 = #{len3,jdbcType = INTEGER}
            </if>
            <if test="len4 !=null">
                and PCCT.LEN4 = #{len4,jdbcType = INTEGER}
            </if>
            <if test="len5 !=null">
                and PCCT.LEN5 = #{len5,jdbcType = INTEGER}
            </if>
            <if test="thickTol1Max !=null">
                and PCCT.THICK_TOL1_MAX = #{thickTol1Max,jdbcType = INTEGER}
            </if>
            <if test="thickTol1Min !=null">
                and PCCT.THICK_TOL1_MIN = #{thickTol1Min,jdbcType = INTEGER}
            </if>
            <if test="thickTol2Max !=null">
                and PCCT.THICK_TOL2_MAX = #{thickTol2Max,jdbcType = INTEGER}
            </if>
            <if test="thickTol2Min !=null">
                and PCCT.THICK_TOL2_MIN = #{thickTol2Min,jdbcType = INTEGER}
            </if>
            <if test="thickTol3Max !=null">
                and PCCT.THICK_TOL3_MAX = #{thickTol3Max,jdbcType = INTEGER}
            </if>
            <if test="thickTol3Min !=null">
                and PCCT.THICK_TOL3_MIN = #{thickTol3Min,jdbcType = INTEGER}
            </if>
            <if test="platePreProc1 !=null">
                and PCCT.PLATE_PRE_PROC1 = #{platePreProc1,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc2 !=null">
                and PCCT.PLATE_PRE_PROC2 = #{platePreProc2,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc3 !=null">
                and PCCT.PLATE_PRE_PROC3 = #{platePreProc3,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc4 !=null">
                and PCCT.PLATE_PRE_PROC4 = #{platePreProc4,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc5 !=null">
                and PCCT.PLATE_PRE_PROC5 = #{platePreProc5,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc6 !=null">
                and PCCT.PLATE_PRE_PROC6 = #{platePreProc6,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc7 !=null">
                and PCCT.PLATE_PRE_PROC7 = #{platePreProc7,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc8 !=null">
                and PCCT.PLATE_PRE_PROC8 = #{platePreProc8,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc9 !=null">
                and PCCT.PLATE_PRE_PROC9 = #{platePreProc9,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc10 !=null">
                and PCCT.PLATE_PRE_PROC10 = #{platePreProc10,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc11 !=null">
                and PCCT.PLATE_PRE_PROC11 = #{platePreProc11,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc12 !=null">
                and PCCT.PLATE_PRE_PROC12 = #{platePreProc12,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc13 !=null">
                and PCCT.PLATE_PRE_PROC13 = #{platePreProc13,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc14 !=null">
                and PCCT.PLATE_PRE_PROC14 = #{platePreProc14,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc15 !=null">
                and PCCT.PLATE_PRE_PROC15 = #{platePreProc15,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc16 !=null">
                and PCCT.PLATE_PRE_PROC16 = #{platePreProc16,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc17 !=null">
                and PCCT.PLATE_PRE_PROC17 = #{platePreProc17,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc18 !=null">
                and PCCT.PLATE_PRE_PROC18 = #{platePreProc18,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc19 !=null">
                and PCCT.PLATE_PRE_PROC19 = #{platePreProc19,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc20 !=null">
                and PCCT.PLATE_PRE_PROC20 = #{platePreProc20,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc21 !=null">
                and PCCT.PLATE_PRE_PROC21 = #{platePreProc21,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc22 !=null">
                and PCCT.PLATE_PRE_PROC22 = #{platePreProc22,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc23 !=null">
                and PCCT.PLATE_PRE_PROC23 = #{platePreProc23,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc24 !=null">
                and PCCT.PLATE_PRE_PROC24 = #{platePreProc24,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc25 !=null">
                and PCCT.PLATE_PRE_PROC25 = #{platePreProc25,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc26 !=null">
                and PCCT.PLATE_PRE_PROC26 = #{platePreProc26,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc27 !=null">
                and PCCT.PLATE_PRE_PROC27 = #{platePreProc27,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc28 !=null">
                and PCCT.PLATE_PRE_PROC28 = #{platePreProc28,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc29 !=null">
                and PCCT.PLATE_PRE_PROC29 = #{platePreProc29,jdbcType = VARCHAR}
            </if>
            <if test="platePreProc30 !=null">
                and PCCT.PLATE_PRE_PROC30 = #{platePreProc30,jdbcType = VARCHAR}
            </if>
            <if test="trimCode !=null">
                and PCCT.TRIM_CODE = #{trimCode,jdbcType = VARCHAR}
            </if>
            <if test="widenMin !=null">
                and PCCT.WIDEN_MIN = #{widenMin,jdbcType = INTEGER}
            </if>
            <if test="compressMin !=null">
                and PCCT.COMPRESS_MIN = #{compressMin,jdbcType = INTEGER}
            </if>
            <if test="rollDirectCode !=null">
                and PCCT.ROLL_DIRECT_CODE = #{rollDirectCode,jdbcType = VARCHAR}
            </if>
            <if test="ctrlRollCode !=null">
                and PCCT.CTRL_ROLL_CODE = #{ctrlRollCode,jdbcType = VARCHAR}
            </if>
            <if test="adTypeCode !=null">
                and PCCT.AD_TYPE_CODE = #{adTypeCode,jdbcType = VARCHAR}
            </if>
            <if test="adModeCode !=null">
                and PCCT.AD_MODE_CODE = #{adModeCode,jdbcType = VARCHAR}
            </if>
            <if test="hotRectifyFlag !=null">
                and PCCT.HOT_RECTIFY_FLAG = #{hotRectifyFlag,jdbcType = VARCHAR}
            </if>
            <if test="coldRectifyFlag !=null">
                and PCCT.COLD_RECTIFY_FLAG = #{coldRectifyFlag,jdbcType = VARCHAR}
            </if>
            <if test="warmRectifyFlag !=null">
                and PCCT.WARM_RECTIFY_FLAG = #{warmRectifyFlag,jdbcType = VARCHAR}
            </if>
            <if test="warmPressFlag !=null">
                and PCCT.WARM_PRESS_FLAG = #{warmPressFlag,jdbcType = VARCHAR}
            </if>
            <if test="canPressFlag !=null">
                and PCCT.CAN_PRESS_FLAG = #{canPressFlag,jdbcType = VARCHAR}
            </if>
            <if test="wpTempMin !=null">
                and PCCT.WP_TEMP_MIN = #{wpTempMin,jdbcType = INTEGER}
            </if>
            <if test="headCut !=null">
                and PCCT.HEAD_CUT = #{headCut,jdbcType = INTEGER}
            </if>
            <if test="tailCut !=null">
                and PCCT.TAIL_CUT = #{tailCut,jdbcType = INTEGER}
            </if>
            <if test="hardAim !=null">
                and PCCT.HARD_AIM = #{hardAim,jdbcType = INTEGER}
            </if>
            <if test="cutModeCode !=null">
                and PCCT.CUT_MODE_CODE = #{cutModeCode,jdbcType = VARCHAR}
            </if>
            <if test="gFlag !=null">
                and PCCT.G_FLAG = #{gFlag,jdbcType = VARCHAR}
            </if>
            <if test="csFlag !=null">
                and PCCT.CS_FLAG = #{csFlag,jdbcType = VARCHAR}
            </if>
            <if test="dssFlag !=null">
                and PCCT.DSS_FLAG = #{dssFlag,jdbcType = VARCHAR}
            </if>
            <if test="ssFlag !=null">
                and PCCT.SS_FLAG = #{ssFlag,jdbcType = VARCHAR}
            </if>
            <if test="dsFlag !=null">
                and PCCT.DS_FLAG = #{dsFlag,jdbcType = VARCHAR}
            </if>
            <if test="heatTreatMode !=null">
                and PCCT.HEAT_TREAT_MODE = #{heatTreatMode,jdbcType = VARCHAR}
            </if>
            <if test="keepTempMax1 !=null">
                and PCCT.KEEP_TEMP_MAX1 = #{keepTempMax1,jdbcType = INTEGER}
            </if>
            <if test="keepTempMin1 !=null">
                and PCCT.KEEP_TEMP_MIN1 = #{keepTempMin1,jdbcType = INTEGER}
            </if>
            <if test="keepTempMax2 !=null">
                and PCCT.KEEP_TEMP_MAX2 = #{keepTempMax2,jdbcType = INTEGER}
            </if>
            <if test="keepTempMin2 !=null">
                and PCCT.KEEP_TEMP_MIN2 = #{keepTempMin2,jdbcType = INTEGER}
            </if>
            <if test="keepTempMax3 !=null">
                and PCCT.KEEP_TEMP_MAX3 = #{keepTempMax3,jdbcType = INTEGER}
            </if>
            <if test="keepTempMin3 !=null">
                and PCCT.KEEP_TEMP_MIN3 = #{keepTempMin3,jdbcType = INTEGER}
            </if>
            <if test="keepTempMax4 !=null">
                and PCCT.KEEP_TEMP_MAX4 = #{keepTempMax4,jdbcType = INTEGER}
            </if>
            <if test="keepTempMin4 !=null">
                and PCCT.KEEP_TEMP_MIN4 = #{keepTempMin4,jdbcType = INTEGER}
            </if>
            <if test="keepTempMax5 !=null">
                and PCCT.KEEP_TEMP_MAX5 = #{keepTempMax5,jdbcType = INTEGER}
            </if>
            <if test="keepTempMin5 !=null">
                and PCCT.KEEP_TEMP_MIN5 = #{keepTempMin5,jdbcType = INTEGER}
            </if>
            <if test="keepTempMax6 !=null">
                and PCCT.KEEP_TEMP_MAX6 = #{keepTempMax6,jdbcType = INTEGER}
            </if>
            <if test="keepTempMin6 !=null">
                and PCCT.KEEP_TEMP_MIN6 = #{keepTempMin6,jdbcType = INTEGER}
            </if>
            <if test="backfireMax1 !=null">
                and PCCT.BACKFIRE_MAX1 = #{backfireMax1,jdbcType = INTEGER}
            </if>
            <if test="backfireMin1 !=null">
                and PCCT.BACKFIRE_MIN1 = #{backfireMin1,jdbcType = INTEGER}
            </if>
            <if test="backfireMax2 !=null">
                and PCCT.BACKFIRE_MAX2 = #{backfireMax2,jdbcType = INTEGER}
            </if>
            <if test="backfireMin2 !=null">
                and PCCT.BACKFIRE_MIN2 = #{backfireMin2,jdbcType = INTEGER}
            </if>
            <if test="backfireMax3 !=null">
                and PCCT.BACKFIRE_MAX3 = #{backfireMax3,jdbcType = INTEGER}
            </if>
            <if test="backfireMin3 !=null">
                and PCCT.BACKFIRE_MIN3 = #{backfireMin3,jdbcType = INTEGER}
            </if>
            <if test="backfireMax4 !=null">
                and PCCT.BACKFIRE_MAX4 = #{backfireMax4,jdbcType = INTEGER}
            </if>
            <if test="backfireMin4 !=null">
                and PCCT.BACKFIRE_MIN4 = #{backfireMin4,jdbcType = INTEGER}
            </if>
            <if test="backfireMax5 !=null">
                and PCCT.BACKFIRE_MAX5 = #{backfireMax5,jdbcType = INTEGER}
            </if>
            <if test="backfireMin5 !=null">
                and PCCT.BACKFIRE_MIN5 = #{backfireMin5,jdbcType = INTEGER}
            </if>
            <if test="backfireMax6 !=null">
                and PCCT.BACKFIRE_MAX6 = #{backfireMax6,jdbcType = INTEGER}
            </if>
            <if test="backfireMin6 !=null">
                and PCCT.BACKFIRE_MIN6 = #{backfireMin6,jdbcType = INTEGER}
            </if>
            <if test="widthBeforeQn !=null">
                and PCCT.WIDTH_BEFORE_QN = #{widthBeforeQn,jdbcType = INTEGER}
            </if>
            <if test="lenBeforeQn !=null">
                and PCCT.LEN_BEFORE_QN = #{lenBeforeQn,jdbcType = INTEGER}
            </if>
            <if test="cropTypeHp !=null">
                and PCCT.CROP_TYPE_HP = #{cropTypeHp,jdbcType = VARCHAR}
            </if>
            <if test="betterSurfWardCode !=null">
                and PCCT.BETTER_SURF_WARD_CODE = #{betterSurfWardCode,jdbcType = VARCHAR}
            </if>
            <if test="ultDetectMethodCode !=null">
                and PCCT.ULT_DETECT_METHOD_CODE = #{ultDetectMethodCode,jdbcType = VARCHAR}
            </if>
            <if test="ultCode !=null">
                and PCCT.ULT_CODE = #{ultCode,jdbcType = VARCHAR}
            </if>
            <if test="urgOrderFlag !=null">
                and PCCT.URG_ORDER_FLAG = #{urgOrderFlag,jdbcType = VARCHAR}
            </if>
            <if test="mscLineNo !=null">
                and PCCT.MSC_LINE_NO = #{mscLineNo,jdbcType = VARCHAR}
            </if>
            <if test="tenantId !=null">
                and PCCT.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PCCT.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PCCT.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PCCT.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PCCT.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PCCT.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>

    <select id="selectByPonoSlabList" resultType="com.xisc.pm.domain.entity.PmCmdContTra">
        select
        <include refid="BaseSql"/>
        from (
        select
        <include refid="BaseSql"/>,
        ROW_NUMBER() OVER (PARTITION BY PCCT.PONO_SLAB_NO ORDER BY PCCT.creation_date DESC) as rn
        from PM_CMD_CONT_TRA PCCT
        <where>
            <if test="ponoSlabList != null and ponoSlabList.size() > 0">
                and PCCT.PONO_SLAB_NO in
                <foreach collection="ponoSlabList" item="ponoSlab" index="index" open="(" close=")" separator=",">
                    #{ponoSlab}
                </foreach>
            </if>
            <if test="tenantId != null">
                and PCCT.TENANT_ID = #{tenantId}
            </if>
        </where>
        ) PCCT
        where PCCT.rn = 1
    </select>
</mapper>

