<?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.sunxung.factoring.mapper.financing.apply.CFinancingBasicInfoMapper">

    <resultMap id="CFinancingBasicInfoResult" type="com.sunxung.factoring.entity.financing.apply.CFinancingBasicInfo">
        <result column="business_number" property="businessNumber" />
        <result column="contract_number" property="contractNumber" />
        <result column="quota_disburse_batch" property="quotaDisburseBatch" />
        <result column="project_name" property="projectName" />
        <result column="main_enterprise_name" property="supplierName" />
        <result column="core_enterprise_name" property="customerName" />
        <result column="platform_name" property="tradingPlatformName" />
        <result column="financing_amount" property="financingAmount" />
        <result column="financing_status" property="financingStatus" />
        <result column="current_stage" property="currentStage" />
    </resultMap>

    <select id="getListInfo" parameterType="java.lang.Long" resultMap="CFinancingBasicInfoResult">
        SELECT
            t1.id,
            t1.business_number,
            t3.contract_no contract_number,
            t2.quota_disburse_batch,
            t1.project_name,
            t4.corporate_name main_enterprise_name,
            t5.corporate_name core_enterprise_name,
            t6.platform_name,
            t1.financing_amount,
            t7.name current_stage,
            t8.name financing_status
        FROM c_financing_basic_info t1
            LEFT JOIN review_quota_disburse t2 ON t1.id = t2.c_financing_basic_info_id
            LEFT JOIN review_master_contract t3 ON t2.id = t3.review_quota_disburse_id
            LEFT JOIN c_enterprise t4 ON t4.id = t1.supplier_id
            LEFT JOIN c_enterprise t5 ON t5.id = t1.enterprise_customer_info_id
            LEFT JOIN trading_platform t6 ON t1.trading_platform_id = t6.id
            LEFT JOIN t_dictionary t7 ON t1.current_stage = t7.code
            LEFT JOIN t_dictionary t8 ON t1.financing_status = t8.code
    </select>
</mapper>
