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


    <sql id = "BaseSql">
    PISTBT.TRA_ID,
    PISTBT.OPERATION_TYPE,
    PISTBT.OPERATION_USER,
    PISTBT.OPERATION_TIME,
    PISTBT.PISTB_ID,
    PISTBT.INGOT_TYPE,
    PISTBT.GUARANTEE_QUALITY,
    PISTBT.MIN_ROLL_THICK,
    PISTBT.MAX_ROLL_THICK,
    PISTBT.MIN_ROLL_WIDTH,
    PISTBT.MAX_ROLL_WIDTH,
    PISTBT.ROLL_LEN_FROM,
    PISTBT.ROLL_LEN_TO,
    PISTBT.ROLL_LINE_NO,
    PISTBT.WITH_SIDE_FLAG,
    PISTBT.ROLL_DIRECT_CODE,
    PISTBT.TRIM_WIDTH,
    PISTBT.TENANT_ID,
    PISTBT.ATTRIBUTE1,
    PISTBT.ATTRIBUTE2,
    PISTBT.ATTRIBUTE3,
    PISTBT.ATTRIBUTE4,
    PISTBT.ATTRIBUTE5,
    PISTBT.creation_date,    PISTBT.created_by,    PISTBT.last_updated_by,    PISTBT.last_update_date,    PISTBT.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmIngotSpecTrimBtTra">
        select
        <include refid = "BaseSql"/>
        from PM_INGOT_SPEC_TRIM_BT_TRA PISTBT
        <where>
            <if test="traId !=null">
                and PISTBT.TRA_ID = #{traId,jdbcType = INTEGER}
            </if>
            <if test="operationType !=null">
                and PISTBT.OPERATION_TYPE = #{operationType,jdbcType = VARCHAR}
            </if>
            <if test="operationUser !=null">
                and PISTBT.OPERATION_USER = #{operationUser,jdbcType = VARCHAR}
            </if>
            <if test="operationTime !=null">
                and PISTBT.OPERATION_TIME = #{operationTime,jdbcType = OTHER}
            </if>
            <if test="pistbId !=null">
                and PISTBT.PISTB_ID = #{pistbId,jdbcType = INTEGER}
            </if>
            <if test="ingotType !=null">
                and PISTBT.INGOT_TYPE = #{ingotType,jdbcType = VARCHAR}
            </if>
            <if test="guaranteeQuality !=null">
                and PISTBT.GUARANTEE_QUALITY = #{guaranteeQuality,jdbcType = VARCHAR}
            </if>
            <if test="minRollThick !=null">
                and PISTBT.MIN_ROLL_THICK = #{minRollThick,jdbcType = INTEGER}
            </if>
            <if test="maxRollThick !=null">
                and PISTBT.MAX_ROLL_THICK = #{maxRollThick,jdbcType = INTEGER}
            </if>
            <if test="minRollWidth !=null">
                and PISTBT.MIN_ROLL_WIDTH = #{minRollWidth,jdbcType = INTEGER}
            </if>
            <if test="maxRollWidth !=null">
                and PISTBT.MAX_ROLL_WIDTH = #{maxRollWidth,jdbcType = INTEGER}
            </if>
            <if test="rollLenFrom !=null">
                and PISTBT.ROLL_LEN_FROM = #{rollLenFrom,jdbcType = INTEGER}
            </if>
            <if test="rollLenTo !=null">
                and PISTBT.ROLL_LEN_TO = #{rollLenTo,jdbcType = INTEGER}
            </if>
            <if test="rollLineNo !=null">
                and PISTBT.ROLL_LINE_NO = #{rollLineNo,jdbcType = VARCHAR}
            </if>
            <if test="withSideFlag !=null">
                and PISTBT.WITH_SIDE_FLAG = #{withSideFlag,jdbcType = VARCHAR}
            </if>
            <if test="rollDirectCode !=null">
                and PISTBT.ROLL_DIRECT_CODE = #{rollDirectCode,jdbcType = VARCHAR}
            </if>
            <if test="trimWidth !=null">
                and PISTBT.TRIM_WIDTH = #{trimWidth,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PISTBT.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PISTBT.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PISTBT.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PISTBT.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PISTBT.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PISTBT.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

