ZeroLiYi hai 1 ano
pai
achega
8caaf07e5f

+ 13 - 28
src/main/java/com/chinaitop/depot/sqr/mapper/BizSqrEnterpriseApplyMapper.xml

@@ -108,35 +108,20 @@
108 108
 
109 109
     </select>
110 110
     <select id="findById" resultType="Map" resultMap="BaseResultMap">
111
-        SELECT DISTINCT
112
-            bui.dwmc,
113
-            bui.id unitInfoId,
114
-            bui.dwdm,
115
-            bui.fddbr,
116
-            bui.dwlx,
117
-            bui.zcdz,
118
-            bui.cfs,
119
-            bui.ygs,
120
-            dict.DICT_LABEL,
121
-            bse.certified_storekeeper_count,
122
-            bse.certified_inspector_count,
123
-            bse.warehouse_facility_situation,
124
-            bse.full_time_staff_count,
125
-            bse.storage_expire_time,
126
-            bse.attachment attachment,
127
-            SUM(oi.depot_area) depotArea,
128
-            SUM(bs.actual_capacity)actualCapacity,
129
-            bgqa.apply_status,bgqa.apply_type,bgqa.id
111
+        SELECT
112
+        bgqa.id, A.dwmc,A.id unitInfoId, A.dwdm,A.fddbr,A.dwlx,A.zcdz,A.cfs,A.ygs,A.DICT_LABEL,bgqa.apply_status,bgqa.apply_type,
113
+        bse.certified_storekeeper_count ,bse.certified_inspector_count ,bse.warehouse_facility_situation ,
114
+        bse.full_time_staff_count ,bgqa.storage_expire_time ,bgqa.attachment attachment,bgqa.sqr_enterprise_id
130 115
         FROM
131
-            province_all.biz_unit_info bui
132
-                LEFT JOIN province_all.dev_dict dict ON bui.dwlx = dict.id
133
-                LEFT JOIN province_all.biz_sqr_enterprise bse ON bse.unit_info_id = bui.id
134
-                left join province_all.biz_sqr_enterprise_apply bgqa  on bgqa.sqr_enterprise_id =bse.id
135
-                left join depot_qh.org_info oi on oi.unit_info_id=bui.id
136
-                left join depot_qh.basic_storehouse bs on bs.org_id=oi.org_id
137
-        WHERE
138
-            bui.delete_flag = 'NOT_DELETE'
139
-            and bui.id =#{unitInfoId,jdbcType=VARCHAR}
116
+        province_all.biz_sqr_enterprise_apply bgqa
117
+        left join province_all.biz_sqr_enterprise  bse on bgqa.sqr_enterprise_id =bse.id
118
+        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
119
+        <if test="unitInfoId != null and unitInfoId != ''">
120
+            where bui.id =#{unitInfoId,jdbcType=VARCHAR}
121
+        </if>
122
+
123
+        )A  on bgqa.unit_info_id = A.id
124
+        where bgqa.id=#{id,jdbcType=INTEGER} and bgqa.apply_type=#{applyType,jdbcType=INTEGER}
140 125
     </select>
141 126
 
142 127
     <select id="findById1" resultType="Map" resultMap="BaseResultMap">