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


    <sql id="BaseSql">
        QTLRH
        .
        LRH_ID
        ,
    QTLRH.ORDER_NO,
    QTLRH.WHOLE_BACKLOG_NO,
    QTLRH.WHOLE_BACKLOG,
    QTLRH.MSC_LINE_NO,
    QTLRH.WHOLE_BACKLOG_CODE,
    QTLRH.WHOLE_BACKLOG_SEQ,
    QTLRH.WHOLE_HEAT_TREATMENT_TYPE,
    QTLRH.HEAT_TREATMENT_SEQ,
    QTLRH.HEAT_TREATMENT_TYPE,
    QTLRH.FURNACE_NUM,
    QTLRH.HEAT_RATE,
    QTLRH.HEAT_RATE_AIM,
    QTLRH.TAP_TEMP_MIN,
    QTLRH.TAP_TEMP_MAX,
    QTLRH.TAP_TEMP_AIM,
    QTLRH.KEEP_WARM_MIN,
    QTLRH.KEEP_WARM_MAX,
    QTLRH.KEEP_WARM_AIM,
    QTLRH.COOL_MODE,
    QTLRH.REDNESS_TEMP_MIN,
    QTLRH.REDNESS_TEMP_MAX,
    QTLRH.REDNESS_TEMP_AIM,
    QTLRH.PILE_COOL_REQ,
    QTLRH.TECHNICAL_DOC,
    QTLRH.MODIFY_VERSION,
    QTLRH.REMARK,
    QTLRH.TENANT_ID,
    QTLRH.ATTRIBUTE1,
    QTLRH.ATTRIBUTE2,
    QTLRH.ATTRIBUTE3,
    QTLRH.ATTRIBUTE4,
    QTLRH.ATTRIBUTE5,
    QTLRH.creation_date,    QTLRH.created_by,    QTLRH.last_updated_by,    QTLRH.last_update_date,    QTLRH.object_version_number
    </sql>

    <select id="selectList" resultType="com.xisc.pm.domain.vo.QdToLineupResultHeattreatVO">
        select
        <include refid="BaseSql"/>
        from QD_TO_LINEUP_RESULT_HEATTREAT QTLRH
        <where>
            <if test="lrhId !=null">
                and QTLRH.LRH_ID = #{lrhId,jdbcType = INTEGER}
            </if>
            <if test="orderNo !=null">
                and QTLRH.ORDER_NO = #{orderNo,jdbcType = VARCHAR}
            </if>
            <if test="wholeBacklogNo !=null">
                and QTLRH.WHOLE_BACKLOG_NO = #{wholeBacklogNo,jdbcType = INTEGER}
            </if>
            <if test="wholeBacklog !=null">
                and QTLRH.WHOLE_BACKLOG = #{wholeBacklog,jdbcType = VARCHAR}
            </if>
            <if test="mscLineNo !=null">
                and QTLRH.MSC_LINE_NO = #{mscLineNo,jdbcType = VARCHAR}
            </if>
            <if test="wholeBacklogCode !=null">
                and QTLRH.WHOLE_BACKLOG_CODE = #{wholeBacklogCode,jdbcType = VARCHAR}
            </if>
            <if test="wholeBacklogSeq !=null">
                and QTLRH.WHOLE_BACKLOG_SEQ = #{wholeBacklogSeq,jdbcType = INTEGER}
            </if>
            <if test="wholeHeatTreatmentType !=null">
                and QTLRH.WHOLE_HEAT_TREATMENT_TYPE = #{wholeHeatTreatmentType,jdbcType = VARCHAR}
            </if>
            <if test="heatTreatmentSeq !=null">
                and QTLRH.HEAT_TREATMENT_SEQ = #{heatTreatmentSeq,jdbcType = INTEGER}
            </if>
            <if test="heatTreatmentType !=null">
                and QTLRH.HEAT_TREATMENT_TYPE = #{heatTreatmentType,jdbcType = VARCHAR}
            </if>
            <if test="furnaceNum !=null">
                and QTLRH.FURNACE_NUM = #{furnaceNum,jdbcType = VARCHAR}
            </if>
            <if test="heatRate !=null">
                and QTLRH.HEAT_RATE = #{heatRate,jdbcType = VARCHAR}
            </if>
            <if test="heatRateAim !=null">
                and QTLRH.HEAT_RATE_AIM = #{heatRateAim,jdbcType = VARCHAR}
            </if>
            <if test="tapTempMin !=null">
                and QTLRH.TAP_TEMP_MIN = #{tapTempMin,jdbcType = VARCHAR}
            </if>
            <if test="tapTempMax !=null">
                and QTLRH.TAP_TEMP_MAX = #{tapTempMax,jdbcType = VARCHAR}
            </if>
            <if test="tapTempAim !=null">
                and QTLRH.TAP_TEMP_AIM = #{tapTempAim,jdbcType = VARCHAR}
            </if>
            <if test="keepWarmMin !=null">
                and QTLRH.KEEP_WARM_MIN = #{keepWarmMin,jdbcType = VARCHAR}
            </if>
            <if test="keepWarmMax !=null">
                and QTLRH.KEEP_WARM_MAX = #{keepWarmMax,jdbcType = VARCHAR}
            </if>
            <if test="keepWarmAim !=null">
                and QTLRH.KEEP_WARM_AIM = #{keepWarmAim,jdbcType = VARCHAR}
            </if>
            <if test="coolMode !=null">
                and QTLRH.COOL_MODE = #{coolMode,jdbcType = VARCHAR}
            </if>
            <if test="rednessTempMin !=null">
                and QTLRH.REDNESS_TEMP_MIN = #{rednessTempMin,jdbcType = VARCHAR}
            </if>
            <if test="rednessTempMax !=null">
                and QTLRH.REDNESS_TEMP_MAX = #{rednessTempMax,jdbcType = VARCHAR}
            </if>
            <if test="rednessTempAim !=null">
                and QTLRH.REDNESS_TEMP_AIM = #{rednessTempAim,jdbcType = VARCHAR}
            </if>
            <if test="pileCoolReq !=null">
                and QTLRH.PILE_COOL_REQ = #{pileCoolReq,jdbcType = VARCHAR}
            </if>
            <if test="technicalDoc !=null">
                and QTLRH.TECHNICAL_DOC = #{technicalDoc,jdbcType = VARCHAR}
            </if>
            <if test="modifyVersion !=null">
                and QTLRH.MODIFY_VERSION = #{modifyVersion,jdbcType = INTEGER}
            </if>
            <if test="remark !=null">
                and QTLRH.REMARK = #{remark,jdbcType = VARCHAR}
            </if>
            <if test="tenantId !=null">
                and QTLRH.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and QTLRH.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and QTLRH.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and QTLRH.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and QTLRH.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and QTLRH.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
    
    <select id="selectReultHeatTreat" resultType="com.xisc.pm.domain.vo.QdToLineupResultHeattreatVO">
        select
			<include refid="BaseSql"/>
        from
        QD_TO_LINEUP_RESULT_HEATTREAT QTLRH
        where
        QTLRH.MSC_LINE_NO = #{mscLineNo}
        and QTLRH.ORDER_NO in
        <foreach collection="orderNoList" item="orderNo" open="(" close=")" separator="," >
            #{orderNo}
        </foreach>
    </select>
    
</mapper>
