<?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.PmProContProdTtrMapper">
    <sql id = "BaseSql">
        PPCPA.PRO_CONT_ID,
        PPCPA.ORDER_NO,
        PPCPA.ORDER_WT,
        PPCPA.ORDER_QTY,
        PPCPA.DELIVY_NUM_TOL_PLUS,
        PPCPA.DELIVY_NUM_TOL_MINUS,
        PPCPA.ORDER_UNIT_AIM_WT,
        PPCPA.ORDER_UNIT_MAX_WT,
        PPCPA.ORDER_UNIT_MIN_WT,
        PPCPA.ORDER_TYPE_CODE,
        PPCPA.URG_ORDER_FLAG,
        PPCPA.DELIVY_DATE,
        PPCPA.EXPORT_FLAG,
        PPCPA.PSC,
        PPCPA.MSC,
        PPCPA.APN,
        PPCPA.SG_STD,
        PPCPA.SG_SIGN,
        PPCPA.SG_CODE,
        PPCPA.NEW_TEST_NO,
        PPCPA.ORDER_THICK,
        PPCPA.ORDER_WIDTH,
        PPCPA.FIN_CUST_CODE,
        PPCPA.ORDER_MAX_LEN,
        PPCPA.ORDER_MIN_LEN,
        PPCPA.ORDER_SHORT_MAX,
        PPCPA.ORDER_SHORT_MIN,
        PPCPA.ORDER_SHORT_RATE,
        PPCPA.ORDER_NO_ERP,
        PPCPA.ORDER_CUST_CNAME,
        PPCPA.CONSIGN_CUST_CNAME,
        PPCPA.DELIVY_PLACE_NAME,
        PPCPA.TRNP_MODE_CODE,
        PPCPA.PLANER_FLAG,
        PPCPA.XZ_FLAG,
        PPCPA.ORDER_LEN,
        PPCPA.WIDTH_DIV,
        PPCPA.WIDTH_MAX,
        PPCPA.WIDTH_MIN,
        PPCPA.LEN_DIV,
        PPCPA.PROD_CODE_HP,
        PPCPA.THICK_TOL_MAX,
        PPCPA.THICK_TOL_MIN,
        PPCPA.WIDTH_TOL_MAX,
        PPCPA.WIDTH_TOL_MIN,
        PPCPA.LEN_TOL_MAX,
        PPCPA.LEN_TOL_MIN,
        PPCPA.SAMPLE_LEN_HEAD,
        PPCPA.SAMPLE_LEN_TAIL,
        PPCPA.WIDTH_ADDV,
        PPCPA.SHP_CODE,
        PPCPA.HULL_SECTION_NO,
        PPCPA.SECTION_MANAGE,
        PPCPA.TWO_ROLL_FLAG,
        PPCPA.TWO_ROLL_ORDER_FLAG,
        PPCPA.SAMPLE_MODE_CODE,
        PPCPA.PICK_PATTERN_CODE,
        PPCPA.ACCP_AUTH_CODE,
        PPCPA.ACCPT_MODE_CODE,
        PPCPA.CHECK_METHOD_CODE,
        PPCPA.SAMPLE_CHECK_FLAG,
        PPCPA.PROD_SR_MARK,
        PPCPA.PROD_SIDE_MARK,
        PPCPA.PROD_SHOT_MARK,
        PPCPA.PROD_N_MARK,
        PPCPA.PROD_Q_MARK,
        PPCPA.PROD_T_MARK,
        PPCPA.PROD_A_MARK,
        PPCPA.BACKLOG_UT_MARK,
        PPCPA.BACKLOG_N_MARK,
        PPCPA.BACKLOG_Q_MARK,
        PPCPA.BACKLOG_T_MARK,
        PPCPA.BACKLOG_A_MARK,
        PPCPA.BACKLOG_DEMAG_MARK,
        PPCPA.BACKLOG_PT_MARK,
        PPCPA.BACKLOG_MT_MARK,
        PPCPA.BACKLOG_TMCP_MARK,
        PPCPA.NEED_LECQUERING,
        PPCPA.SHOT_PAINT_CODE,
        PPCPA.GIVE_SAMPLE_CODE,
        PPCPA.SAMPLE_LEN_GIVE,
        PPCPA.SHOT_FLAG,
        PPCPA.TRIM_CODE,
        PPCPA.TS_MAX,
        PPCPA.TS_MIN,
        PPCPA.PROD_DENSITY,
        PPCPA.DI_FLAG,
        PPCPA.INGOT_ROLL,
        PPCPA.SPECIAL_PRINT,
        PPCPA.PROJECT_CODE,
        PPCPA.TENANT_ID,
        PPCPA.ATTRIBUTE1,
        PPCPA.ATTRIBUTE2,
        PPCPA.ATTRIBUTE3,
        PPCPA.ATTRIBUTE4,
        PPCPA.ATTRIBUTE5,
        PPCPA.WT_METHOD_CODE,
        PPCPA.creation_date,        PPCPA.created_by,        PPCPA.last_updated_by,        PPCPA.last_update_date,        PPCPA.object_version_number
    </sql>

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