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


    <sql id = "BaseSql">
    PPRI.RULE_NO_ID,
    PPRI.RULE_NO,
    PPRI.RULE_DESC,
    PPRI.VALID_FLAG,
    PPRI.TENANT_ID,
    PPRI.ATTRIBUTE1,
    PPRI.ATTRIBUTE2,
    PPRI.ATTRIBUTE3,
    PPRI.ATTRIBUTE4,
    PPRI.ATTRIBUTE5,
    PPRI.creation_date,    PPRI.created_by,    PPRI.last_updated_by,    PPRI.last_update_date,    PPRI.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmPdRuleItem">
        select
        <include refid = "BaseSql"/>
        from PM_PD_RULE_ITEM PPRI
        <where>
            <if test="ruleNoId !=null">
                and PPRI.RULE_NO_ID = #{ruleNoId,jdbcType = INTEGER}
            </if>
            <if test="ruleNo !=null">
                <bind name="ruleNoLike" value="'%' + ruleNo + '%'"/>
                and PPRI.RULE_NO like #{ruleNoLike}
            </if>
            <if test="ruleDesc !=null">
                <bind name="ruleDescLike" value="'%' + ruleDesc + '%'"/>
                and PPRI.RULE_DESC like #{ruleDescLike}
            </if>
            <if test="validFlag !=null">
                and PPRI.VALID_FLAG = #{validFlag,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PPRI.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PPRI.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PPRI.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PPRI.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PPRI.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PPRI.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

