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


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

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmCdRuleItem">
        select
        <include refid = "BaseSql"/>
        from PM_CD_RULE_ITEM PCRI
        <where>
            <if test="ruleItemId !=null">
                and PCRI.RULE_ITEM_ID = #{ruleItemId,jdbcType = INTEGER}
            </if>
            <if test="validFlag !=null">
                and PCRI.VALID_FLAG = #{validFlag,jdbcType = INTEGER}
            </if>
            <if test="ruleNo !=null">
                and PCRI.RULE_NO = #{ruleNo,jdbcType = INTEGER}
            </if>
            <if test="ruleDesc !=null">
                and PCRI.RULE_DESC = #{ruleDesc,jdbcType = VARCHAR}
            </if>
            <if test="tenantId !=null">
                and PCRI.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PCRI.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PCRI.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PCRI.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PCRI.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PCRI.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>
