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


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

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

