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


    <sql id = "BaseSql">
        PPGA.POLICY_GROUP_ID,
        PPGA.PRIORITY_DELIVY_DATE_TO,
        PPGA.PRIORITY_CONTRACT_ALLOWANCE,
        PPGA.CLEAR_DELIVY_DATE_TO,
        PPGA.CLEAR_CONTRACT_ALLOWANCE,
        PPGA.SINGLE_YIELD,
        PPGA.A2_WID_DEVIATION,
        PPGA.OVERCAST_QTY,
        PPGA.OVERCAST_DELIVY_DATE_TO,
        PPGA.DESIGN_LENGTH_MAX,
        PPGA.TENANT_ID,
        PPGA.ATTRIBUTE1,
        PPGA.ATTRIBUTE2,
        PPGA.ATTRIBUTE3,
        PPGA.ATTRIBUTE4,
        PPGA.ATTRIBUTE5,
        PPGA.creation_date,        PPGA.created_by,        PPGA.last_updated_by,        PPGA.last_update_date,        PPGA.object_version_number
    </sql>

    <select id = "selectList" resultType = "com.xisc.pm.domain.entity.PmPolicyGroupAttr">
        select
        <include refid = "BaseSql"/>
        from PM_POLICY_GROUP_ATTR PPGA
        <where>
            <if test="policyGroupId !=null">
                and PPGA.POLICY_GROUP_ID = #{policyGroupId,jdbcType = INTEGER}
            </if>
            <if test="priorityDelivyDateTo !=null">
                and PPGA.PRIORITY_DELIVY_DATE_TO = #{priorityDelivyDateTo,jdbcType = OTHER}
            </if>
            <if test="priorityContractAllowance !=null">
                and PPGA.PRIORITY_CONTRACT_ALLOWANCE = #{priorityContractAllowance,jdbcType = INTEGER}
            </if>
            <if test="clearDelivyDateTo !=null">
                and PPGA.CLEAR_DELIVY_DATE_TO = #{clearDelivyDateTo,jdbcType = OTHER}
            </if>
            <if test="clearContractAllowance !=null">
                and PPGA.CLEAR_CONTRACT_ALLOWANCE = #{clearContractAllowance,jdbcType = INTEGER}
            </if>
            <if test="singleYield !=null">
                and PPGA.SINGLE_YIELD = #{singleYield,jdbcType = INTEGER}
            </if>
            <if test="a2WidDeviation !=null">
                and PPGA.A2_WID_DEVIATION = #{a2WidDeviation,jdbcType = INTEGER}
            </if>
            <if test="overcastQty !=null">
                and PPGA.OVERCAST_QTY = #{overcastQty,jdbcType = INTEGER}
            </if>
            <if test="overcastDelivyDateTo !=null">
                and PPGA.OVERCAST_DELIVY_DATE_TO = #{overcastDelivyDateTo,jdbcType = OTHER}
            </if>
            <if test="designLengthMax !=null">
                and PPGA.DESIGN_LENGTH_MAX = #{designLengthMax,jdbcType = INTEGER}
            </if>
            <if test="tenantId !=null">
                and PPGA.TENANT_ID = #{tenantId,jdbcType = INTEGER}
            </if>
            <if test="attribute1 !=null">
                and PPGA.ATTRIBUTE1 = #{attribute1,jdbcType = VARCHAR}
            </if>
            <if test="attribute2 !=null">
                and PPGA.ATTRIBUTE2 = #{attribute2,jdbcType = VARCHAR}
            </if>
            <if test="attribute3 !=null">
                and PPGA.ATTRIBUTE3 = #{attribute3,jdbcType = VARCHAR}
            </if>
            <if test="attribute4 !=null">
                and PPGA.ATTRIBUTE4 = #{attribute4,jdbcType = VARCHAR}
            </if>
            <if test="attribute5 !=null">
                and PPGA.ATTRIBUTE5 = #{attribute5,jdbcType = VARCHAR}
            </if>
        </where>
    </select>
</mapper>

