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


    <sql id = "BaseSql">
    MS.SLAB_ID,
    MS.SLAB_NO,
    MS.ORDER_NO,
    MS.FIRST_ORDER_NO,
    MS.PONO,
    MS.SLAB_TYPE,
    MS.OLD_ORDER_NO,
    MS.MSC_LINE_NO,
    MS.REC_STS,
    MS.PROC_CD,
    MS.BEF_PROC_CD,
    MS.PROD_YEAR,
    MS.LOADING_TIME,
    MS.ORIGIN_SLAB_NO,
    MS.PLAN_NO,
    MS.ROLL_PLAN_NO,
    MS.PSC,
    MS.APN,
    MS.MSC,
    MS.PLATE_DT_CODE,
    MS.PROD_CODE_HP,
    MS.SLAB_ORIGIN_CODE,
    MS.SLAB_STATUS,
    MS.STD_SG_CODE,
    MS.SG_SIGN,
    MS.SG_STD,
    MS.OLD_STD_SG_CODE,
    MS.OLD_SG_STD,
    MS.OLD_SG_SIGN,
    MS.ST_NO,
    MS.OLD_PLATE_NO,
    MS.OLD_SLAB_NO,
    MS.AC_UNIT_CODE,
    MS.UNIT_CODE,
    MS.PRE_UNIT_CODE,
    MS.HOT_DEST1,
    MS.HOT_DEST2,
    MS.HOT_DEST3,
    MS.HOT_DEST4,
    MS.HOT_DEST5,
    MS.HOT_DEST,
    MS.SLAB_TARG_THK,
    MS.SLAB_TARG_WID,
    MS.SLAB_TARG_LEN,
    MS.SLAB_ACT_THK,
    MS.SLAB_ACT_WID,
    MS.SLAB_ACT_LEN,
    MS.SLAB_ACT_WGT,
    MS.SLAB_GROSS_WGT,
    MS.WGT_MODE,
    MS.PROD_TIME,
    MS.WHOLE_BACKLOG,
    MS.WHOLE_BACKLOG_SEQ,
    MS.WHOLE_BACKLOG_CODE,
    MS.NEXT_WHOLE_BACKLOG_SEQ,
    MS.NEXT_WHOLE_BACKLOG_CODE,
    MS.OUTTRUST_FLAG,
    MS.HOLD_FLAG,
    MS.HOLD_CAUSE_CODE,
    MS.HOLD_TIME,
    MS.HOLD_SHIFT_NO,
    MS.HOLD_MAKER,
    MS.REL_TIME,
    MS.REL_MAKER,
    MS.REMAIN_CAUSE_CODE,
    MS.REMAIN_DECIDE_TIME,
    MS.REMAIN_DECIDE_MAKER,
    MS.REMAIN_DECIDE_CODE,
    MS.SCRAP_CAUSE_CODE,
    MS.SCRAP_MAKER,
    MS.SCRAP_TIME,
    MS.SURFACE_DECIDE_CODE,
    MS.CONFM_FLAG,
    MS.SURFACE_DECIDE_TIME,
    MS.SURFACE_DECIDE_MAKER,
    MS.PCH_JUDGE_CODE,
    MS.PCH_JUDGE_RESULT,
    MS.PCH_JUDGE_ABN,
    MS.PCH_JUDGE_TIME,
    MS.PCH_JUDGE_MAKER,
    MS.COMPLEX_DECIDE_CODE,
    MS.COMPLEX_DECIDE_TIME,
    MS.COMPLEX_DECIDE_MAKER,
    MS.OLD_COMPLEX_DECIDE_CODE,
    MS.OLD_COMPLEX_DECIDE_TIME,
    MS.OLD_COMPLEX_DECIDE_MAKER,
    MS.PRE_ST_NO,
    MS.HEAT_NO,
    MS.SLAB_DEST,
    MS.HOT_CHARGE_FLAG,
    MS.SAMPLE_MART_NO,
    MS.PONO_SLAB,
    MS.FIX_SLAB_NUM,
    MS.ABNR_CODE1,
    MS.ABNR_CODE2,
    MS.ABNR_CODE3,
    MS.ABNR_CODE4,
    MS.ABNR_CODE5,
    MS.ABNR_CODE6,
    MS.ABNR_CODE7,
    MS.ABNR_CODE8,
    MS.ABNR_CODE9,
    MS.ABNR_CODE10,
    MS.SLABTOP_FLAG,
    MS.SLABTOP_TIME,
    MS.SLAB_FLAG,
    MS.SECUT_PLAN_NO,
    MS.BIG_BACKLOG_CODE,
    MS.SUB_BACKLOG_CODE,
    MS.SUB_BACKLOG_SEQ,
    MS.NEXT_SUB_BACKLOG_CODE,
    MS.NEXT_SUB_BACKLOG_SEQ,
    MS.BD_FLAG,
    MS.SLAB_RETURN_TIME,
    MS.SLAB_RETURN_CODE,
    MS.SLAB_RETURN_CAUSE_CODE,
    MS.SMP_GROUP,
    MS.REMARK,
    MS.SPARE_FIELD1,
    MS.SPARE_FIELD2,
    MS.SPARE_FIELD3,
    MS.SPARE_FIELD4,
    MS.SPARE_FIELD5,
    MS.SPARE_FIELD6,
    MS.SPARE_FIELD7,
    MS.SPARE_FIELD8,
    MS.SPARE_FIELD9,
    MS.SPARE_FIELD10,
    MS.TENANT_ID,
    MS.TRANFER_FLAG,
    MS.creation_date,    MS.created_by,    MS.last_updated_by,    MS.last_update_date,    MS.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.MmSlab">
        select
        <include refid = "BaseSql"/>
        from MM_SLAB MS
        <where>
            <if test="slabId !=null">
                and MS.SLAB_ID = #{slabId,jdbcType = INTEGER}
            </if>
            <if test="slabNo !=null">
                and MS.SLAB_NO = #{slabNo,jdbcType = VARCHAR}
            </if>
            <if test="orderNo !=null">
                and MS.ORDER_NO = #{orderNo,jdbcType = VARCHAR}
            </if>
            <if test="firstOrderNo !=null">
                and MS.FIRST_ORDER_NO = #{firstOrderNo,jdbcType = VARCHAR}
            </if>
            <if test="pono !=null">
                and MS.PONO = #{pono,jdbcType = VARCHAR}
            </if>
            <if test="slabType !=null">
                and MS.SLAB_TYPE = #{slabType,jdbcType = VARCHAR}
            </if>
            <if test="oldOrderNo !=null">
                and MS.OLD_ORDER_NO = #{oldOrderNo,jdbcType = VARCHAR}
            </if>
            <if test="mscLineNo !=null">
                and MS.MSC_LINE_NO = #{mscLineNo,jdbcType = VARCHAR}
            </if>
            <if test="recSts !=null">
                and MS.REC_STS = #{recSts,jdbcType = VARCHAR}
            </if>
            <if test="procCd !=null">
                and MS.PROC_CD = #{procCd,jdbcType = VARCHAR}
            </if>
            <if test="befProcCd !=null">
                and MS.BEF_PROC_CD = #{befProcCd,jdbcType = VARCHAR}
            </if>
            <if test="prodYear !=null">
                and MS.PROD_YEAR = #{prodYear,jdbcType = VARCHAR}
            </if>
            <if test="loadingTime !=null">
                and MS.LOADING_TIME = #{loadingTime,jdbcType = OTHER}
            </if>
            <if test="originSlabNo !=null">
                and MS.ORIGIN_SLAB_NO = #{originSlabNo,jdbcType = VARCHAR}
            </if>
            <if test="planNo !=null">
                and MS.PLAN_NO = #{planNo,jdbcType = VARCHAR}
            </if>
            <if test="rollPlanNo !=null">
                and MS.ROLL_PLAN_NO = #{rollPlanNo,jdbcType = VARCHAR}
            </if>
            <if test="psc !=null">
                and MS.PSC = #{psc,jdbcType = VARCHAR}
            </if>
            <if test="apn !=null">
                and MS.APN = #{apn,jdbcType = VARCHAR}
            </if>
            <if test="msc !=null">
                and MS.MSC = #{msc,jdbcType = VARCHAR}
            </if>
            <if test="plateDtCode !=null">
                and MS.PLATE_DT_CODE = #{plateDtCode,jdbcType = VARCHAR}
            </if>
            <if test="prodCodeHp !=null">
                and MS.PROD_CODE_HP = #{prodCodeHp,jdbcType = VARCHAR}
            </if>
            <if test="slabOriginCode !=null">
                and MS.SLAB_ORIGIN_CODE = #{slabOriginCode,jdbcType = VARCHAR}
            </if>
            <if test="slabStatus !=null">
                and MS.SLAB_STATUS = #{slabStatus,jdbcType = VARCHAR}
            </if>
            <if test="stdSgCode !=null">
                and MS.STD_SG_CODE = #{stdSgCode,jdbcType = VARCHAR}
            </if>
            <if test="sgSign !=null">
                and MS.SG_SIGN = #{sgSign,jdbcType = VARCHAR}
            </if>
            <if test="sgStd !=null">
                and MS.SG_STD = #{sgStd,jdbcType = VARCHAR}
            </if>
            <if test="oldStdSgCode !=null">
                and MS.OLD_STD_SG_CODE = #{oldStdSgCode,jdbcType = VARCHAR}
            </if>
            <if test="oldSgStd !=null">
                and MS.OLD_SG_STD = #{oldSgStd,jdbcType = VARCHAR}
            </if>
            <if test="oldSgSign !=null">
                and MS.OLD_SG_SIGN = #{oldSgSign,jdbcType = VARCHAR}
            </if>
            <if test="stNo !=null">
                and MS.ST_NO = #{stNo,jdbcType = VARCHAR}
            </if>
            <if test="oldPlateNo !=null">
                and MS.OLD_PLATE_NO = #{oldPlateNo,jdbcType = VARCHAR}
            </if>
            <if test="oldSlabNo !=null">
                and MS.OLD_SLAB_NO = #{oldSlabNo,jdbcType = VARCHAR}
            </if>
            <if test="acUnitCode !=null">
                and MS.AC_UNIT_CODE = #{acUnitCode,jdbcType = VARCHAR}
            </if>
            <if test="unitCode !=null">
                and MS.UNIT_CODE = #{unitCode,jdbcType = VARCHAR}
            </if>
            <if test="preUnitCode !=null">
                and MS.PRE_UNIT_CODE = #{preUnitCode,jdbcType = VARCHAR}
            </if>
            <if test="hotDest1 !=null">
                and MS.HOT_DEST1 = #{hotDest1,jdbcType = VARCHAR}
            </if>
            <if test="hotDest2 !=null">
                and MS.HOT_DEST2 = #{hotDest2,jdbcType = VARCHAR}
            </if>
            <if test="hotDest3 !=null">
                and MS.HOT_DEST3 = #{hotDest3,jdbcType = VARCHAR}
            </if>
            <if test="hotDest4 !=null">
                and MS.HOT_DEST4 = #{hotDest4,jdbcType = VARCHAR}
            </if>
            <if test="hotDest5 !=null">
                and MS.HOT_DEST5 = #{hotDest5,jdbcType = VARCHAR}
            </if>
            <if test="hotDest !=null">
                and MS.HOT_DEST = #{hotDest,jdbcType = VARCHAR}
            </if>
            <if test="slabTargThk !=null">
                and MS.SLAB_TARG_THK = #{slabTargThk,jdbcType = INTEGER}
            </if>
            <if test="slabTargWid !=null">
                and MS.SLAB_TARG_WID = #{slabTargWid,jdbcType = INTEGER}
            </if>
            <if test="slabTargLen !=null">
                and MS.SLAB_TARG_LEN = #{slabTargLen,jdbcType = INTEGER}
            </if>
            <if test="slabActThk !=null">
                and MS.SLAB_ACT_THK = #{slabActThk,jdbcType = INTEGER}
            </if>
            <if test="slabActWid !=null">
                and MS.SLAB_ACT_WID = #{slabActWid,jdbcType = INTEGER}
            </if>
            <if test="slabActLen !=null">
                and MS.SLAB_ACT_LEN = #{slabActLen,jdbcType = INTEGER}
            </if>
            <if test="slabActWgt !=null">
                and MS.SLAB_ACT_WGT = #{slabActWgt,jdbcType = INTEGER}
            </if>
            <if test="slabGrossWgt !=null">
                and MS.SLAB_GROSS_WGT = #{slabGrossWgt,jdbcType = INTEGER}
            </if>
            <if test="wgtMode !=null">
                and MS.WGT_MODE = #{wgtMode,jdbcType = VARCHAR}
            </if>
            <if test="prodTime !=null">
                and MS.PROD_TIME = #{prodTime,jdbcType = OTHER}
            </if>
            <if test="wholeBacklog !=null">
                and MS.WHOLE_BACKLOG = #{wholeBacklog,jdbcType = VARCHAR}
            </if>
            <if test="wholeBacklogSeq !=null">
                and MS.WHOLE_BACKLOG_SEQ = #{wholeBacklogSeq,jdbcType = INTEGER}
            </if>
            <if test="wholeBacklogCode !=null">
                and MS.WHOLE_BACKLOG_CODE = #{wholeBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="nextWholeBacklogSeq !=null">
                and MS.NEXT_WHOLE_BACKLOG_SEQ = #{nextWholeBacklogSeq,jdbcType = INTEGER}
            </if>
            <if test="nextWholeBacklogCode !=null">
                and MS.NEXT_WHOLE_BACKLOG_CODE = #{nextWholeBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="outtrustFlag !=null">
                and MS.OUTTRUST_FLAG = #{outtrustFlag,jdbcType = VARCHAR}
            </if>
            <if test="holdFlag !=null">
                and MS.HOLD_FLAG = #{holdFlag,jdbcType = VARCHAR}
            </if>
            <if test="holdCauseCode !=null">
                and MS.HOLD_CAUSE_CODE = #{holdCauseCode,jdbcType = VARCHAR}
            </if>
            <if test="holdTime !=null">
                and MS.HOLD_TIME = #{holdTime,jdbcType = OTHER}
            </if>
            <if test="holdShiftNo !=null">
                and MS.HOLD_SHIFT_NO = #{holdShiftNo,jdbcType = VARCHAR}
            </if>
            <if test="holdMaker !=null">
                and MS.HOLD_MAKER = #{holdMaker,jdbcType = VARCHAR}
            </if>
            <if test="relTime !=null">
                and MS.REL_TIME = #{relTime,jdbcType = OTHER}
            </if>
            <if test="relMaker !=null">
                and MS.REL_MAKER = #{relMaker,jdbcType = VARCHAR}
            </if>
            <if test="remainCauseCode !=null">
                and MS.REMAIN_CAUSE_CODE = #{remainCauseCode,jdbcType = VARCHAR}
            </if>
            <if test="remainDecideTime !=null">
                and MS.REMAIN_DECIDE_TIME = #{remainDecideTime,jdbcType = OTHER}
            </if>
            <if test="remainDecideMaker !=null">
                and MS.REMAIN_DECIDE_MAKER = #{remainDecideMaker,jdbcType = VARCHAR}
            </if>
            <if test="remainDecideCode !=null">
                and MS.REMAIN_DECIDE_CODE = #{remainDecideCode,jdbcType = VARCHAR}
            </if>
            <if test="scrapCauseCode !=null">
                and MS.SCRAP_CAUSE_CODE = #{scrapCauseCode,jdbcType = VARCHAR}
            </if>
            <if test="scrapMaker !=null">
                and MS.SCRAP_MAKER = #{scrapMaker,jdbcType = VARCHAR}
            </if>
            <if test="scrapTime !=null">
                and MS.SCRAP_TIME = #{scrapTime,jdbcType = OTHER}
            </if>
            <if test="surfaceDecideCode !=null">
                and MS.SURFACE_DECIDE_CODE = #{surfaceDecideCode,jdbcType = VARCHAR}
            </if>
            <if test="confmFlag !=null">
                and MS.CONFM_FLAG = #{confmFlag,jdbcType = VARCHAR}
            </if>
            <if test="surfaceDecideTime !=null">
                and MS.SURFACE_DECIDE_TIME = #{surfaceDecideTime,jdbcType = OTHER}
            </if>
            <if test="surfaceDecideMaker !=null">
                and MS.SURFACE_DECIDE_MAKER = #{surfaceDecideMaker,jdbcType = VARCHAR}
            </if>
            <if test="pchJudgeCode !=null">
                and MS.PCH_JUDGE_CODE = #{pchJudgeCode,jdbcType = VARCHAR}
            </if>
            <if test="pchJudgeResult !=null">
                and MS.PCH_JUDGE_RESULT = #{pchJudgeResult,jdbcType = VARCHAR}
            </if>
            <if test="pchJudgeAbn !=null">
                and MS.PCH_JUDGE_ABN = #{pchJudgeAbn,jdbcType = VARCHAR}
            </if>
            <if test="pchJudgeTime !=null">
                and MS.PCH_JUDGE_TIME = #{pchJudgeTime,jdbcType = OTHER}
            </if>
            <if test="pchJudgeMaker !=null">
                and MS.PCH_JUDGE_MAKER = #{pchJudgeMaker,jdbcType = VARCHAR}
            </if>
            <if test="complexDecideCode !=null">
                and MS.COMPLEX_DECIDE_CODE = #{complexDecideCode,jdbcType = VARCHAR}
            </if>
            <if test="complexDecideTime !=null">
                and MS.COMPLEX_DECIDE_TIME = #{complexDecideTime,jdbcType = OTHER}
            </if>
            <if test="complexDecideMaker !=null">
                and MS.COMPLEX_DECIDE_MAKER = #{complexDecideMaker,jdbcType = VARCHAR}
            </if>
            <if test="oldComplexDecideCode !=null">
                and MS.OLD_COMPLEX_DECIDE_CODE = #{oldComplexDecideCode,jdbcType = VARCHAR}
            </if>
            <if test="oldComplexDecideTime !=null">
                and MS.OLD_COMPLEX_DECIDE_TIME = #{oldComplexDecideTime,jdbcType = OTHER}
            </if>
            <if test="oldComplexDecideMaker !=null">
                and MS.OLD_COMPLEX_DECIDE_MAKER = #{oldComplexDecideMaker,jdbcType = VARCHAR}
            </if>
            <if test="preStNo !=null">
                and MS.PRE_ST_NO = #{preStNo,jdbcType = VARCHAR}
            </if>
            <if test="heatNo !=null">
                and MS.HEAT_NO = #{heatNo,jdbcType = VARCHAR}
            </if>
            <if test="slabDest !=null">
                and MS.SLAB_DEST = #{slabDest,jdbcType = VARCHAR}
            </if>
            <if test="hotChargeFlag !=null">
                and MS.HOT_CHARGE_FLAG = #{hotChargeFlag,jdbcType = VARCHAR}
            </if>
            <if test="sampleMartNo !=null">
                and MS.SAMPLE_MART_NO = #{sampleMartNo,jdbcType = VARCHAR}
            </if>
            <if test="ponoSlab !=null">
                and MS.PONO_SLAB = #{ponoSlab,jdbcType = VARCHAR}
            </if>
            <if test="fixSlabNum !=null">
                and MS.FIX_SLAB_NUM = #{fixSlabNum,jdbcType = INTEGER}
            </if>
            <if test="abnrCode1 !=null">
                and MS.ABNR_CODE1 = #{abnrCode1,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode2 !=null">
                and MS.ABNR_CODE2 = #{abnrCode2,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode3 !=null">
                and MS.ABNR_CODE3 = #{abnrCode3,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode4 !=null">
                and MS.ABNR_CODE4 = #{abnrCode4,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode5 !=null">
                and MS.ABNR_CODE5 = #{abnrCode5,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode6 !=null">
                and MS.ABNR_CODE6 = #{abnrCode6,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode7 !=null">
                and MS.ABNR_CODE7 = #{abnrCode7,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode8 !=null">
                and MS.ABNR_CODE8 = #{abnrCode8,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode9 !=null">
                and MS.ABNR_CODE9 = #{abnrCode9,jdbcType = VARCHAR}
            </if>
            <if test="abnrCode10 !=null">
                and MS.ABNR_CODE10 = #{abnrCode10,jdbcType = VARCHAR}
            </if>
            <if test="slabtopFlag !=null">
                and MS.SLABTOP_FLAG = #{slabtopFlag,jdbcType = VARCHAR}
            </if>
            <if test="slabtopTime !=null">
                and MS.SLABTOP_TIME = #{slabtopTime,jdbcType = OTHER}
            </if>
            <if test="slabFlag !=null">
                and MS.SLAB_FLAG = #{slabFlag,jdbcType = VARCHAR}
            </if>
            <if test="secutPlanNo !=null">
                and MS.SECUT_PLAN_NO = #{secutPlanNo,jdbcType = VARCHAR}
            </if>
            <if test="bigBacklogCode !=null">
                and MS.BIG_BACKLOG_CODE = #{bigBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="subBacklogCode !=null">
                and MS.SUB_BACKLOG_CODE = #{subBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="subBacklogSeq !=null">
                and MS.SUB_BACKLOG_SEQ = #{subBacklogSeq,jdbcType = INTEGER}
            </if>
            <if test="nextSubBacklogCode !=null">
                and MS.NEXT_SUB_BACKLOG_CODE = #{nextSubBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="nextSubBacklogSeq !=null">
                and MS.NEXT_SUB_BACKLOG_SEQ = #{nextSubBacklogSeq,jdbcType = INTEGER}
            </if>
            <if test="bdFlag !=null">
                and MS.BD_FLAG = #{bdFlag,jdbcType = VARCHAR}
            </if>
            <if test="slabReturnTime !=null">
                and MS.SLAB_RETURN_TIME = #{slabReturnTime,jdbcType = OTHER}
            </if>
            <if test="slabReturnCode !=null">
                and MS.SLAB_RETURN_CODE = #{slabReturnCode,jdbcType = VARCHAR}
            </if>
            <if test="slabReturnCauseCode !=null">
                and MS.SLAB_RETURN_CAUSE_CODE = #{slabReturnCauseCode,jdbcType = VARCHAR}
            </if>
            <if test="smpGroup !=null">
                and MS.SMP_GROUP = #{smpGroup,jdbcType = VARCHAR}
            </if>
            <if test="remark !=null">
                and MS.REMARK = #{remark,jdbcType = VARCHAR}
            </if>
            <if test="spareField1 !=null">
                and MS.SPARE_FIELD1 = #{spareField1,jdbcType = VARCHAR}
            </if>
            <if test="spareField2 !=null">
                and MS.SPARE_FIELD2 = #{spareField2,jdbcType = VARCHAR}
            </if>
            <if test="spareField3 !=null">
                and MS.SPARE_FIELD3 = #{spareField3,jdbcType = VARCHAR}
            </if>
            <if test="spareField4 !=null">
                and MS.SPARE_FIELD4 = #{spareField4,jdbcType = VARCHAR}
            </if>
            <if test="spareField5 !=null">
                and MS.SPARE_FIELD5 = #{spareField5,jdbcType = VARCHAR}
            </if>
            <if test="spareField6 !=null">
                and MS.SPARE_FIELD6 = #{spareField6,jdbcType = INTEGER}
            </if>
            <if test="spareField7 !=null">
                and MS.SPARE_FIELD7 = #{spareField7,jdbcType = INTEGER}
            </if>
            <if test="spareField8 !=null">
                and MS.SPARE_FIELD8 = #{spareField8,jdbcType = INTEGER}
            </if>
            <if test="spareField9 !=null">
                and MS.SPARE_FIELD9 = #{spareField9,jdbcType = INTEGER}
            </if>
            <if test="spareField10 !=null">
                and MS.SPARE_FIELD10 = #{spareField10,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and MS.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="tranferFlag !=null">
                and MS.TRANFER_FLAG = #{tranferFlag,jdbcType = VARCHAR}
            </if>
            <if test="slabStatusList != null and slabStatusList.size() > 0">
            	and MS.SLAB_STATUS in 
            	<foreach collection="slabStatusList" item="status" open="(" close=")" separator=",">
            		#{status}
            	</foreach>
            </if>
        </where>
    </select>

    <select id="surplusSlabList" resultType="com.xisc.pm.domain.entity.MmSlab">
        select
            distinct
        MS.SLAB_ID,
        MS.COMPLEX_DECIDE_CODE,
        MS.SLAB_NO,
        MS.SG_SIGN,
        MS.SLAB_STATUS,
        MS.ORDER_NO,
        MS.ST_NO,
        MS.SLAB_ACT_LEN,
        MS.SLAB_ACT_THK,
        MS.SLAB_ACT_WID,
        MS.SLAB_ACT_WGT,
        MS.FIX_SLAB_NUM,
        MS.WHOLE_BACKLOG,
        MS.MSC_LINE_NO,
        MS.SG_STD,
        MS.OLD_ORDER_NO,
        MS.ORIGIN_SLAB_NO,
        MS.WGT_MODE,
        MS.MSC,
        MS.PSC,
        MS.APN,
        MS.PONO,
        WMP.PILE_NO,
        WMP.LAYER_NO
        from
        MM_SLAB MS
            left join WM_MAT_PILE WMP on MS.SLAB_NO = WMP.MAT_NO
        <where>
            MS.SLAB_STATUS in ('33','39')
            and MS.COMPLEX_DECIDE_CODE in ('1', '2')
            <if test="orderThickMaxValue !=null">
                and MS.SLAB_ACT_THK <![CDATA[ <= ]]>  #{orderThickMaxValue}
            </if>
            <if test="orderThickMinValue !=null">
                and MS.SLAB_ACT_THK <![CDATA[ >= ]]>  #{orderThickMinValue}
            </if>
            <if test="widthMaxValue !=null">
                and MS.SLAB_ACT_WID <![CDATA[ <= ]]>  #{widthMaxValue}
            </if>
            <if test="widthMinValue !=null">
                and MS.SLAB_ACT_WID <![CDATA[ >= ]]> #{widthMinValue}
            </if>
            <if test="orderLenMaxValue !=null">
                and MS.SLAB_ACT_LEN <![CDATA[ <= ]]> #{orderLenMaxValue}
            </if>
            <if test="orderLenMinValue !=null">
                and MS.SLAB_ACT_LEN <![CDATA[ >= ]]> #{orderLenMinValue}
            </if>
            <if test="slabNo !=null">
                and MS.SLAB_NO = #{slabNo,jdbcType = VARCHAR}
            </if>
            <if test="complexDecideCode !=null">
                and MS.COMPLEX_DECIDE_CODE = #{complexDecideCode,jdbcType = VARCHAR}
            </if>
            <if test="slabActThk !=null">
                and MS.SLAB_ACT_THK = #{slabActThk,jdbcType = INTEGER}
            </if>
            <if test="slabActThkFrom !=null">
                and MS.SLAB_ACT_THK >= #{slabActThkFrom,jdbcType = INTEGER}
            </if>
            <if test="slabActThkTo !=null">
                and MS.SLAB_ACT_THK &lt;= #{slabActThkTo,jdbcType = INTEGER}
            </if>
            <if test="psc !=null">
                <bind name="psc" value="psc + '%'"/>
                and MS.PSC like #{psc}
            </if>
            <if test="msc !=null">
                and MS.MSC = #{msc}
            </if>
            <if test="apn !=null">
                and MS.APN = #{apn}
            </if>
            <if test="orderNo !=null">
                and MS.ORDER_NO = #{orderNo,jdbcType = VARCHAR}
            </if>
            <if test="slabStatus !=null">
                and MS.SLAB_STATUS = #{slabStatus,jdbcType = VARCHAR}
            </if>
            <if test="stockCode !=null">
                and WMP.STOCK_CODE = #{stockCode,jdbcType = VARCHAR}
            </if>
            <if test="slabActWidFrom !=null">
                and MS.SLAB_ACT_WID >= #{slabActWidFrom,jdbcType = INTEGER}
            </if>
            <if test="slabActWidTo !=null">
                and MS.SLAB_ACT_WID &lt;= #{slabActWidTo,jdbcType = INTEGER}
            </if>
            <if test="slabActLenFrom !=null">
                and MS.SLAB_ACT_LEN >= #{slabActLenFrom,jdbcType = INTEGER}
            </if>
            <if test="slabActLenTo !=null">
                and MS.SLAB_ACT_LEN &lt;= #{slabActLenTo,jdbcType = INTEGER}
            </if>
            <if test="sgSign !=null">
                and MS.SG_SIGN = #{sgSign,jdbcType = VARCHAR}
            </if>
            <if test="remainCauseCode !=null">
                and MS.REMAIN_CAUSE_CODE = #{remainCauseCode,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>
