lv.wenbin 9 months ago
parent
commit
a1b288c5bd

+ 9 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecUseHMapper.xml

@@ -78,6 +78,10 @@
                 WHEN u.obj_type = 2 THEN d.device_name
               END as obj_name,
             </if>
+            <if test="(facsCategory != null  and facsCategory != '') or (facsSubCategory != null  and facsSubCategory != '')">
+                fa.facs_category,
+                fa.facs_subcategory,
+            </if>
             u.`record_time`,
             u.`date`,
             u.`time`,
@@ -87,6 +91,9 @@
             <if test="areaCode != null and areaCode != ''">
               LEFT JOIN adm_service_area a ON u.`area_code` = a.`area_code`
             </if>
+            <if test="(facsCategory != null  and facsCategory != '') or (facsSubCategory != null  and facsSubCategory != '')">
+              LEFT JOIN adm_ems_facs fa ON u.`obj_code` = fa.`facs_code`
+            </if>
             <if test="objCode != null  and objCode != ''">
               LEFT JOIN adm_ems_facs f ON u.`obj_code` = f.`facs_code`
               LEFT JOIN adm_ems_device d ON u.`obj_code` = d.`device_code`
@@ -94,6 +101,8 @@
         <where>
             <if test="areaCode != null and areaCode != ''">and u.area_code = #{areaCode}</if>
             <if test="objCode != null  and objCode != ''">and u.obj_code = #{objCode}</if>
+            <if test="facsCategory != null  and facsCategory != ''">and fa.facs_category = #{facsCategory}</if>
+            <if test="facsSubCategory != null  and facsSubCategory != ''">and fa.facs_subcategory = #{facsSubCategory}</if>
         </where>
         GROUP BY
             u.`date`,