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


    <sql id = "BaseSql">
        PSRB.PSRB_ID,
        PSRB.ST_NO,
        PSRB.SAMPLE_LEN_HEAD,
        PSRB.SAMPLE_LEN_TAIL,
        PSRB.TENANT_ID,
        PSRB.ATTRIBUTE1,
        PSRB.ATTRIBUTE2,
        PSRB.ATTRIBUTE3,
        PSRB.ATTRIBUTE4,
        PSRB.ATTRIBUTE5,
        PSRB.creation_date,        PSRB.created_by,        PSRB.last_updated_by,        PSRB.last_update_date,        PSRB.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmSampleReserveBt">
        select
        <include refid = "BaseSql"/>
        from PM_SAMPLE_RESERVE_BT PSRB
        <where>
            <if test="psrbId !=null">
                and PSRB.PSRB_ID = #{psrbId,jdbcType = INTEGER}
            </if>
            <if test="stNo !=null">
                <bind name="stNoLike" value="'%' + stNo + '%'"/>
                and PSRB.ST_NO like #{stNoLike}
            </if>
            <if test="sampleLenHead !=null">
                and PSRB.SAMPLE_LEN_HEAD = #{sampleLenHead,jdbcType = INTEGER}
            </if>
            <if test="sampleLenTail !=null">
                and PSRB.SAMPLE_LEN_TAIL = #{sampleLenTail,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PSRB.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PSRB.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PSRB.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PSRB.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PSRB.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PSRB.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

