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


    <sql id = "BaseSql">
        PPGO.POLICY_GROUP_ORDER_ID,
        PPGO.POLICY_GROUP_ID,
        PPGO.PRIORITY,
        PPGO.GROUP_DIMENSION,
        PPGO.GROUP_SEQ,
        PPGO.TENANT_ID,
        PPGO.ATTRIBUTE1,
        PPGO.ATTRIBUTE2,
        PPGO.ATTRIBUTE3,
        PPGO.ATTRIBUTE4,
        PPGO.ATTRIBUTE5,
        PPGO.creation_date,        PPGO.created_by,        PPGO.last_updated_by,       PPGO.last_update_date,        PPGO.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmPolicyGrOrder">
        select
        <include refid = "BaseSql"/>
        from PM_POLICY_GR_ORDER PPGO
        <where>
            <if test="policyGroupOrderId !=null">
                and PPGO.POLICY_GROUP_ORDER_ID = #{policyGroupOrderId,jdbcType = INTEGER}
            </if>
            <if test="policyGroupId !=null">
                and PPGO.POLICY_GROUP_ID = #{policyGroupId,jdbcType = INTEGER}
            </if>
            <if test="priority !=null">
                and PPGO.PRIORITY = #{priority,jdbcType = INTEGER}
            </if>
            <if test="groupDimension !=null">
                and PPGO.GROUP_DIMENSION = #{groupDimension,jdbcType = VARCHAR}
            </if>
            <if test="groupSeq !=null">
                and PPGO.GROUP_SEQ = #{groupSeq,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PPGO.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PPGO.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PPGO.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PPGO.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PPGO.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PPGO.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

