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


    <sql id = "BaseSql">
    PMTTB.PMTTB_ID,
    PMTTB.PLATE_THICK_FROM,
    PMTTB.PLATE_THICK_TO,
    PMTTB.MIN_THICK_TOL,
    PMTTB.ROLL_LINE_NO,
    PMTTB.TENANT_ID,
    PMTTB.creation_date,    PMTTB.created_by,    PMTTB.last_updated_by,    PMTTB.last_update_date,    PMTTB.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmMinThickTolBt">
        select
        <include refid = "BaseSql"/>
        from PM_MIN_THICK_TOL_BT PMTTB
        <where>
            <if test="pmttbId !=null">
                and PMTTB.PMTTB_ID = #{pmttbId,jdbcType = INTEGER}
            </if>
            <if test="plateThickFrom !=null">
                and PMTTB.PLATE_THICK_FROM <![CDATA[ <= ]]> #{plateThickFrom,jdbcType = INTEGER}
            </if>
            <if test="plateThickTo !=null">
                and PMTTB.PLATE_THICK_FROM <![CDATA[ <= ]]> #{plateThickTo,jdbcType = INTEGER}
            </if>
            <if test="plateThickTo !=null">
                and PMTTB.PLATE_THICK_TO <![CDATA[ >= ]]> #{plateThickTo,jdbcType = INTEGER}
            </if>
            <if test="plateThickFrom !=null">
                and PMTTB.PLATE_THICK_TO <![CDATA[ >= ]]> #{plateThickFrom,jdbcType = INTEGER}
            </if>
            <if test="minThickTol !=null">
                and PMTTB.MIN_THICK_TOL = #{minThickTol,jdbcType = INTEGER}
            </if>
            <if test="rollLineNo !=null">
                and PMTTB.ROLL_LINE_NO = #{rollLineNo,jdbcType = VARCHAR}
            </if>
            <if test="tenantId !=null">
                and PMTTB.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
        </where>
    </select>
</mapper>

