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


    <sql id = "BaseSql">
    PPV.POLICY_VIP_CUST_ID,
    PPV.POLICY_ID,
    PPV.CUSTOMER_CODE,
    PPV.PRIORITY,
    PPV.TENANT_ID,
    PPV.ATTRIBUTE1,
    PPV.ATTRIBUTE2,
    PPV.ATTRIBUTE3,
    PPV.ATTRIBUTE4,
    PPV.ATTRIBUTE5,
    PPV.creation_date,    PPV.created_by,    PPV.last_updated_by,    PPV.last_update_date,    PPV.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmPolicyVip">
        select
        <include refid = "BaseSql"/>
        from PM_POLICY_VIP PPV
        <where>
            <if test="policyVipCustId !=null">
                and PPV.POLICY_VIP_CUST_ID = #{policyVipCustId,jdbcType = INTEGER}
            </if>
            <if test="policyId !=null">
                and PPV.POLICY_ID = #{policyId,jdbcType = INTEGER}
            </if>
            <if test="customerCode !=null">
                and PPV.CUSTOMER_CODE = #{customerCode,jdbcType = VARCHAR}
            </if>
            <if test="priority !=null">
                and PPV.PRIORITY = #{priority,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PPV.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PPV.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PPV.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PPV.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PPV.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PPV.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

