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


    <sql id = "BaseSql">
    PPA.POLICY_ATTR_ID,
    PPA.POLICY_ID,
    PPA.DELIVY_DATE_TO,
    PPA.CONTRACT_ALLOWANCE,
    PPA.REMAINING_PRIORITY_FLAG,
    PPA.REMAINING_CLEAR_FLAG,
    PPA.SINGLE_YIELD,
    PPA.A2_WID_DEVIATION,
    PPA.OVERCAST_QTY,
    PPA.OVERCAST_DELIVY_DATE_TO,
    PPA.DESIGN_LENGTH_MAX,
    PPA.TENANT_ID,
    PPA.ATTRIBUTE1,
    PPA.ATTRIBUTE2,
    PPA.ATTRIBUTE3,
    PPA.ATTRIBUTE4,
    PPA.ATTRIBUTE5,
    PPA.creation_date,    PPA.created_by,    PPA.last_updated_by,    PPA.last_update_date,    PPA.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmPolicyAttr">
        select
        <include refid = "BaseSql"/>
        from PM_POLICY_ATTR PPA
        <where>
            <if test="policyAttrId !=null">
                and PPA.POLICY_ATTR_ID = #{policyAttrId,jdbcType = INTEGER}
            </if>
            <if test="policyId !=null">
                and PPA.POLICY_ID = #{policyId,jdbcType = INTEGER}
            </if>
            <if test="delivyDateTo !=null">
                and PPA.DELIVY_DATE_TO = #{delivyDateTo,jdbcType = OTHER}
            </if>
            <if test="contractAllowance !=null">
                and PPA.CONTRACT_ALLOWANCE = #{contractAllowance,jdbcType = INTEGER}
            </if>
            <if test="remainingPriorityFlag !=null">
                and PPA.REMAINING_PRIORITY_FLAG = #{remainingPriorityFlag,jdbcType = INTEGER}
            </if>
            <if test="remainingClearFlag !=null">
                and PPA.REMAINING_CLEAR_FLAG = #{remainingClearFlag,jdbcType = INTEGER}
            </if>
            <if test="singleYield !=null">
                and PPA.SINGLE_YIELD = #{singleYield,jdbcType = INTEGER}
            </if>
            <if test="a2WidDeviation !=null">
                and PPA.A2_WID_DEVIATION = #{a2WidDeviation,jdbcType = INTEGER}
            </if>
            <if test="overcastQty !=null">
                and PPA.OVERCAST_QTY = #{overcastQty,jdbcType = INTEGER}
            </if>
            <if test="overcastDelivyDateTo !=null">
                and PPA.OVERCAST_DELIVY_DATE_TO = #{overcastDelivyDateTo,jdbcType = OTHER}
            </if>
            <if test="designLengthMax !=null">
                and PPA.DESIGN_LENGTH_MAX = #{designLengthMax,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PPA.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PPA.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PPA.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PPA.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PPA.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PPA.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

