ZeroLiYi преди 1 година
родител
ревизия
433b0eb81e
променени са 1 файла, в които са добавени 62 реда и са изтрити 29 реда
  1. 62 29
      src/main/java/com/chinaitop/depot/sqr/mapper/BizSqrEnterpriseMapper.xml

+ 62 - 29
src/main/java/com/chinaitop/depot/sqr/mapper/BizSqrEnterpriseMapper.xml

@@ -102,35 +102,68 @@
102 102
 
103 103
 
104 104
    <select id="findById" parameterType="java.lang.String" resultMap="BaseResultMap">
105
-   		SELECT A.dwmc,
106
-               A.id  unitInfoId,
107
-               A.dwdm,
108
-               A.fddbr,
109
-               A.dwlx,
110
-               A.zcdz,
111
-               A.cfs,
112
-               A.ygs,
113
-               A.DICT_LABEL,
114
-               bse.certified_storekeeper_count,
115
-               bse.certified_inspector_count,
116
-               bse.warehouse_facility_situation,
117
-               bse.full_time_staff_count,
118
-               bse.storage_expire_time,
119
-               bse.attachment attachment,
120
-               bse.id
121
-        FROM province_all.biz_sqr_enterprise bse
122
-                 LEFT JOIN (select bui.id,
123
-                             bui.dwmc,
124
-                             bui.dwdm,
125
-                             bui.fddbr,
126
-                             bui.dwlx,
127
-                             bui.zcdz,
128
-                             bui.cfs,
129
-                             bui.ygs,
130
-                             dict.DICT_LABEL
131
-                      from province_all.biz_unit_info bui
132
-                               left join province_all.dev_dict dict on bui.dwlx = dict.id
133
-        ) A ON bse.unit_info_id = A.id where bse.status in(2,3)   and A.id = #{id}
105
+--    		SELECT A.dwmc,
106
+--                A.id  unitInfoId,
107
+--                A.dwdm,
108
+--                A.fddbr,
109
+--                A.dwlx,
110
+--                A.zcdz,
111
+--                A.cfs,
112
+--                A.ygs,
113
+--                A.DICT_LABEL,
114
+--                bse.certified_storekeeper_count,
115
+--                bse.certified_inspector_count,
116
+--                bse.warehouse_facility_situation,
117
+--                bse.full_time_staff_count,
118
+--                bse.storage_expire_time,
119
+--                bse.attachment attachment,
120
+--                SUM(oi.depot_area) depotArea,
121
+--                SUM(bs.actual_capacity)actualCapacity,
122
+--                bse.id
123
+--         FROM province_all.biz_sqr_enterprise bse
124
+--                  LEFT JOIN (select bui.id,
125
+--                              bui.dwmc,
126
+--                              bui.dwdm,
127
+--                              bui.fddbr,
128
+--                              bui.dwlx,
129
+--                              bui.zcdz,
130
+--                              bui.cfs,
131
+--                              bui.ygs,
132
+--                              dict.DICT_LABEL
133
+--                       from province_all.biz_unit_info bui
134
+--                                left join province_all.dev_dict dict on bui.dwlx = dict.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
+--         ) A ON bse.unit_info_id = A.id where bse.status in(2,3)   and A.id = #{id}
138
+
139
+SELECT DISTINCT
140
+    bui.dwmc,
141
+    bui.id unitInfoId,
142
+    bui.dwdm,
143
+    bui.fddbr,
144
+    bui.dwlx,
145
+    bui.zcdz,
146
+    bui.cfs,
147
+    bui.ygs,
148
+    dict.DICT_LABEL,
149
+    bse.certified_storekeeper_count,
150
+    bse.certified_inspector_count,
151
+    bse.warehouse_facility_situation,
152
+    bse.full_time_staff_count,
153
+    bse.storage_expire_time,
154
+    bse.attachment attachment,
155
+    SUM(oi.depot_area) depotArea,
156
+    SUM(bs.actual_capacity)actualCapacity,
157
+    bse.id
158
+FROM
159
+    province_all.biz_unit_info bui
160
+        LEFT JOIN province_all.dev_dict dict ON bui.dwlx = dict.id
161
+        LEFT JOIN province_all.biz_sqr_enterprise bse ON bse.unit_info_id = bui.id
162
+        left join depot_qh.org_info oi on oi.unit_info_id=bui.id
163
+        left join depot_qh.basic_storehouse bs on bs.org_id=oi.org_id
164
+WHERE
165
+    bui.delete_flag = 'NOT_DELETE' and bse.`status`in(2,3)
166
+  and bui.id =#{id}
134 167
    </select>
135 168
 
136 169
 </mapper>