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


    <sql id = "BaseSql">
    PCRS.RULE_SET_ID,
    PCRS.VALID_FLAG,
    PCRS.RULE_NO,
    PCRS.RULE_SET_TYPE,
    PCRS.RULE_SEQ_NO,
    PCRS.TENANT_ID,
    PCRS.ATTRIBUTE1,
    PCRS.ATTRIBUTE2,
    PCRS.ATTRIBUTE3,
    PCRS.ATTRIBUTE4,
    PCRS.ATTRIBUTE5,
    PCRS.creation_date,    PCRS.created_by,    PCRS.last_updated_by,    PCRS.last_update_date,    PCRS.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmCdRuleSet">
        select
        <include refid = "BaseSql"/>
        from PM_CD_RULE_SET PCRS
        <where>
            <if test="ruleSetId !=null">
                and PCRS.RULE_SET_ID = #{ruleSetId,jdbcType = INTEGER}
            </if>
            <if test="validFlag !=null">
                and PCRS.VALID_FLAG = #{validFlag,jdbcType = INTEGER}
            </if>
            <if test="ruleNo !=null">
                and PCRS.RULE_NO = #{ruleNo,jdbcType = INTEGER}
            </if>
            <if test="ruleSetType !=null">
                and PCRS.RULE_SET_TYPE = #{ruleSetType,jdbcType = VARCHAR}
            </if>
            <if test="ruleSeqNo !=null">
                and PCRS.RULE_SEQ_NO = #{ruleSeqNo,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PCRS.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PCRS.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PCRS.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PCRS.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PCRS.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PCRS.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>
