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


    <sql id = "BaseSql">
    PPTB.PPTB_ID,
    PPTB.PLATE_THICK_FROM,
    PPTB.PLATE_THICK_TO,
    PPTB.COMBINE_PLATE_WIDTH_FROM,
    PPTB.COMBINE_PLATE_WIDTH_TO,
    PPTB.SMALL_PLATE_LEN_FROM,
    PPTB.SMALL_PLATE_LEN_TO,
    PPTB.WITH_SIDE_FLAG,
    PPTB.TRIM_WIDTH,
    PPTB.MSC_LINE_NO,
    PPTB.TENANT_ID,
    PPTB.ATTRIBUTE1,
    PPTB.ATTRIBUTE2,
    PPTB.ATTRIBUTE3,
    PPTB.ATTRIBUTE4,
    PPTB.ATTRIBUTE5,
    PPTB.WIDEN_FROM,
    PPTB.WIDEN_TO,
    PPTB.creation_date,    PPTB.created_by,    PPTB.last_updated_by,    PPTB.last_update_date,    PPTB.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmPlateTrimBt">
        select
        <include refid = "BaseSql"/>
        from PM_PLATE_TRIM_BT PPTB
        <where>
            <if test="pptbId !=null">
                and PPTB.PPTB_ID = #{pptbId,jdbcType = INTEGER}
            </if>
            <if test="plateThickFrom !=null">
                and PPTB.PLATE_THICK_FROM <![CDATA[ <= ]]> #{plateThickFrom,jdbcType = INTEGER}
            </if>
            <if test="plateThickTo !=null">
                and PPTB.PLATE_THICK_FROM <![CDATA[ <= ]]> #{plateThickTo,jdbcType = INTEGER}
            </if>
            <if test="plateThickTo !=null">
                and PPTB.PLATE_THICK_TO <![CDATA[ >= ]]> #{plateThickTo,jdbcType = INTEGER}
            </if>
            <if test="plateThickFrom !=null">
                and PPTB.PLATE_THICK_TO <![CDATA[ >= ]]> #{plateThickFrom,jdbcType = INTEGER}
            </if>
            <if test="combinePlateWidthFrom !=null">
                and PPTB.COMBINE_PLATE_WIDTH_FROM <![CDATA[ <= ]]> #{combinePlateWidthFrom,jdbcType = INTEGER}
            </if>
            <if test="combinePlateWidthTo !=null">
                and PPTB.COMBINE_PLATE_WIDTH_FROM <![CDATA[ <= ]]> #{combinePlateWidthTo,jdbcType = INTEGER}
            </if>
            <if test="combinePlateWidthTo !=null">
                and PPTB.COMBINE_PLATE_WIDTH_TO <![CDATA[ >= ]]> #{combinePlateWidthTo,jdbcType = INTEGER}
            </if>
            <if test="combinePlateWidthFrom !=null">
                and PPTB.COMBINE_PLATE_WIDTH_TO <![CDATA[ >= ]]> #{combinePlateWidthFrom,jdbcType = INTEGER}
            </if>
            <if test="smallPlateLenFrom !=null">
                and PPTB.SMALL_PLATE_LEN_FROM <![CDATA[ <= ]]> #{smallPlateLenFrom,jdbcType = INTEGER}
            </if>
            <if test="smallPlateLenTo !=null">
                and PPTB.SMALL_PLATE_LEN_FROM <![CDATA[ <= ]]> #{smallPlateLenTo,jdbcType = INTEGER}
            </if>
            <if test="smallPlateLenTo !=null">
                and PPTB.SMALL_PLATE_LEN_TO <![CDATA[ >= ]]> #{smallPlateLenTo,jdbcType = INTEGER}
            </if>
            <if test="smallPlateLenFrom !=null">
                and PPTB.SMALL_PLATE_LEN_TO <![CDATA[ >= ]]> #{smallPlateLenFrom,jdbcType = INTEGER}
            </if>
            <if test="withSideFlag !=null">
                and PPTB.WITH_SIDE_FLAG = #{withSideFlag,jdbcType = VARCHAR}
            </if>
            <if test="trimWidth !=null">
                and PPTB.TRIM_WIDTH = #{trimWidth,jdbcType = INTEGER}
            </if>
            <if test="mscLineNo !=null">
                and PPTB.MSC_LINE_NO = #{mscLineNo,jdbcType = VARCHAR}
            </if>
            <if test="tenantId !=null">
                and PPTB.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PPTB.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PPTB.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PPTB.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PPTB.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PPTB.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
            <if test="widenFrom !=null">
                and PPTB.WIDEN_FROM  <![CDATA[ <= ]]> #{widenFrom,jdbcType = INTEGER}
            </if>
            <if test="widenTo !=null">
                and PPTB.WIDEN_FROM  <![CDATA[ <= ]]> #{widenTo,jdbcType = INTEGER}
            </if>
            <if test="widenTo !=null">
                and PPTB.WIDEN_TO  <![CDATA[ >= ]]> #{widenTo,jdbcType = INTEGER}
            </if>
            <if test="widenFrom !=null">
                and PPTB.WIDEN_TO  <![CDATA[ >= ]]> #{widenFrom,jdbcType = INTEGER}
            </if>
        </where>
    </select>
</mapper>

