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


    <sql id = "BaseSql">
    PSCL.ID,
    PSCL.PONO,
    PSCL.ORDER_NO,
    PSCL.LOW_RESULT,
    PSCL.OLD_RESULT,
    PSCL.TENANT_ID,
    PSCL.ATTRIBUTE1,
    PSCL.ATTRIBUTE2,
    PSCL.ATTRIBUTE3,
    PSCL.ATTRIBUTE4,
    PSCL.ATTRIBUTE5,
    PSCL.creation_date,    PSCL.created_by,    PSCL.last_updated_by,    PSCL.last_update_date,    PSCL.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmSubCheckLow">
        select
        <include refid = "BaseSql"/>
        from PM_SUB_CHECK_LOW PSCL
        <where>
            <if test="id !=null">
                and PSCL.ID = #{id,jdbcType = INTEGER}
            </if>
            <if test="pono !=null">
                and PSCL.PONO = #{pono,jdbcType = VARCHAR}
            </if>
            <if test="orderNo !=null">
                and PSCL.ORDER_NO = #{orderNo,jdbcType = VARCHAR}
            </if>
            <if test="lowResult !=null">
                and PSCL.LOW_RESULT = #{lowResult,jdbcType = VARCHAR}
            </if>
            <if test="oldResult !=null">
                and PSCL.OLD_RESULT = #{oldResult,jdbcType = VARCHAR}
            </if>
            <if test="tenantId !=null">
                and PSCL.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PSCL.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PSCL.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PSCL.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PSCL.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PSCL.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>

    <select id = "selectByPonoAndOrderNo" resultType = "com.xisc.pm.domain.entity.PmSubCheckLow">
        select
        <include refid = "BaseSql"/>
        from PM_SUB_CHECK_LOW PSCL
        where PSCL.PONO = #{pono,jdbcType = VARCHAR}
        and PSCL.ORDER_NO = #{orderNo,jdbcType = VARCHAR}
    </select>
</mapper>

