<?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.unis.enterpriseCreditManagement.info.modular.ecmCreditData.mapper.EcmCreditDataMapper">
    <select id="selectMyMapsPage" resultType="com.unis.enterpriseCreditManagement.info.modular.ecmCreditData.entity.vo.EcmCreditDataVo">
        SELECT
        a.id,
        a.unit_info_id,
        b.dwmc AS unitName,
        b.dwdm,
        b.fddbr,
        a.credit_level,
        a.assess_result,
        a.assess_result_depict,
        a.is_open,
        a.is_share,
        a.create_time,
        a.update_time
        FROM
        biz_ecm_credit_data a
        INNER JOIN biz_unit_info b ON a.unit_info_id = b.id
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where  ${ew.sqlSegment}
        </if>
        ORDER BY a.update_time desc
    </select>
    <select id="getUnitList" resultType="com.unis.enterpriseCreditManagement.info.modular.ecmCreditData.entity.vo.EcmCreditDataVo">
      SELECT
        a.id as unit_info_id,
        a.dwmc AS "unitName",
        a.dwdm,
        a.dwlx,
        c.DICT_LABEL AS "dwlxName",
        a.fddbr,
        a.frlxfs,
        a.dzyx,
        DATE_FORMAT(a.zcrq, '%Y-%m-%d') AS zcrq,
        a.zcdz,
        a.zczb
    FROM
        biz_unit_info a
    LEFT JOIN biz_ecm_credit_data b ON a.id = b.unit_info_id
    LEFT JOIN dev_dict c ON a.dwlx = c.id
    WHERE
        b.id IS NULL
    AND a.delete_flag = 'NOT_DELETE'
    ORDER BY	a.create_time
    </select>
    <select id="detail" resultType="com.unis.enterpriseCreditManagement.info.modular.ecmCreditData.entity.vo.EcmCreditDataVo">
     SELECT
a.id AS unit_info_id,
a.dwmc AS unitName,
a.dwdm,
a.dwlx,
c.DICT_LABEL AS dwlxName,
a.fddbr,
a.frlxfs,
a.dzyx,
DATE_FORMAT(a.zcrq, '%Y-%m-%d') AS zcrq,
a.zcdz,
a.zczb,
b.id,
b.create_time,
b.create_user,
b.update_time,
b.update_user,
b.unit_info_id,
b.credit_score,
b.credit_level,
b.fulfilment_times,
b.breach_times,
b.evaluation_unit,
b.administrative_penalty_info,
b.business_abnormal_info,
b.illegal_dishonesty_info,
b.assess_result,
b.assess_result_depict,
b.is_open,
b.is_share
FROM
        biz_unit_info a
    inner JOIN biz_ecm_credit_data b ON a.id = b.unit_info_id
    LEFT JOIN dev_dict c ON a.dwlx = c.id
WHERE
        b.id  = #{id}
    </select>
</mapper>