<?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.huyi.service.common.financeProduct.mapper.FinanceProductMapper">

    <select id="selectFinanceProductList" parameterType="map" resultType="map">
        SELECT
            zfp_id              'zfpId',
            zfp_number          'zfpNumber',
            zfp_name            'zfpName',
            CASE  WHEN zfp_id= #{paramMap.zfpId}  THEN 0  ELSE  1  END  'flag'
        FROM
        zc_finance_product
        WHERE 1=1
        <if test="paramMap.zfpId != null  and paramMap.zfpId != ''">
            AND (zfp_id= #{paramMap.zfpId} OR zfp_status = '01')
        </if>
        <if test="paramMap.zfpId == null  or paramMap.zfpId == ''">
            AND zfp_status = '01'
        </if>
        order by flag asc ,create_time desc
    </select>
</mapper>