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


    <sql id = "BaseSql">
        PPGR.POLICY_GROUP_REL_ID,
        PPGR.POLICY_GROUP_ID,
        PPGR.POLICY_ID,
        PPGR.SEQ,
        PPGR.TENANT_ID,
        PPGR.ATTRIBUTE1,
        PPGR.ATTRIBUTE2,
        PPGR.ATTRIBUTE3,
        PPGR.ATTRIBUTE4,
        PPGR.ATTRIBUTE5,
        PPGR.creation_date,        PPGR.created_by,        PPGR.last_updated_by,        PPGR.last_update_date,        PPGR.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmPolicyGroupRel">
        select
        <include refid = "BaseSql"/>
        from PM_POLICY_GROUP_REL PPGR
        <where>
            <if test="policyGroupRelId !=null">
                and PPGR.POLICY_GROUP_REL_ID = #{policyGroupRelId,jdbcType = INTEGER}
            </if>
            <if test="policyGroupId !=null">
                and PPGR.POLICY_GROUP_ID = #{policyGroupId,jdbcType = INTEGER}
            </if>
            <if test="policyId !=null">
                and PPGR.POLICY_ID = #{policyId,jdbcType = VARCHAR}
            </if>
            <if test="seq !=null">
                and PPGR.SEQ = #{seq,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PPGR.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PPGR.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PPGR.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PPGR.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PPGR.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PPGR.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

