<?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.policy.info.modular.sqrEnterprise.mapper.SqrEnterpriseMapper">

    <select id="selectSqrEnterpriseVO"
            resultType="com.unis.policy.info.modular.auditRequest.vo.SqrEnterpriseVO">
        select t1.*, t2.dwmc, t2.dwdm, t2.zcdz, t2.fddbr
        from biz_sqr_enterprise t1
                 join biz_unit_info t2 on t1.unit_info_id = t2.id
        where t1.`status` = '1'
          and t2.delete_flag = 'NOT_DELETE' and t1.id=#{id}

    </select>
    <select id="enterpriseInfo" resultType="com.unis.policy.info.modular.auditRequest.vo.SqrEnterpriseVO">
        select t1.*, t2.dwmc, t2.dwdm, t2.zcdz, t2.fddbr, t2.cfs, t2.ygs,t3.DICT_LABEL dwlx
        from biz_sqr_enterprise t1
                 left join biz_unit_info t2 on t1.unit_info_id = t2.id
                 left join dev_dict t3 on t3.id = t2.dwlx
        where t2.delete_flag = 'NOT_DELETE'
          and t1.id = #{id}
    </select>

    <select id="page" resultType="com.unis.policy.info.modular.auditRequest.vo.SqrEnterpriseVO">
        SELECT A.dwmc,
               A.id  unitInfoId,
               A.dwdm,
               A.fddbr,
               A.zcdz,
               A.cfs,
               A.ygs,
               A.DICT_LABEL dictLabel,
               bse.certified_storekeeper_count,
               bse.certified_inspector_count,
               bse.warehouse_facility_situation,
               bse.full_time_staff_count,
               bse.storage_expire_time,
               bse.attachment attachment,
               bse.id
        FROM province_all.biz_sqr_enterprise bse
                 LEFT JOIN (select bui.id,
                                   bui.dwmc,
                                   bui.dwdm,
                                   bui.fddbr,
                                   bui.dwlx,
                                   bui.zcdz,
                                   bui.cfs,
                                   bui.ygs,
                                   dict.DICT_LABEL
                            from province_all.biz_unit_info bui
                                     left join province_all.dev_dict dict on bui.dwlx = dict.id
        ) A ON bse.unit_info_id = A.id
        where bse.status=2

    </select>


</mapper>