Browse Source

区域模型变更

lv.wenbin 8 months ago
parent
commit
0a4e4f133f
23 changed files with 558 additions and 503 deletions
  1. 82 24
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java
  2. 41 31
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceController.java
  3. 2 7
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/Area.java
  4. 14 3
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ObjTagRel.java
  5. 12 2
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaMapper.java
  6. 5 26
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/model/QueryDevice.java
  7. 0 32
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/model/TreeEntity.java
  8. 1 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingService.java
  9. 1 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingZoningService.java
  10. 1 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaOldService.java
  11. 28 1
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java
  12. 10 3
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaAttrServiceImpl.java
  13. 1 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingServiceImpl.java
  14. 1 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingZoningServiceImpl.java
  15. 105 102
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaOldServiceImpl.java
  16. 65 4
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java
  17. 27 111
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsDeviceServiceImpl.java
  18. 4 4
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java
  19. 13 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaMapper.xml
  20. 9 34
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml
  21. 11 4
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ObjTagRelMapper.xml
  22. 125 113
      ems-cloud/sql/ems_init_data.sql
  23. 0 2
      ems-cloud/sql/ems_server.sql

+ 82 - 24
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java

@@ -1,7 +1,12 @@
 package com.ruoyi.ems.controller;
 
+import java.util.ArrayList;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.ems.domain.AreaOld;
+import com.ruoyi.ems.model.TreeEntity;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -10,6 +15,7 @@ import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
@@ -22,14 +28,13 @@ import com.ruoyi.common.core.utils.poi.ExcelUtil;
 
 /**
  * 区域对象Controller
- * 
+ *
  * @author ruoyi
  * @date 2024-11-01
  */
 @RestController
 @RequestMapping("/basecfg/area")
-public class AreaController extends BaseController
-{
+public class AreaController extends BaseController {
     @Autowired
     private IAreaService areaService;
 
@@ -38,23 +43,40 @@ public class AreaController extends BaseController
      */
     @RequiresPermissions("ems:area:list")
     @GetMapping("/list")
-    public AjaxResult list(Area area)
-    {
-        List<Area> list = areaService.selectAreaList(area);
+    public AjaxResult list(Area area) {
+        List<Area> list = areaService.selectArea(area);
         return success(list);
     }
 
     /**
-     * 导出区域对象列表
+     * 获取服务区树
+     *
+     * @param rootCode 根节点编码
+     * @return 区域位置树
      */
-    @RequiresPermissions("ems:area:export")
-    @Log(title = "区域对象", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, Area area)
-    {
-        List<Area> list = areaService.selectAreaList(area);
-        ExcelUtil<Area> util = new ExcelUtil<Area>(Area.class);
-        util.exportExcel(response, list, "区域对象数据");
+    @GetMapping(value = "/areaTree")
+    public AjaxResult getAreaTree(@RequestParam(name = "recursion", required = false) boolean recursion,
+        @RequestParam(name = "rootCode") String rootCode) {
+        List<Area> areas = areaService.selectAreaTree(recursion, rootCode);
+        List<TreeEntity> ret = convertAreaTree(areas);
+        return success(ret);
+    }
+
+    /**
+     * 查询服务区列表 (根据下挂设施)
+     *
+     * @param facsCategory    设施类别
+     * @param facsSubCategory 设施子类别
+     */
+    @GetMapping("/listWithFacsCategoryAsTree")
+    public AjaxResult listWithFacsCategoryAsTree(
+        @RequestParam(name = "parentCode", required = false, defaultValue = "0") String parentCode,
+        @RequestParam(name = "facsCategory") String facsCategory,
+        @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory,
+        @RequestParam(name = "recursion", required = false) boolean recursion) {
+
+        List<TreeEntity> retList = recursionAreaWithCategory(parentCode, facsCategory, facsSubCategory, recursion);
+        return success(retList);
     }
 
     /**
@@ -62,8 +84,7 @@ public class AreaController extends BaseController
      */
     @RequiresPermissions("ems:area:query")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(areaService.selectAreaById(id));
     }
 
@@ -73,8 +94,7 @@ public class AreaController extends BaseController
     @RequiresPermissions("ems:area:add")
     @Log(title = "区域对象", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody Area area)
-    {
+    public AjaxResult add(@RequestBody Area area) {
         return toAjax(areaService.insertArea(area));
     }
 
@@ -84,8 +104,7 @@ public class AreaController extends BaseController
     @RequiresPermissions("ems:area:edit")
     @Log(title = "区域对象", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody Area area)
-    {
+    public AjaxResult edit(@RequestBody Area area) {
         return toAjax(areaService.updateArea(area));
     }
 
@@ -94,9 +113,48 @@ public class AreaController extends BaseController
      */
     @RequiresPermissions("ems:area:remove")
     @Log(title = "区域对象", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(areaService.deleteAreaByIds(ids));
     }
+
+    public List<TreeEntity> recursionAreaWithCategory(String parentCode, String facsCategory, String facsSubCategory,
+        boolean recursion) {
+        List<TreeEntity> retList = new ArrayList<>();
+        List<Area> areas = areaService.selectWithFacsCategory(parentCode, facsCategory, facsSubCategory);
+
+        for (Area area : areas) {
+            TreeEntity tree = new TreeEntity();
+            tree.setId(area.getAreaCode());
+            tree.setLabel(area.getAreaName());
+
+            if (recursion) {
+                tree.setChildren(
+                    recursionAreaWithCategory(area.getAreaCode(), facsCategory, facsSubCategory, recursion));
+            }
+
+            retList.add(tree);
+        }
+
+        return retList;
+    }
+
+    public List<TreeEntity> convertAreaTree(List<?> areas) {
+        List<TreeEntity> retList = new ArrayList<>();
+
+        for (Object obj : areas) {
+            Area area = (Area) obj;
+            TreeEntity tree = new TreeEntity();
+            tree.setId(area.getAreaCode());
+            tree.setLabel(area.getAreaName());
+
+            if (CollectionUtils.isNotEmpty(area.getChildren())) {
+                tree.setChildren(convertAreaTree(area.getChildren()));
+            }
+
+            retList.add(tree);
+        }
+
+        return retList;
+    }
 }

+ 41 - 31
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceController.java

@@ -1,10 +1,18 @@
 package com.ruoyi.ems.controller;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
 import javax.servlet.http.HttpServletResponse;
 
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.common.core.constant.HttpStatus;
+import com.ruoyi.common.core.exception.Assert;
+import com.ruoyi.common.core.exception.BusinessException;
+import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.model.TreeEntity;
+import com.ruoyi.ems.service.IAreaService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -54,10 +62,7 @@ public class DeviceController extends BaseController {
     private IEmsFacsService facsService;
 
     @Autowired
-    private IAreaBuildingService buildingService;
-
-    @Autowired
-    private IAreaBuildingZoningService zoningService;
+    private IAreaService areaService;
 
     /**
      * 查询能源设备列表
@@ -98,41 +103,34 @@ public class DeviceController extends BaseController {
     }
 
     /**
-     * 递归查询 区域/建筑/区块 下的设备(分页)
+     * 递归查询 区域 下的设备(分页)
      */
     @RequiresPermissions("basecfg:device:list")
     @GetMapping("/listRecursionByArea")
     public TableDataInfo listRecursionByArea(QueryDevice queryDevice) {
-        // 层级为区域 (建筑->区块)
-        if (StringUtils.equals(queryDevice.getLocationType(), AreaTier.Area.name()) && StringUtils.isNotBlank(
-            queryDevice.getLocationRef())) {
-            List<AreaBuilding> buildings = buildingService.selectBuildingByAreaCode(queryDevice.getLocationRef());
-            List<String> buildingCodes = buildings.stream().map(AreaBuilding::getBldgCode).collect(Collectors.toList());
-
-            if (CollectionUtils.isNotEmpty(buildings)) {
-                // 回填建筑codes
-                queryDevice.setBuildingCodes(buildingCodes);
-
-                List<AreaBuildingZoning> zonings = zoningService.selectZoningByBuildings(buildingCodes);
-                List<String> zoningCodes = zonings.stream().map(AreaBuildingZoning::getZoningCode)
-                    .collect(Collectors.toList());
-                // 回填区块codes
-                queryDevice.setZoningCodes(CollectionUtils.isNotEmpty(zoningCodes) ? zoningCodes : null);
+        TableDataInfo tabInfo = null;
+
+        try {
+            if (StringUtils.isNotEmpty(queryDevice.getLocationRef())) {
+                List<Area> areaTree = areaService.selectAreaTree(true, queryDevice.getLocationRef());
+                List<String> areaCodes = new ArrayList<>();
+                areaCodes.add(queryDevice.getLocationRef());
+                // 递归添加区域子节点(子节点关联设备一并取出)
+                fillCodeRecursion(areaTree, areaCodes);
+                queryDevice.setAreaCodes(areaCodes);
             }
+
+            startPage();
+            List<EmsDevice> list = deviceService.selectByAreaTree(queryDevice);
+            tabInfo = getDataTable(list);
         }
-        // 层级为建筑 (区块)
-        else if (StringUtils.equals(queryDevice.getLocationType(), AreaTier.Building.name()) && StringUtils.isNotBlank(
-            queryDevice.getLocationRef())) {
-            List<AreaBuildingZoning> list = zoningService.selectZoningByBuilding(queryDevice.getLocationRef());
-            List<String> zoningCodes = list.stream().map(AreaBuildingZoning::getZoningCode)
-                .collect(Collectors.toList());
-            // 回填区块codes
-            queryDevice.setZoningCodes(CollectionUtils.isNotEmpty(zoningCodes) ? zoningCodes : null);
+        catch (BusinessException e) {
+            tabInfo = new TableDataInfo();
+            tabInfo.setCode(e.getCode());
+            tabInfo.setMsg(e.getMessage());
         }
 
-        startPage();
-        List<EmsDevice> list = deviceService.selectByAreaTree(queryDevice);
-        return getDataTable(list);
+        return tabInfo;
     }
 
     /**
@@ -223,4 +221,16 @@ public class DeviceController extends BaseController {
     public AjaxResult getDeviceOnlineSummary(@RequestParam("areaCode") String areaCode) {
         return success(deviceService.calcDeviceOnlineSummary(areaCode));
     }
+
+    private <T> void fillCodeRecursion(List<T> areaTree, List<String> areaCodes) {
+        if (CollectionUtils.isNotEmpty(areaTree)) {
+            for (T t : areaTree) {
+                Area area = (Area) t;
+                areaCodes.add(area.getAreaCode());
+                if (CollectionUtils.isNotEmpty(area.getChildren())) {
+                    fillCodeRecursion(area.getChildren(), areaCodes);
+                }
+            }
+        }
+    }
 }

+ 2 - 7
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/Area.java

@@ -1,10 +1,11 @@
 package com.ruoyi.ems.domain;
 
-import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.TreeEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.util.List;
+
 /**
  * 区域对象对象 adm_area
  *
@@ -19,27 +20,21 @@ public class Area extends TreeEntity
     private Long id;
 
     /** 区域代码 */
-    @Excel(name = "区域代码")
     private String areaCode;
 
     /** 上级区域代码 */
-    @Excel(name = "上级区域代码")
     private String parentCode;
 
     /** 区域名称 */
-    @Excel(name = "区域名称")
     private String areaName;
 
     /** 区域简称 */
-    @Excel(name = "区域简称")
     private String shortName;
 
     /** 区域简称 */
-    @Excel(name = "区域简称")
     private String desc;
 
     /** 区域状态 */
-    @Excel(name = "区域状态")
     private Integer status;
 
     /**

+ 14 - 3
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ObjTagRel.java

@@ -14,15 +14,17 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
 public class ObjTagRel
 {
     /** 标签类型 */
-    @Excel(name = "标签类型")
     private Integer tagType;
 
     /** 标签代码 */
-    @Excel(name = "标签代码")
     private String tagCode;
 
+    /**
+     * 标签名称
+     */
+    private String tagName;
+
     /** 对象代码 */
-    @Excel(name = "对象代码")
     private String objCode;
 
     public ObjTagRel(){
@@ -62,12 +64,21 @@ public class ObjTagRel
         return objCode;
     }
 
+    public String getTagName() {
+        return tagName;
+    }
+
+    public void setTagName(String tagName) {
+        this.tagName = tagName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("tagType", getTagType())
             .append("tagCode", getTagCode())
             .append("objCode", getObjCode())
+            .append("tagName", getTagName())
             .toString();
     }
 }

+ 12 - 2
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaMapper.java

@@ -1,8 +1,9 @@
 package com.ruoyi.ems.mapper;
 
-import java.util.List;
-
 import com.ruoyi.ems.domain.Area;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 区域对象Mapper接口
@@ -36,6 +37,15 @@ public interface AreaMapper {
     List<Area> selectAreaList(Area admArea);
 
     /**
+     * 查询服务区列表(根据下挂设施)
+     *
+     * @param facsCategory    设施类别
+     * @param facsSubCategory 设施子类别
+     */
+    List<Area> selectWithFacsCategory(@Param("parentCode") String parentCode,
+        @Param("facsCategory") String facsCategory, @Param("facsSubCategory") String facsSubCategory);
+
+    /**
      * 新增区域对象
      *
      * @param admArea 区域对象

+ 5 - 26
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/model/QueryDevice.java

@@ -39,9 +39,6 @@ public class QueryDevice {
 
     private String refFacs;
 
-    /** 位置层级 */
-    private String locationType;
-
     /** 位置关联 */
     private String locationRef;
 
@@ -65,9 +62,7 @@ public class QueryDevice {
 
     private String upstreamObjCode;
 
-    private List<String> buildingCodes;
-
-    private List<String> zoningCodes;
+    private List<String> areaCodes;
 
     public String getDeviceCode() {
         return deviceCode;
@@ -117,14 +112,6 @@ public class QueryDevice {
         this.refFacs = refFacs;
     }
 
-    public String getLocationType() {
-        return locationType;
-    }
-
-    public void setLocationType(String locationType) {
-        this.locationType = locationType;
-    }
-
     public String getLocationRef() {
         return locationRef;
     }
@@ -189,19 +176,11 @@ public class QueryDevice {
         this.upstreamObjCode = upstreamObjCode;
     }
 
-    public List<String> getBuildingCodes() {
-        return buildingCodes;
-    }
-
-    public void setBuildingCodes(List<String> buildingCodes) {
-        this.buildingCodes = buildingCodes;
-    }
-
-    public List<String> getZoningCodes() {
-        return zoningCodes;
+    public List<String> getAreaCodes() {
+        return areaCodes;
     }
 
-    public void setZoningCodes(List<String> zoningCodes) {
-        this.zoningCodes = zoningCodes;
+    public void setAreaCodes(List<String> areaCodes) {
+        this.areaCodes = areaCodes;
     }
 }

+ 0 - 32
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/model/TreeEntity.java

@@ -11,11 +11,7 @@
 package com.ruoyi.ems.model;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.domain.EmsCls;
-import com.ruoyi.common.core.enums.AreaTier;
 
 import java.util.List;
 
@@ -39,8 +35,6 @@ public class TreeEntity {
      */
     private String label;
 
-    private String tier;
-
     /**
      * 子节点
      */
@@ -51,24 +45,6 @@ public class TreeEntity {
 
     }
 
-    public TreeEntity(AreaOld area) {
-        this.id = area.getAreaCode();
-        this.label = area.getAreaName();
-        this.tier = AreaTier.Area.name();
-    }
-
-    public TreeEntity(AreaBuilding building) {
-        this.id = building.getBldgCode();
-        this.label = building.getBldgName();
-        this.tier = AreaTier.Building.name();
-    }
-
-    public TreeEntity(AreaBuildingZoning buildingZoning) {
-        this.id = buildingZoning.getZoningCode();
-        this.label = buildingZoning.getZoningName();
-        this.tier = AreaTier.Zoning.name();
-    }
-
     public TreeEntity(EmsCls emsCls) {
         this.id = emsCls.getCode();
         this.label = emsCls.getName();
@@ -90,14 +66,6 @@ public class TreeEntity {
         this.label = label;
     }
 
-    public String getTier() {
-        return tier;
-    }
-
-    public void setTier(String tier) {
-        this.tier = tier;
-    }
-
     public List<TreeEntity> getChildren() {
         return children;
     }

+ 1 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingService.java

@@ -10,6 +10,7 @@ import java.util.List;
  * @author ruoyi
  * @date 2024-07-09
  */
+@Deprecated
 public interface IAreaBuildingService {
     /**
      * 查询建筑基本信息

+ 1 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingZoningService.java

@@ -11,6 +11,7 @@ import com.ruoyi.ems.domain.AreaBuildingZoning;
  * @author ruoyi
  * @date 2024-07-09
  */
+@Deprecated
 public interface IAreaBuildingZoningService {
     /**
      * 查询建筑区域划分

+ 1 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaOldService.java

@@ -11,6 +11,7 @@ import com.ruoyi.ems.model.TreeEntity;
  * @author ruoyi
  * @date 2024-07-09
  */
+@Deprecated
 public interface IAreaOldService {
     /**
      * 查询服务区

+ 28 - 1
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java

@@ -3,6 +3,7 @@ package com.ruoyi.ems.service;
 import java.util.List;
 
 import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.model.TreeEntity;
 
 /**
  * 区域对象Service接口
@@ -20,12 +21,38 @@ public interface IAreaService {
     Area selectAreaById(Long id);
 
     /**
+     * 查询服务区列表(根据下挂设施)
+     *
+     * @param parentCode      上级区域
+     * @param facsCategory    设施类型
+     * @param facsSubCategory 设施子类型
+     */
+    List<Area> selectWithFacsCategory(String parentCode, String facsCategory, String facsSubCategory);
+
+    /**
+     * 查询区域位置树
+     *
+     * @param recursion 是否递归
+     * @param parentCode 上级代码
+     * @return 区域位置树
+     */
+    List<Area> selectAreaTree(boolean recursion, String parentCode);
+
+    /**
+     * 查询区域对象列表
+     *
+     * @param area 区域对象
+     * @return 区域对象集合
+     */
+    List<Area> selectArea(Area area);
+
+    /**
      * 查询区域对象列表
      *
      * @param area 区域对象
      * @return 区域对象集合
      */
-    List<Area> selectAreaList(Area area);
+    List<Area> selectAreaDetail(Area area);
 
     /**
      * 新增区域对象

+ 10 - 3
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaAttrServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ems.service.impl;
 
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.ems.domain.AreaAttr;
 import com.ruoyi.ems.domain.ObjTagRel;
 import com.ruoyi.ems.mapper.AreaAttrMapper;
@@ -36,13 +37,13 @@ public class AreaAttrServiceImpl implements IAreaAttrService {
             fillExt(areaAttr);
         }
 
-        return areaAttrMapper.selectAreaAttrByCode(areaCode);
+        return areaAttr;
     }
 
     @Override
     public List<AreaAttr> selectAreaAttrList(List<String> areaCodes) {
         List<AreaAttr> list = areaAttrMapper.selectAreaAttrList(areaCodes);
-        fillExtBatch(areaCodes, list);
+        fillExtBatch(list);
         return list;
     }
 
@@ -84,11 +85,14 @@ public class AreaAttrServiceImpl implements IAreaAttrService {
 
         if (CollectionUtils.isNotEmpty(tagRel)) {
             List<String> tagCodes = tagRel.stream().map(ObjTagRel::getTagCode).collect(Collectors.toList());
+            List<String> tagNames = tagRel.stream().map(ObjTagRel::getTagName).collect(Collectors.toList());
             areaAttr.setTagCodeList(tagCodes);
+            areaAttr.setTagCodes(StringUtils.join(tagCodes, ","));
+            areaAttr.setTagNames(StringUtils.join(tagNames, ","));
         }
     }
 
-    private void fillExtBatch(List<String> areaCodes, List<AreaAttr> list) {
+    private void fillExtBatch(List<AreaAttr> list) {
         List<ObjTagRel> tagRel = tagRelService.selectListByType(1);
         Map<String, List<ObjTagRel>> tagRelMap = tagRel.stream()
             .collect(Collectors.groupingBy(ObjTagRel::getObjCode));
@@ -97,7 +101,10 @@ public class AreaAttrServiceImpl implements IAreaAttrService {
             if (tagRelMap.containsKey(areaAttr.getAreaCode())) {
                 List<ObjTagRel> relLists = tagRelMap.get(areaAttr.getAreaCode());
                 List<String> tagCodes = relLists.stream().map(ObjTagRel::getTagCode).collect(Collectors.toList());
+                List<String> tagNames = relLists.stream().map(ObjTagRel::getTagName).collect(Collectors.toList());
                 areaAttr.setTagCodeList(tagCodes);
+                areaAttr.setTagCodes(StringUtils.join(tagCodes, ","));
+                areaAttr.setTagNames(StringUtils.join(tagNames, ","));
             }
         }
     }

+ 1 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingServiceImpl.java

@@ -15,6 +15,7 @@ import java.util.List;
  * @author ruoyi
  * @date 2024-07-09
  */
+@Deprecated
 @Service
 public class AreaBuildingServiceImpl implements IAreaBuildingService {
     @Autowired

+ 1 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingZoningServiceImpl.java

@@ -26,6 +26,7 @@ import java.util.stream.Collectors;
  * @author ruoyi
  * @date 2024-07-09
  */
+@Deprecated
 @Service
 public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService {
     @Autowired

+ 105 - 102
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaOldServiceImpl.java

@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
  * @author ruoyi
  * @date 2024-07-09
  */
+@Deprecated
 @Service
 public class AreaOldServiceImpl implements IAreaOldService {
     @Autowired
@@ -133,24 +134,24 @@ public class AreaOldServiceImpl implements IAreaOldService {
     public List<TreeEntity> selectAreaTreeList(String tier) {
         List<TreeEntity> entities = null;
 
-        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-        }
-        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
-            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-            entities.forEach(area -> area.setChildren(getAreaBuilding(area.getId())));
-        }
-        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
-            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-            entities.forEach(area -> {
-                List<TreeEntity> buildings = getAreaBuilding(area.getId());
-                buildings.forEach(building -> building.setChildren(getBuildingZoning(building.getId(), null)));
-                area.setChildren(buildings);
-            });
-        }
+//        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
+//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
+//            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+//        }
+//        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
+//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
+//            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+//            entities.forEach(area -> area.setChildren(getAreaBuilding(area.getId())));
+//        }
+//        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
+//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
+//            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+//            entities.forEach(area -> {
+//                List<TreeEntity> buildings = getAreaBuilding(area.getId());
+//                buildings.forEach(building -> building.setChildren(getBuildingZoning(building.getId(), null)));
+//                area.setChildren(buildings);
+//            });
+//        }
 
         return entities;
     }
@@ -159,36 +160,36 @@ public class AreaOldServiceImpl implements IAreaOldService {
     public List<TreeEntity> selectAreaTreeByCode(String tier, String code) {
         List<TreeEntity> retList = new ArrayList<>();
 
-        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-            AreaOld area = areaMapper.selectAreaByCode(code);
-
-            if (null != area) {
-                TreeEntity entity = new TreeEntity(area);
-                entity.setChildren(getAreaBuilding(code));
-                entity.getChildren().forEach(building -> {
-                    building.setChildren(getBuildingZoning(building.getId(), null));
-                });
-
-                retList.add(entity);
-            }
-        }
-        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
-            AreaBuilding building = buildingService.selectAreaBuildingByCode(code);
-
-            if (null != building) {
-                TreeEntity entity = new TreeEntity(building);
-                entity.setChildren(getBuildingZoning(building.getBldgCode(), null));
-                retList.add(entity);
-            }
-        }
-        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
-            AreaBuildingZoning zoning = zoningService.selectAreaBuildingZoningByCode(code);
-
-            if (null != zoning) {
-                TreeEntity entity = new TreeEntity(zoning);
-                retList.add(entity);
-            }
-        }
+//        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
+//            AreaOld area = areaMapper.selectAreaByCode(code);
+//
+//            if (null != area) {
+//                TreeEntity entity = new TreeEntity(area);
+//                entity.setChildren(getAreaBuilding(code));
+//                entity.getChildren().forEach(building -> {
+//                    building.setChildren(getBuildingZoning(building.getId(), null));
+//                });
+//
+//                retList.add(entity);
+//            }
+//        }
+//        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
+//            AreaBuilding building = buildingService.selectAreaBuildingByCode(code);
+//
+//            if (null != building) {
+//                TreeEntity entity = new TreeEntity(building);
+//                entity.setChildren(getBuildingZoning(building.getBldgCode(), null));
+//                retList.add(entity);
+//            }
+//        }
+//        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
+//            AreaBuildingZoning zoning = zoningService.selectAreaBuildingZoningByCode(code);
+//
+//            if (null != zoning) {
+//                TreeEntity entity = new TreeEntity(zoning);
+//                retList.add(entity);
+//            }
+//        }
 
         return retList;
     }
@@ -198,51 +199,51 @@ public class AreaOldServiceImpl implements IAreaOldService {
         List<TreeEntity> retList = new ArrayList<>();
         List<String> tagCodes = Arrays.asList(tagCode);
 
-        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-            List<TreeEntity> entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-
-            for (TreeEntity area : entities) {
-                List<TreeEntity> dbBuildings = getAreaBuilding(area.getId());
-                boolean flag = false;
-
-                for (TreeEntity building : dbBuildings) {
-                    List<TreeEntity> zonings = getBuildingZoning(building.getId(), tagCodes);
-
-                    if (CollectionUtils.isNotEmpty(zonings)) {
-                        flag = true;
-                        break;
-                    }
-                }
-
-                if (flag) {
-                    retList.add(area);
-                }
-            }
-        }
-        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
-            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-            List<TreeEntity> entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-
-            for (TreeEntity area : entities) {
-                List<TreeEntity> dbBuildings = getAreaBuilding(area.getId());
-                List<TreeEntity> buildings = new ArrayList<>();
-
-                for (TreeEntity building : dbBuildings) {
-                    List<TreeEntity> zonings = getBuildingZoning(building.getId(), tagCodes);
-
-                    if (CollectionUtils.isNotEmpty(zonings)) {
-                        building.setChildren(zonings);
-                        buildings.add(building);
-                    }
-                }
-
-                if (CollectionUtils.isNotEmpty(buildings)) {
-                    area.setChildren(buildings);
-                    retList.add(area);
-                }
-            }
-        }
+//        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
+//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
+//            List<TreeEntity> entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+//
+//            for (TreeEntity area : entities) {
+//                List<TreeEntity> dbBuildings = getAreaBuilding(area.getId());
+//                boolean flag = false;
+//
+//                for (TreeEntity building : dbBuildings) {
+//                    List<TreeEntity> zonings = getBuildingZoning(building.getId(), tagCodes);
+//
+//                    if (CollectionUtils.isNotEmpty(zonings)) {
+//                        flag = true;
+//                        break;
+//                    }
+//                }
+//
+//                if (flag) {
+//                    retList.add(area);
+//                }
+//            }
+//        }
+//        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
+//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
+//            List<TreeEntity> entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+//
+//            for (TreeEntity area : entities) {
+//                List<TreeEntity> dbBuildings = getAreaBuilding(area.getId());
+//                List<TreeEntity> buildings = new ArrayList<>();
+//
+//                for (TreeEntity building : dbBuildings) {
+//                    List<TreeEntity> zonings = getBuildingZoning(building.getId(), tagCodes);
+//
+//                    if (CollectionUtils.isNotEmpty(zonings)) {
+//                        building.setChildren(zonings);
+//                        buildings.add(building);
+//                    }
+//                }
+//
+//                if (CollectionUtils.isNotEmpty(buildings)) {
+//                    area.setChildren(buildings);
+//                    retList.add(area);
+//                }
+//            }
+//        }
 
         return retList;
     }
@@ -263,17 +264,19 @@ public class AreaOldServiceImpl implements IAreaOldService {
     }
 
     private List<TreeEntity> getAreaBuilding(String areaCode) {
-        AreaBuilding param = new AreaBuilding();
-        param.setAreaCode(areaCode);
-        List<AreaBuilding> areaBuildings = buildingService.selectAreaBuildingList(param);
-        return areaBuildings.stream().map(TreeEntity::new).collect(Collectors.toList());
+//        AreaBuilding param = new AreaBuilding();
+//        param.setAreaCode(areaCode);
+//        List<AreaBuilding> areaBuildings = buildingService.selectAreaBuildingList(param);
+//        return areaBuildings.stream().map(TreeEntity::new).collect(Collectors.toList());
+        return null;
     }
 
     private List<TreeEntity> getBuildingZoning(String buildingCode, List<String> tagCodes) {
-        AreaBuildingZoning param = new AreaBuildingZoning();
-        param.setBldgCode(buildingCode);
-        param.setTagCodeList(tagCodes);
-        List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(param);
-        return zonings.stream().map(TreeEntity::new).collect(Collectors.toList());
+//        AreaBuildingZoning param = new AreaBuildingZoning();
+//        param.setBldgCode(buildingCode);
+//        param.setTagCodeList(tagCodes);
+//        List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(param);
+//        return zonings.stream().map(TreeEntity::new).collect(Collectors.toList());
+        return null;
     }
 }

+ 65 - 4
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java

@@ -2,13 +2,17 @@ package com.ruoyi.ems.service.impl;
 
 import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.AreaAttr;
+import com.ruoyi.ems.domain.OpEnergyStrategyParam;
 import com.ruoyi.ems.mapper.AreaMapper;
+import com.ruoyi.ems.model.TreeEntity;
 import com.ruoyi.ems.service.IAreaAttrService;
 import com.ruoyi.ems.service.IAreaService;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -48,17 +52,43 @@ public class AreaServiceImpl implements IAreaService {
     /**
      * 查询区域对象列表
      *
-     * @param area 区域对象
+     * @param param 区域对象
      * @return 区域对象
      */
     @Override
-    public List<Area> selectAreaList(Area area) {
-        List<Area> list = areaMapper.selectAreaList(area);
-        fillAreaAttr(list);
+    public List<Area> selectArea(Area param) {
+        List<Area> list = areaMapper.selectAreaList(param);
         return list;
     }
 
     /**
+     * 查询区域对象列表&详情
+     *
+     * @param param 区域对象
+     * @return 区域对象
+     */
+    @Override
+    public List<Area> selectAreaDetail(Area param) {
+        List<Area> list = areaMapper.selectAreaList(param);
+
+        if (CollectionUtils.isNotEmpty(list)) {
+            for (Area area : list) {
+                area.setAreaAttr(attrService.selectAreaAttrByCode(area.getAreaCode()));
+            }
+        }
+
+        return list;
+    }
+
+    @Override
+    public List<Area> selectAreaTree(boolean recursion, String parentCode) {
+        List<Area> dbAreas = areaMapper.selectAreaList(new Area());
+        Map<String, List<Area>> areaMap = dbAreas.stream()
+            .collect(Collectors.groupingBy(Area::getParentCode, Collectors.toList()));
+        return recursionBuild(parentCode, recursion, areaMap);
+    }
+
+    /**
      * 新增区域对象
      *
      * @param area 区域对象
@@ -131,6 +161,11 @@ public class AreaServiceImpl implements IAreaService {
         return areaMapper.deleteAreaById(id);
     }
 
+    @Override
+    public List<Area> selectWithFacsCategory(String parentCode, String facsCategory, String facsSubCategory) {
+        return areaMapper.selectWithFacsCategory(parentCode, facsCategory, facsSubCategory);
+    }
+
     private void fillAncestors(Area area) {
         Area parent = areaMapper.selectAreaByCode(area.getParentCode());
 
@@ -152,4 +187,30 @@ public class AreaServiceImpl implements IAreaService {
             area.setAreaAttr(map.get(area.getAreaCode()));
         }
     }
+
+    /**
+     * 递归构建树
+     *
+     * @param areaCode  区域代码
+     * @param parentMap 区域集合
+     * @return List<TreeEntity>
+     */
+    public List<Area> recursionBuild(String areaCode, boolean isRecursion, Map<String, List<Area>> parentMap) {
+        List<Area> retList = null;
+        List<Area> areaList = parentMap.get(areaCode);
+
+        if (CollectionUtils.isNotEmpty(areaList)) {
+            retList = new ArrayList<>();
+
+            for (Area area : areaList) {
+                if (isRecursion) {
+                    area.setChildren(recursionBuild(area.getAreaCode(), isRecursion, parentMap));
+                }
+
+                retList.add(area);
+            }
+        }
+
+        return retList;
+    }
 }

+ 27 - 111
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsDeviceServiceImpl.java

@@ -1,22 +1,18 @@
 package com.ruoyi.ems.service.impl;
 
-import com.ruoyi.common.core.enums.AreaTier;
 import com.ruoyi.common.core.utils.DateUtils;
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.EmsDevice;
-import com.ruoyi.ems.model.QueryDevice;
 import com.ruoyi.ems.mapper.EmsDeviceMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaOldService;
+import com.ruoyi.ems.model.QueryDevice;
+import com.ruoyi.ems.service.IAreaService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -34,13 +30,7 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
     private EmsDeviceMapper emsDeviceMapper;
 
     @Autowired
-    private IAreaOldService areaService;
-
-    @Autowired
-    private IAreaBuildingService buildingService;
-
-    @Autowired
-    private IAreaBuildingZoningService zoningService;
+    private IAreaService areaService;
 
     /**
      * 查询能源设备
@@ -172,114 +162,40 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
      */
     private void fillFieldBath(List<EmsDevice> list) {
         if (CollectionUtils.isNotEmpty(list)) {
-            List<AreaOld> areas = areaService.selectAreaList(new AreaOld());
-            Map<String, AreaOld> areaMap = areas.stream()
-                .collect(Collectors.toMap(AreaOld::getAreaCode, Function.identity()));
-            List<AreaBuilding> buildings = buildingService.selectAreaBuildingList(new AreaBuilding());
-            Map<String, AreaBuilding> buildingMap = buildings.stream()
-                .collect(Collectors.toMap(AreaBuilding::getBldgCode, Function.identity()));
-            List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(new AreaBuildingZoning());
-            Map<String, AreaBuildingZoning> zoningMap = zonings.stream()
-                .collect(Collectors.toMap(AreaBuildingZoning::getZoningCode, Function.identity()));
+            List<Area> areas = areaService.selectArea(new Area());
+            Map<String, Area> areaMap = areas.stream()
+                .collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
 
             for (EmsDevice device : list) {
-                fillAreaName(device, areaMap, buildingMap, zoningMap);
+                fillAreaName(device, areaMap);
             }
         }
     }
 
-    private void fillAreaName(EmsDevice emsDevice, Map<String, AreaOld> areaMap, Map<String, AreaBuilding> buildingMap,
-        Map<String, AreaBuildingZoning> zoningMap) {
-        if (StringUtils.equals(emsDevice.getLocationType(), AreaTier.Area.name())) {
-            AreaOld area = areaMap.get(emsDevice.getLocationRef());
-
-            if (null != area) {
-                emsDevice.setLocationRefName(area.getAreaName());
-                emsDevice.setAreaPath(null != area.getShortName() ? area.getShortName() : area.getAreaName());
-            }
-            else {
-                emsDevice.setLocationRefName("未知");
-                emsDevice.setAreaPath("未知/");
-            }
-        }
-        else if (StringUtils.equals(emsDevice.getLocationType(), AreaTier.Building.name())) {
-            AreaBuilding building = buildingMap.get(emsDevice.getLocationRef());
-
-            if (null != building) {
-                emsDevice.setLocationRefName(building.getBldgName());
-                emsDevice.setAreaPath(building.getAreaShortName() + "/" + building.getBldgName());
-            }
-            else {
-                emsDevice.setLocationRefName("未知");
-                emsDevice.setAreaPath("未知/");
-            }
-        }
-        else if (StringUtils.equals(emsDevice.getLocationType(), AreaTier.Zoning.name())) {
-            AreaBuildingZoning zoning = zoningMap.get(emsDevice.getLocationRef());
-
-            if (null != zoning) {
-                emsDevice.setLocationRefName(zoning.getZoningName());
-
-                AreaBuilding building = buildingMap.get(zoning.getBldgCode());
+    private void fillAreaName(EmsDevice emsDevice, Map<String, Area> areaMap) {
+        String areaCode = emsDevice.getLocationRef();
 
-                if (null != building) {
-                    emsDevice.setAreaPath(
-                        building.getAreaShortName() + "/" + building.getBldgName() + "/" + zoning.getZoningName());
-                }
-                else {
-                    emsDevice.setAreaPath("未知/");
-                }
-            }
-            else {
-                emsDevice.setLocationRefName("未知");
-            }
-        }
-    }
+        Area area = areaMap.get(areaCode);
+        emsDevice.setLocationRefName(null != area ? area.getAreaName() : "未知");
 
-    private void fillAreaName(EmsDevice emsDevice) {
-        if (StringUtils.equals(emsDevice.getLocationType(), AreaTier.Area.name())) {
-            AreaOld area = areaService.selectAreaByCode(emsDevice.getLocationRef());
+        LinkedList<String> pathItems = new LinkedList<>();
 
+        do{
             if (null != area) {
-                emsDevice.setLocationRefName(area.getAreaName());
-                emsDevice.setAreaPath(null != area.getShortName() ? area.getShortName() : area.getAreaName());
+                pathItems.addFirst(area.getShortName());
+                area = areaMap.get(area.getParentCode());
+            } else {
+                pathItems.add("未知");
             }
-            else {
-                emsDevice.setLocationRefName("未知");
-                emsDevice.setAreaPath("未知/");
-            }
-        }
-        else if (StringUtils.equals(emsDevice.getLocationType(), AreaTier.Building.name())) {
-            AreaBuilding building = buildingService.selectAreaBuildingByCode(emsDevice.getLocationRef());
+        } while(null != area);
 
-            if (null != building) {
-                emsDevice.setLocationRefName(building.getBldgName());
-                emsDevice.setAreaPath(building.getAreaShortName() + "/" + building.getBldgName());
-            }
-            else {
-                emsDevice.setLocationRefName("未知");
-                emsDevice.setAreaPath("未知/");
-            }
-        }
-        else if (StringUtils.equals(emsDevice.getLocationType(), AreaTier.Zoning.name())) {
-            AreaBuildingZoning zoning = zoningService.selectAreaBuildingZoningByCode(emsDevice.getLocationRef());
-
-            if (null != zoning) {
-                emsDevice.setLocationRefName(zoning.getZoningName());
-
-                AreaBuilding building = buildingService.selectAreaBuildingByCode(zoning.getBldgCode());
+        emsDevice.setAreaPath(StringUtils.join(pathItems,"/"));
+    }
 
-                if (null != building) {
-                    emsDevice.setAreaPath(
-                        building.getAreaShortName() + "/" + building.getBldgName() + "/" + zoning.getZoningName());
-                }
-                else {
-                    emsDevice.setAreaPath("未知/");
-                }
-            }
-            else {
-                emsDevice.setLocationRefName("未知");
-            }
-        }
+    private void fillAreaName(EmsDevice emsDevice) {
+        List<Area> areas = areaService.selectArea(new Area());
+        Map<String, Area> areaMap = areas.stream()
+            .collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
+        fillAreaName(emsDevice, areaMap);
     }
 }

+ 4 - 4
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java

@@ -124,7 +124,7 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
                     entity.setId(area.getAreaCode());
                     entity.setLabel(area.getAreaName());
                     entity.setChildren(buildFacsDevSub(queryDevice, facsList, areas, buildings, zonings));
-                    entity.setTier("Area");
+                    //entity.setTier("Area");
                     retList.add(entity);
                 }
             }
@@ -143,7 +143,7 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
                 entity.setId(area.getAreaCode());
                 entity.setLabel(area.getAreaName());
                 entity.setChildren(buildFacsDevSub(queryDevice, facsList, areas, buildings, zonings));
-                entity.setTier("Area");
+                //entity.setTier("Area");
                 retList.add(entity);
             }
         }
@@ -191,14 +191,14 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
                 TreeEntity entity = new TreeEntity();
                 entity.setId(device.getDeviceCode());
                 entity.setLabel(label);
-                entity.setTier("Device");
+                //entity.setTier("Device");
                 subList.add(entity);
             }
 
             TreeEntity entity = new TreeEntity();
             entity.setId(facs.getFacsCode());
             entity.setLabel(facs.getFacsName());
-            entity.setTier("Facs");
+            //entity.setTier("Facs");
             entity.setChildren(subList);
 
             if (hasSub) {

+ 13 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaMapper.xml

@@ -33,6 +33,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null "> and status = #{status}</if>
         </where>
     </select>
+
+    <select id="selectWithFacsCategory"  resultMap="areaResult">
+        SELECT
+          a.id, a.area_code, a.parent_code, a.ancestors, a.area_name, a.short_name, a.`desc`, a.order_num, a.status
+        FROM adm_area a
+        INNER JOIN adm_ems_facs f ON f.ref_area = a.area_code
+        <where>
+            <if test="parentCode != null  and parentCode != ''"> and a.parent_code = #{parentCode}</if>
+            <if test="facsCategory != null  and facsCategory != ''"> and f.facs_category = #{facsCategory}</if>
+            <if test="facsSubCategory != null  and facsSubCategory != ''"> and f.facs_subcategory = #{facsSubCategory}</if>
+        </where>
+        GROUP BY a.area_code
+    </select>
     
     <select id="selectAreaById" parameterType="Long" resultMap="areaResult">
         <include refid="selectAreaVo"/>

+ 9 - 34
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml

@@ -14,7 +14,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deviceSpec"          column="device_spec"    />
         <result property="deviceStatus"        column="device_status"    />
         <result property="location"            column="location"    />
-        <result property="locationType"        column="location_type"    />
         <result property="locationRef"         column="location_ref"    />
         <result property="areaCode"            column="area_code"    />
         <result property="areaAncestors"       column="area_ancestors"    />
@@ -31,13 +30,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <sql id="selectDeviceVo">
         select
-            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_type`, d.`location_ref`, d.`area_code`, d.`area_ancestors`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`
+            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_ref`, d.`area_code`, d.`area_ancestors`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`
         from adm_ems_device d
     </sql>
 
     <sql id="selectDetailDeviceVo">
         select
-            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_type`, d.`location_ref`, d.`area_code`, d.`area_ancestors`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`,
+            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_ref`, d.`area_code`, d.`area_ancestors`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`,
             sc.`name` as device_category_name,
             dp.`ps_name`,
             s.`system_name` as subsystem_name,
@@ -57,7 +56,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deviceName != null  and deviceName != ''"> and d.`device_name` like concat('%', #{deviceName}, '%')</if>
             <if test="deviceSubCategory != null and deviceSubCategory !=''"> and d.`device_category` = #{deviceSubCategory}</if>
             <if test="deviceStatus != null "> and d.`device_status` = #{deviceStatus}</if>
-            <if test="locationType != null and locationType != ''"> and d.`location_type` = #{locationType}</if>
             <if test="locationRef != null  and locationRef != ''"> and d.`location_ref` = #{locationRef}</if>
             <if test="refFacs != null  and refFacs != ''"> and d.`ref_facs` = #{refFacs}</if>
             <if test="psCode != null  and psCode != ''"> and d.`ps_code` = #{psCode}</if>
@@ -71,7 +69,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN adm_ems_flow_rel rel ON d.`device_code` = rel.`input_obj`
         <where>
             <if test="areaCode != null  and areaCode != ''"> and d.`area_code` = #{areaCode}</if>
-            <if test="locationType != null and locationType != ''"> and d.`location_type` = #{locationType}</if>
             <if test="locationRef != null  and locationRef != ''"> and d.`location_ref` = #{locationRef}</if>
             <if test="deviceSubCategory != null and deviceSubCategory !=''"> and d.`device_category` = #{deviceSubCategory}</if>
             <if test="psCode != null  and psCode != ''"> and d.`ps_code` = #{psCode}</if>
@@ -98,8 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deviceCategory != null and deviceCategory !=''"> and sc.`parent_code` = #{deviceCategory}</if>
             <if test="deviceSubCategory != null and deviceSubCategory !=''"> and d.`device_category` = #{deviceSubCategory}</if>
             <if test="deviceStatus != null "> and d.`device_status` = #{deviceStatus}</if>
-            <if test="locationType != null and locationType != ''"> and d.`location_type` = #{locationType}</if>
-            <if test="locationRef != null  and locationRef != ''"> and d.`location_ref` = #{locationRef}</if>
+            <if test="locationRef != null and locationRef != ''"> and d.`location_ref` = #{locationRef}</if>
             <if test="refFacs != null  and refFacs != ''"> and d.`ref_facs` = #{refFacs}</if>
             <if test="psCode != null  and psCode != ''"> and d.`ps_code` = #{psCode}</if>
             <if test="deviceModel != null  and deviceModel != ''"> and d.`device_model` = #{device_model}</if>
@@ -119,35 +115,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="psCode != null  and psCode != ''"> and d.`ps_code` = #{psCode}</if>
             <if test="deviceModel != null  and deviceModel != ''"> and d.`device_model` = #{device_model}</if>
             <if test="subsystemCode != null  and subsystemCode != ''"> and d.`subsystem_code` = #{subsystemCode}</if>
-            <if test="locationType == 'Area' and locationRef != null and locationRef != ''">
-                and ((d.`location_type` = 'Area' and d.`location_ref` = #{locationRef})
-                <if test="buildingCodes != null">
-                   or (d.`location_type` = 'Building' and d.`location_ref` in
-                    <foreach item="buildingCode" collection="buildingCodes" open="(" separator="," close=")">
-                        #{buildingCode}
-                    </foreach>)
-                    <if test="zoningCodes != null">
-                        or (d.`location_type` = 'Zoning' and d.`location_ref` in
-                        <foreach item="zoningCode" collection="zoningCodes" open="(" separator="," close=")">
-                            #{zoningCode}
-                        </foreach>)
-                    </if>
-                </if>)
-            </if>
-            <if test="locationType == 'Building' and locationRef != null and locationRef != ''">
-                and ((d.`location_type` = 'Building' and d.`location_ref` = #{locationRef})
-                <if test="zoningCodes != null">
-                   or (d.`location_type` = 'Zoning' and d.`location_ref` in
-                    <foreach item="zoningCode" collection="zoningCodes" open="(" separator="," close=")">
-                        #{zoningCode}
-                    </foreach>)
-                </if>)
-            </if>
-            <if test="locationType == 'Zoning' and locationRef != null and locationRef != ''">
-                and d.`location_type` = 'Zoning' and d.`location_ref` = #{locationRef}
+            <if test="locationRef != null and locationRef != '' and areaCodes != null">
+                and d.`location_ref` in
+                <foreach item="areaCode" collection="areaCodes" open="(" separator="," close=")">
+                    #{areaCode}
+                </foreach>
             </if>
         </where>
-        ORDER BY d.`location_type`, d.`location_ref`
+        ORDER BY d.`location_ref`
     </select>
 
     <select id="selectEmsDeviceById" parameterType="Long" resultMap="EmsDeviceResult">

+ 11 - 4
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ObjTagRelMapper.xml

@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="tagType"    column="tag_type"    />
         <result property="tagCode"    column="tag_code"    />
         <result property="objCode"    column="obj_code"    />
+        <result property="tagName"    column="tag_name"    />
     </resultMap>
 
     <sql id="selectAdmObjTagRelVo">
@@ -15,8 +16,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectListByType" parameterType="java.lang.Integer" resultMap="objTagRelResult">
-        <include refid="selectAdmObjTagRelVo"/>
-        where tag_type = #{tagType}
+        select
+            r.tag_type, r.tag_code, r.obj_code, t.tag_name
+        from adm_obj_tag_rel r
+            left join dim_ems_tag t on r.tag_code = t.tag_code
+        where r.tag_type = #{tagType}
     </select>
 
     <select id="selectListByTagCode" resultMap="objTagRelResult">
@@ -25,8 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectListByObjCode" resultMap="objTagRelResult">
-        <include refid="selectAdmObjTagRelVo"/>
-        where tag_type = #{tagType} and obj_code = #{objCode}
+        select
+            r.tag_type, r.tag_code, r.obj_code, t.tag_name
+        from adm_obj_tag_rel r
+            left join dim_ems_tag t on r.tag_code = t.tag_code
+        where r.tag_type = #{tagType} and r.obj_code = #{objCode}
     </select>
 
     <insert id="insertBatch" parameterType="java.util.List">

+ 125 - 113
ems-cloud/sql/ems_init_data.sql

@@ -392,117 +392,117 @@ INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `i
 
 
 -- 能源设备
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R101-001', '开水炉',              'Z040', '美的', 'C10', '2', '开水间', 'Zoning', 'B-101', '321283124S3001', '321283124S3001,321283124S300101,B-101', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-002', '超市照明灯',           'Z010', '欧普', 'D20-x', '2', '超市', 'Zoning', 'B-102', '321283124S3001', '321283124S3001,321283124S300101,B-102', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-003', '超市监控和防盗设备',     'Z030', '萤石', 'Y-20', '2', '超市', 'Zoning', 'B-102', '321283124S3001', '321283124S3001,321283124S300101,B-102', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-001', '空调',                'Z020', '约克', 'Y-111', '1', '超市', 'Zoning', 'B-103', '321283124S3001', '321283124S3001,321283124S300101,B-103', null, 'Z120', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-002', '烤箱',                'Z040', '格兰仕', 'G-111', '2', '综合楼', 'Zoning', 'B-103', '321283124S3001', '321283124S3001,321283124S300101,B-103', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-003', '搅拌机',              'Z040', '9阳',    'G-111', '2', '综合楼', 'Zoning', 'B-103', '321283124S3001', '321283124S3001,321283124S300101,B-103', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-001', 'LED节能灯',           'Z010', '欧普',    'G-111', '1', '综合楼', 'Zoning', 'B-104', '321283124S3001', '321283124S3001,321283124S300101,B-104', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-003', '智慧路灯',            'Z010', '欧普',    'G-111', '1', '广场', 'Zoning', 'B-104', '321283124S3001', '321283124S3001,321283124S300101,B-104', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-001', '智慧屏',              'Z040', null, null, '1', null, 'Zoning', 'B-105', '321283124S3001', '321283124S3001,321283124S300101,B-105', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-002', '充电站',              'Z040', null, null, '1', null, 'Zoning', 'B-105', '321283124S3001', '321283124S3001,321283124S300101,B-105', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-003', '调光系统',            'Z010', null, null, '1', null, 'Zoning', 'B-105', '321283124S3001', '321283124S3001,321283124S300101,B-105', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R106-001', '吊灯',                'Z010', null, null, '1', null, 'Zoning', 'B-106', '321283124S3001', '321283124S3001,321283124S300101,B-106', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-001', '橱窗照明',            'Z010', null, null, '1', null, 'Zoning', 'B-107', '321283124S3001', '321283124S3001,321283124S300101,B-107', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-002', 'UPS(不间断电源)系统', 'Z030', null, null, '1', null, 'Zoning', 'B-107', '321283124S3001', '321283124S3001,321283124S300101,B-107', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R108-001', '吊灯',                'Z010', null, null, '1', null, 'Zoning', 'B-108', '321283124S3001', '321283124S3001,321283124S300101,B-108', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R109-001', '指示灯',              'Z010', null, null, '1', null, 'Zoning', 'B-109', '321283124S3001', '321283124S3001,321283124S300101,B-109', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R110-001', '应急照明',            'Z030', null, null, '1', null, 'Zoning', 'B-110', '321283124S3001', '321283124S3001,321283124S300101,B-110', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-001', '自动感应灯',           'Z010', null, null, '2', null, 'Zoning', 'B-112', '321283124S3001', '321283124S3001,321283124S300101,B-112', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-002', '二级配电箱',           'W2', null, null, '2', null, 'Zoning', 'B-112', '321283124S3001', '321283124S3001,321283124S300101,B-112', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-001', '自动感应灯',           'Z010', null, null, '2', null, 'Zoning', 'B-114', '321283124S3001', '321283124S3001,321283124S300101,B-114', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-002', '二级配电箱',           'W2', null, null, '2', null, 'Zoning', 'B-114', '321283124S3001', '321283124S3001,321283124S300101,B-114', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R115-001', '工作灯',              'Z010', null, null, '2', null, 'Zoning', 'B-115', '321283124S3001', '321283124S3001,321283124S300101,B-115', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R16-001',  '防水灯具',            'Z010', null, null, '2', null, 'Zoning', 'B-116', '321283124S3001', '321283124S3001,321283124S300101,B-116', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R117-001', '防水灯具',            'Z010', null, null, '2', null, 'Zoning', 'B-117', '321283124S3001', '321283124S3001,321283124S300101,B-117', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R118-001', '灯具',               'Z010', null, null, '2', null, 'Zoning', 'B-118', '321283124S3001', '321283124S3001,321283124S300101,B-118', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R119-001', '防水灯具',            'Z010', null, null, '2', null, 'Zoning', 'B-119', '321283124S3001', '321283124S3001,321283124S300101,B-119', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R120-001', '二级配电箱',           'W2', null, null, '1', null, 'Zoning', 'B-120', '321283124S3001', '321283124S3001,321283124S300102,B-120', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R121-001', '二级配电箱',           'W2', null, null, '1', null, 'Zoning', 'B-121', '321283124S3001', '321283124S3001,321283124S300102,B-121', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R122-001', '二级配电箱',           'W2', null, null, '1', null, 'Zoning', 'B-122', '321283124S3001', '321283124S3001,321283124S300102,B-122', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R123-001', '二级配电箱',           'W2', null, null, '1', null, 'Zoning', 'B-123', '321283124S3001', '321283124S3001,321283124S300103,B-123', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R124-001', '加热器',              'Z040', null, null, '1', null, 'Zoning', 'B-124', '321283124S3001', '321283124S3001,321283124S300103,B-124', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R125-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-125', '321283124S3001', '321283124S3001,321283124S300104,B-125', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R126-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-126', '321283124S3001', '321283124S3001,321283124S300104,B-126', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R127-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-127', '321283124S3001', '321283124S3001,321283124S300104,B-127', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R128-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-128', '321283124S3001', '321283124S3001,321283124S300104,B-128', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R129-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-129', '321283124S3001', '321283124S3001,321283124S300105,B-129', null,'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R130-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-130', '321283124S3001', '321283124S3001,321283124S300105,B-130', null,'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R131-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-131', '321283124S3001', '321283124S3001,321283124S300105,B-131', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R132-001', '空调',                'Z020', '格力', null, '1', null, 'Zoning', 'B-132', '321283124S3001', '321283124S3001,321283124S300105,B-132', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-001', '照明灯',                    'Z010', '欧普', null, '1', null, 'Zoning', '321283124S3001_CW-XK', '321283124S3001', '321283124S3001,321283124S300106,321283124S3001_CW-XK', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-002', '智能监控系统',               'Z030', '中控', null, '1', null, 'Zoning', '321283124S3001_CW-CD', '321283124S3001', '321283124S3001,321283124S300106,321283124S3001_CW-CD', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-003', '照明灯',                    'Z010', '欧普', null, '1', null, 'Zoning', '321283124S3001_CW-WZA', '321283124S3001', '321283124S3001,321283124S300106,321283124S3001_CW-WZA', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-004', '照明灯',                    'Z010', '欧普', null, '1', null, 'Zoning', '321283124S3001_CW-DKC', '321283124S3001', '321283124S3001,321283124S300106,321283124S3001_CW-DKC', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-005', '照明灯',                    'Z010', '欧普', null, '1', null, 'Zoning', '321283124S3001_CW-HC', '321283124S3001', '321283124S3001,321283124S300106,321283124S3001_CW-HC', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-006', '停车场照明灯',               'Z010', '欧普', null, '1', null, 'Zoning', '321283124S3001_CW-WXP', '321283124S3001', '321283124S3001,321283124S300106,321283124S3001_CW-WXP', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-007', '智能监控系统',               'Z010', '欧普', null, '1', null, 'Zoning', '321283124S3001_CW-WXP', '321283124S3001', '321283124S3001,321283124S300106,321283124S3001_CW-WXP', null, 'Z110', null, 'SYS_BA');
-
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R101-101', '开水炉',              'Z040', '美的', 'C10', '2', '开水间', 'Zoning', 'N-101', '321283124S3002', '321283124S3002,321283124S300201,N-101',null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-101', '超市区空调',           'Z020', null, null, '1', null, 'Zoning', 'N-102', '321283124S3002', '321283124S3002,321283124S300201,N-102', null, 'Z120', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-102', '超市照明灯',           'Z010', null, null, '2', null, 'Zoning', 'N-102', '321283124S3002', '321283124S3002,321283124S300201,N-102', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-103', '超市监控和防盗设备',    'Z030', null, null, '2', null, 'Zoning', 'N-102', '321283124S3002', '321283124S3002,321283124S300201,N-102', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-101', '空调',                'Z020', null, null, '1', null, 'Zoning', 'N-103', '321283124S3002', '321283124S3002,321283124S300201,N-103', null, 'Z120', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-102', '烤箱',                'Z040', null, null, '1', null, 'Zoning', 'N-103', '321283124S3002', '321283124S3002,321283124S300201,N-103', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-103', '搅拌机',              'Z040', null, null, '1', null, 'Zoning', 'N-103', '321283124S3002', '321283124S3002,321283124S300201,N-103', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-101', 'LED节能灯',           'Z010', null, null, '1', null, 'Zoning', 'N-104', '321283124S3002', '321283124S3002,321283124S300201,N-104', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-102', '智慧屏',              'Z010', null, null, '1', null, 'Zoning', 'N-104', '321283124S3002', '321283124S3002,321283124S300201,N-104', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-103', '智慧路灯',            'Z010', null, null, '1', null, 'Zoning', 'N-104', '321283124S3002', '321283124S3002,321283124S300201,N-104', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-101', '二级配电箱',           'W2', null, null, '1', null, 'Zoning', 'N-105', '321283124S3002', '321283124S3002,321283124S300201,N-105', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-102', '充电站',              'Z040', null, null, '1', null, 'Zoning', 'N-105', '321283124S3002', '321283124S3002,321283124S300201,N-105', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-103', '调光系统',            'Z010', null, null, '1', null, 'Zoning', 'N-105', '321283124S3002', '321283124S3002,321283124S300201,N-105', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R106-101', '吊灯',               'Z010', null, null, '1', null, 'Zoning', 'N-106', '321283124S3002', '321283124S3002,321283124S300201,N-106', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-101', '橱窗照明',            'Z010', null, null, '1', null, 'Zoning', 'N-107', '321283124S3002', '321283124S3002,321283124S300201,N-107', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-102', 'UPS(不间断电源)系统', 'Z030', null, null, '1', null, 'Zoning', 'N-107', '321283124S3002', '321283124S3002,321283124S300201,N-107', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R108-101', '吊灯',               'Z010', null, null, '1', null, 'Zoning', 'N-108', '321283124S3002', '321283124S3002,321283124S300201,N-108', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R109-101', '指示灯',             'Z010', null, null, '1', null, 'Zoning', 'N-109', '321283124S3002', '321283124S3002,321283124S300201,N-109', null,  'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R110-101', '应急照明',           'Z010', null, null, '1', null, 'Zoning', 'N-110', '321283124S3002', '321283124S3002,321283124S300201,N-110', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-101', '自动感应灯',         'Z010', null, null, '1', null, 'Zoning', 'N-112', '321283124S3002', '321283124S3002,321283124S300201,N-112', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-102', '二级配电箱',         'W2', null, null, '1', null, 'Zoning', 'N-112', '321283124S3002', '321283124S3002,321283124S300201,N-112', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-101', '自动感应灯',         'Z010', null, null, '1', null, 'Zoning', 'N-114', '321283124S3002', '321283124S3002,321283124S300201,N-114', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-102', '二级配电箱',         'W2', null, null, '1', null, 'Zoning', 'N-114', '321283124S3002', '321283124S3002,321283124S300201,N-114', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R115-101', '工作灯',            'Z010', null, null, '1', null, 'Zoning', 'N-115', '321283124S3002', '321283124S3002,321283124S300201,N-115', null, 'Z101', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R16-101', '防水灯具',           'Z010', null, null, '1', null, 'Zoning', 'N-116', '321283124S3002', '321283124S3002,321283124S300201,N-115', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R117-101', '防水灯具',          'Z010', null, null, '1', null, 'Zoning', 'N-117', '321283124S3002', '321283124S3002,321283124S300201,N-117', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R118-101', '防水灯具',          'Z010', null, null, '1', null, 'Zoning', 'N-118', '321283124S3002', '321283124S3002,321283124S300201,N-118', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R119-101', '防水灯具',          'Z010', null, null, '1', null, 'Zoning', 'N-119', '321283124S3002', '321283124S3002,321283124S300201,N-119', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R120-101', '二级配电箱',         'W2', null, null, '1', null, 'Zoning', 'N-120', '321283124S3002', '321283124S3002,321283124S300202,N-120', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R121-101', '二级配电箱',         'W2', null, null, '1', null, 'Zoning', 'N-121', '321283124S3002', '321283124S3002,321283124S300202,N-121', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R122-101', '二级配电箱',         'W2', null, null, '1', null, 'Zoning', 'N-122', '321283124S3002', '321283124S3002,321283124S300202,N-122', null, 'W201', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R123-101', '二级配电箱',         'W2', null, null, '1', null, 'Zoning', 'N-123', '321283124S3002', '321283124S3002,321283124S300203,N-123', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R124-101', '加热器',            'Z020', null, null, '1', null, 'Zoning', 'N-124', '321283124S3002', '321283124S3002,321283124S300203,N-124', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R125-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-125', '321283124S3002', '321283124S3002,321283124S300204,N-125', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R126-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-126', '321283124S3002', '321283124S3002,321283124S300204,N-126', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R127-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-127', '321283124S3002', '321283124S3002,321283124S300204,N-127', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R128-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-128', '321283124S3002', '321283124S3002,321283124S300204,N-128', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R129-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-129', '321283124S3002', '321283124S3002,321283124S300205,N-129', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R130-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-130', '321283124S3002', '321283124S3002,321283124S300205,N-130', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R131-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-131', '321283124S3002', '321283124S3002,321283124S300205,N-131', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R132-101', '空调',              'Z020', null, null, '1', null, 'Zoning', 'N-132', '321283124S3002', '321283124S3002,321283124S300205,N-132', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-101', '照明灯',                  'Z010', null, null, '1', null, 'Zoning', '321283124S3002_CW-XK', '321283124S3002', '321283124S3002,321283124S300206,321283124S3002_CW-XK', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-102', '智能监控系统',             'Z030', null, null, '1', null, 'Zoning', '321283124S3002_CW-CD', '321283124S3002', '321283124S3002,321283124S300206,321283124S3002_CW-CD', null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-103', '照明灯',                  'Z010', null, null, '1', null, 'Zoning', '321283124S3002_CW-WZA', '321283124S3002', '321283124S3002,321283124S300206,321283124S3002_CW-WZA', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-104', '照明灯',                  'Z010', null, null, '1', null, 'Zoning', '321283124S3002_CW-DKC', '321283124S3002', '321283124S3002,321283124S300206,321283124S3002_CW-DKC', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-105', '照明灯',                  'Z010', null, null, '1', null, 'Zoning', '321283124S3002_CW-HC', '321283124S3002', '321283124S3002,321283124S300206,321283124S3002_CW-HC', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-106', '停车场照明灯',             'Z010', null, null, '1', null, 'Zoning', '321283124S3002_CW-WXP', '321283124S3002', '321283124S3002,321283124S300206,321283124S3002_CW-WXP', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-107', '智能监控系统',             'Z030', null, null, '1', null, 'Zoning', '321283124S3002_CW-WXP', '321283124S3002', '321283124S3002,321283124S300206,321283124S3002_CW-WXP', null, 'Z110', null, 'SYS_BA');
-
-
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-ZHLD-001', '光伏板1',      'E5', null, null, '1', null, 'Zoning', '321283124S3001_99-ZHLD', '321283124S3001', '321283124S3001,321283124S300199,321283124S3001_99-ZHLD', null, 'E501', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-CPD-001', '光伏板2',      'E5', null, null, '1', null, 'Zoning', '321283124S3001_99-CPD', '321283124S3001', '321283124S3001,321283124S300199,321283124S3001_99-CPD', null, 'E501', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-ZHLD-001', '光伏板3',      'E5', null, null, '1', null, 'Zoning', '321283124S3002_99-ZHLD', '321283124S3002', '321283124S3002,321283124S300299,321283124S3002_99-ZHLD', null, 'E502', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-CPD-001', '光伏板4',      'E5', null, null, '1', null, 'Zoning', '321283124S3002_99-CPD', '321283124S3002', '321283124S3002,321283124S300299,321283124S3002_99-CPD', null, 'E502', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-001', '光伏板5',      'E5', null, null, '1', null, 'Building', 'S30K140-S30K150', '321283124S3003', '321283124S3003,S30K140-S30K150', null, 'E503', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-002', '光伏板6',      'E5', null, null, '1', null, 'Building', 'S30K140-S30K150', '321283124S3003', '321283124S3003,S30K140-S30K150', null, 'E503', null, 'SYS_GF');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-003', '光伏板7',      'E5', null, null, '1', null, 'Building', 'S30K150-S30K180', '321283124S3003', '321283124S3003,S30K150-S30K180', null, 'E503', null, 'SYS_GF');
-
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-T-1001', '北区总变', 'W2', '西门子', 'T221123', 1, '北区', 'Area', '321283124S3001', '321283124S3001', '321283124S3001', 'M_W2_T', 'W201', 'T', null);
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-T-1002', '南区总变', 'W2', '西门子', 'T221212', 1, '南区', 'Area', '321283124S3002', '321283124S3002', '321283124S3002', 'M_W2_T', 'W201', 'T', null);
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-1001', '北区-综合楼配电', 'W2', '安科瑞', 'DX2121021', 1, '综合楼配电间', 'Area', '321283124S3001', '321283124S3001', '321283124S3001', null, 'W201', 'AP', null);
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-1002', '北区-广场配电', 'W2', '安科瑞', 'DX2121021', 1, '广场配电柜', 'Area', '321283124S3001', '321283124S3001', '321283124S3001', null, 'W201', 'AP', null);
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-1001', '南区-综合楼配电', 'W2', '安科瑞', 'DX2121021', 1, '综合楼配电间', 'Area', '321283124S3002', '321283124S3002', '321283124S3002', null, 'W202', 'AP', null);
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_type`, `location_ref`, `area_code`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-1002', '南区-广场配电', 'W2', '安科瑞', 'DX2121021', 1, '广场配电柜', 'Area', '321283124S3002', '321283124S3002','321283124S3002', null, 'W202', 'AP', null);
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R101-001', '开水炉',              'Z040', '美的', 'C10', '2', '开水间', 'B-101', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-002', '超市照明灯',           'Z010', '欧普', 'D20-x', '2', '超市', 'B-102', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-003', '超市监控和防盗设备',     'Z030', '萤石', 'Y-20', '2', '超市', 'B-102', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-001', '空调',                'Z020', '约克', 'Y-111', '1', '超市', 'B-103', '321283124S3001', null, 'Z120', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-002', '烤箱',                'Z040', '格兰仕', 'G-111', '2', '综合楼', 'B-103', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-003', '搅拌机',              'Z040', '9阳',    'G-111', '2', '综合楼', 'B-103', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-001', 'LED节能灯',           'Z010', '欧普',    'G-111', '1', '综合楼', 'B-104', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-003', '智慧路灯',            'Z010', '欧普',    'G-111', '1', '广场', 'B-104', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-001', '智慧屏',              'Z040', null, null, '1', null, 'B-105', '321283124S3001', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-002', '充电站',              'Z040', null, null, '1', null, 'B-105', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-003', '调光系统',            'Z010', null, null, '1', null, 'B-105', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R106-001', '吊灯',                'Z010', null, null, '1', null, 'B-106', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-001', '橱窗照明',            'Z010', null, null, '1', null, 'B-107', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-002', 'UPS(不间断电源)系统', 'Z030', null, null, '1', null, 'B-107', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R108-001', '吊灯',                'Z010', null, null, '1', null, 'B-108', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R109-001', '指示灯',              'Z010', null, null, '1', null, 'B-109', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R110-001', '应急照明',            'Z030', null, null, '1', null, 'B-110', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-001', '自动感应灯',           'Z010', null, null, '2', null, 'B-112', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-002', '二级配电箱',           'W2', null, null, '2', null, 'B-112', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-001', '自动感应灯',           'Z010', null, null, '2', null, 'B-114', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-002', '二级配电箱',           'W2', null, null, '2', null, 'B-114', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R115-001', '工作灯',              'Z010', null, null, '2', null, 'B-115', '321283124S3001', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R16-001',  '防水灯具',            'Z010', null, null, '2', null, 'B-116', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R117-001', '防水灯具',            'Z010', null, null, '2', null, 'B-117', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R118-001', '灯具',               'Z010', null, null, '2', null, 'B-118', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R119-001', '防水灯具',            'Z010', null, null, '2', null, 'B-119', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R120-001', '二级配电箱',           'W2', null, null, '1', null, 'B-120', '321283124S3001', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R121-001', '二级配电箱',           'W2', null, null, '1', null, 'B-121', '321283124S3001', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R122-001', '二级配电箱',           'W2', null, null, '1', null, 'B-122', '321283124S3001', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R123-001', '二级配电箱',           'W2', null, null, '1', null, 'B-123', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R124-001', '加热器',              'Z040', null, null, '1', null, 'B-124', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R125-001', '空调',                'Z020', '格力', null, '1', null, 'B-125', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R126-001', '空调',                'Z020', '格力', null, '1', null, 'B-126', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R127-001', '空调',                'Z020', '格力', null, '1', null, 'B-127', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R128-001', '空调',                'Z020', '格力', null, '1', null, 'B-128', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R129-001', '空调',                'Z020', '格力', null, '1', null, 'B-129', '321283124S3001', null,'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R130-001', '空调',                'Z020', '格力', null, '1', null, 'B-130', '321283124S3001', null,'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R131-001', '空调',                'Z020', '格力', null, '1', null, 'B-131', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R132-001', '空调',                'Z020', '格力', null, '1', null, 'B-132', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-001', '照明灯',                    'Z010', '欧普', null, '1', null, '321283124S3001_CW-XK', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-002', '智能监控系统',               'Z030', '中控', null, '1', null, '321283124S3001_CW-CD', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-003', '照明灯',                    'Z010', '欧普', null, '1', null, '321283124S3001_CW-WZA', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-004', '照明灯',                    'Z010', '欧普', null, '1', null, '321283124S3001_CW-DKC', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-005', '照明灯',                    'Z010', '欧普', null, '1', null, '321283124S3001_CW-HC', '321283124S3001',  null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-006', '停车场照明灯',               'Z010', '欧普', null, '1', null, '321283124S3001_CW-WXP', '321283124S3001', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-007', '智能监控系统',               'Z010', '欧普', null, '1', null, '321283124S3001_CW-WXP', '321283124S3001', null, 'Z110', null, 'SYS_BA');
+
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R101-101', '开水炉',              'Z040', '美的', 'C10', '2', '开水间', 'N-101', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-101', '超市区空调',           'Z020', null, null, '1', null, 'N-102', '321283124S3002', null, 'Z120', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-102', '超市照明灯',           'Z010', null, null, '2', null, 'N-102', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R102-103', '超市监控和防盗设备',    'Z030', null, null, '2', null, 'N-102', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-101', '空调',                'Z020', null, null, '1', null, 'N-103', '321283124S3002', null, 'Z120', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-102', '烤箱',                'Z040', null, null, '1', null, 'N-103', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R103-103', '搅拌机',              'Z040', null, null, '1', null, 'N-103', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-101', 'LED节能灯',           'Z010', null, null, '1', null, 'N-104', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-102', '智慧屏',              'Z010', null, null, '1', null, 'N-104', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R104-103', '智慧路灯',            'Z010', null, null, '1', null, 'N-104', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-101', '二级配电箱',           'W2', null, null, '1', null, 'N-105', '321283124S3002', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-102', '充电站',              'Z040', null, null, '1', null, 'N-105', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R105-103', '调光系统',            'Z010', null, null, '1', null, 'N-105', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R106-101', '吊灯',               'Z010', null, null, '1', null, 'N-106', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-101', '橱窗照明',            'Z010', null, null, '1', null, 'N-107', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R107-102', 'UPS(不间断电源)系统', 'Z030', null, null, '1', null, 'N-107', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R108-101', '吊灯',               'Z010', null, null, '1', null, 'N-108', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R109-101', '指示灯',             'Z010', null, null, '1', null, 'N-109', '321283124S3002', null,  'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R110-101', '应急照明',           'Z010', null, null, '1', null, 'N-110', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-101', '自动感应灯',         'Z010', null, null, '1', null, 'N-112', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R112-102', '二级配电箱',         'W2', null, null, '1', null, 'N-112', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-101', '自动感应灯',         'Z010', null, null, '1', null, 'N-114', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R114-102', '二级配电箱',         'W2', null, null, '1', null, 'N-114', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R115-101', '工作灯',            'Z010', null, null, '1', null, 'N-115', '321283124S3002', null, 'Z101', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R16-101', '防水灯具',           'Z010', null, null, '1', null, 'N-116', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R117-101', '防水灯具',          'Z010', null, null, '1', null, 'N-117', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R118-101', '防水灯具',          'Z010', null, null, '1', null, 'N-118', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R119-101', '防水灯具',          'Z010', null, null, '1', null, 'N-119', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R120-101', '二级配电箱',         'W2', null, null, '1', null, 'N-120', '321283124S3002', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R121-101', '二级配电箱',         'W2', null, null, '1', null, 'N-121', '321283124S3002', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R122-101', '二级配电箱',         'W2', null, null, '1', null, 'N-122', '321283124S3002', null, 'W201', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R123-101', '二级配电箱',         'W2', null, null, '1', null, 'N-123', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R124-101', '加热器',            'Z020', null, null, '1', null, 'N-124', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R125-101', '空调',              'Z020', null, null, '1', null, 'N-125', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R126-101', '空调',              'Z020', null, null, '1', null, 'N-126', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R127-101', '空调',              'Z020', null, null, '1', null, 'N-127', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R128-101', '空调',              'Z020', null, null, '1', null, 'N-128', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R129-101', '空调',              'Z020', null, null, '1', null, 'N-129', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R130-101', '空调',              'Z020', null, null, '1', null, 'N-130', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R131-101', '空调',              'Z020', null, null, '1', null, 'N-131', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R132-101', '空调',              'Z020', null, null, '1', null, 'N-132', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-101', '照明灯',                  'Z010', null, null, '1', null, '321283124S3002_CW-XK', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-102', '智能监控系统',             'Z030', null, null, '1', null, '321283124S3002_CW-CD', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-103', '照明灯',                  'Z010', null, null, '1', null, '321283124S3002_CW-WZA', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-104', '照明灯',                  'Z010', null, null, '1', null, '321283124S3002_CW-DKC', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-105', '照明灯',                  'Z010', null, null, '1', null, '321283124S3002_CW-HC', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-106', '停车场照明灯',             'Z010', null, null, '1', null, '321283124S3002_CW-WXP', '321283124S3002', null, 'Z102', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-107', '智能监控系统',             'Z030', null, null, '1', null, '321283124S3002_CW-WXP', '321283124S3002', null, 'Z110', null, 'SYS_BA');
+
+
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-ZHLD-001', '光伏板1',      'E5', null, null, '1', null, '321283124S3001_99-ZHLD', '321283124S3001', null, 'E501', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3001_99-CPD-001', '光伏板2',      'E5', null, null, '1', null, '321283124S3001_99-CPD', '321283124S3001', null, 'E501', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-ZHLD-001', '光伏板3',      'E5', null, null, '1', null, '321283124S3002_99-ZHLD', '321283124S3002', null, 'E502', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( '321283124S3002_99-CPD-001', '光伏板4',      'E5', null, null, '1', null, '321283124S3002_99-CPD', '321283124S3002', null, 'E502', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-001', '光伏板5',      'E5', null, null, '1', null, 'S30K140-S30K150', '321283124S3003', null, 'E503', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-002', '光伏板6',      'E5', null, null, '1', null, 'S30K140-S30K150', '321283124S3003', null, 'E503', null, 'SYS_GF');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-003', '光伏板7',      'E5', null, null, '1', null, 'S30K150-S30K180', '321283124S3003', null, 'E503', null, 'SYS_GF');
+
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-T-1001', '北区总变', 'W2', '西门子', 'T221123', 1, '北区', '321283124S3001', '321283124S3001', 'M_W2_T', 'W201', 'T', null);
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-T-1002', '南区总变', 'W2', '西门子', 'T221212', 1, '南区',  '321283124S3002', '321283124S3002', 'M_W2_T', 'W201', 'T', null);
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-1001', '北区-综合楼配电', 'W2', '安科瑞', 'DX2121021', 1, '综合楼配电间', '321283124S3001', '321283124S3001', null, 'W201', 'AP', null);
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-1002', '北区-广场配电', 'W2', '安科瑞', 'DX2121021', 1, '广场配电柜', '321283124S3001', '321283124S3001',  null, 'W201', 'AP', null);
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-1001', '南区-综合楼配电', 'W2', '安科瑞', 'DX2121021', 1, '综合楼配电间', '321283124S3002', '321283124S3002', null, 'W202', 'AP', null);
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-1002', '南区-广场配电', 'W2', '安科瑞', 'DX2121021', 1, '广场配电柜',  '321283124S3002', '321283124S3002', null, 'W202', 'AP', null);
 
 -- 设备部件表
 INSERT INTO `adm_ems_device_component` (`device_code`, `compo_code`, `compo_tag`, `ps_code`, `ext_compo_code`, `compo_model`, `compo_brand`, `compo_spec`, `ancestors`, `parent_compo`) VALUES ('D-B-1001', 'D-B-1001-QR_00', '总开', 'QR', '0x000101', 'M_W2_QR', '德力西', 'DZ47P-C10', '', '');
@@ -644,6 +644,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202407', 921, '2024-06-30', 1189, '2024-07-31', 268, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202408', 1189, '2024-07-31', 1464, '2024-08-31', 275, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202409', 1464, '2024-08-31', 1797, '2024-09-30', 333, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202410', 1797, '2024-09-30', 2045, '2024-10-31', 248, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202402', 100, '2024-02-29', 250, '2024-02-28', 150, NULL, NULL);
@@ -654,6 +655,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202407', 720, '2024-06-30', 800, '2024-07-31', 80, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202408', 800, '2024-07-31', 860, '2024-08-31', 160, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202409', 860, '2024-08-31', 1030, '2024-09-30', 170, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202410', 1030, '2024-09-30', 1213, '2024-10-31', 183, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -664,6 +666,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202407', 600, '2024-06-30', 700, '2024-07-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202408', 700, '2024-07-31', 800, '2024-08-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -674,6 +677,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202407', 600, '2024-06-30', 700, '2024-07-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202408', 700, '2024-07-31', 800, '2024-08-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -684,6 +688,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202407', 600, '2024-06-30', 700, '2024-07-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202408', 700, '2024-07-31', 800, '2024-08-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -693,7 +698,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202406', 500, '2024-05-31', 600, '2024-06-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202407', 600, '2024-06-30', 700, '2024-07-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202408', 700, '2024-07-31', 800, '2024-08-31', 100, NULL, NULL);
-INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202409', 700, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -704,6 +710,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202407', 600, '2024-06-30', 700, '2024-07-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202408', 700, '2024-07-31', 800, '2024-08-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202409', 700, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -714,6 +721,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202407', 600, '2024-06-30', 700, '2024-07-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202408', 700, '2024-07-31', 800, '2024-08-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -723,7 +731,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202406', 500, '2024-05-31', 600, '2024-06-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202407', 600, '2024-06-30', 700, '2024-07-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202408', 700, '2024-07-31', 800, '2024-08-31', 100, NULL, NULL);
-INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202409', 700, '2024-08-31', 800, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202401', 0, '2024-02-29', 1000, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202402', 1000, '2024-02-29', 2120, '2024-02-28', 1120, NULL, NULL);
@@ -734,6 +743,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202407', 6793, '2024-06-30', 7886, '2024-07-31', 1093, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202408', 7886, '2024-07-31', 8947, '2024-08-31', 1061, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202409', 8947, '2024-08-31', 10158, '2024-09-30', 1211, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202410', 10158, '2024-09-30', 11700, '2024-10-31', 1542, NULL, NULL);
+
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202401', 0, '2024-02-29', 25, '2024-01-31', 1250, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202402', 25, '2024-02-29', 73, '2024-02-28', 2400, NULL, NULL);
@@ -744,6 +755,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202407', 293, '2024-06-30', 387, '2024-07-31', 4700, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202408', 387, '2024-07-31', 465, '2024-08-31', 3900, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202409', 465, '2024-08-31', 612, '2024-09-30', 7350, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202410', 612, '2024-08-31', 758, '2024-09-30', 7300, NULL, NULL);
 
 -- -- 电网计量指标数据 Mock
 -- INSERT INTO adm_ems_pg_supply_h (area_code, facs_code, record_time, `date`, `time`, time_index, meter_type, meter_unit_price, use_elec_quantity, use_elec_cost) VALUES ('321283124S3001', 'W201', CONCAT(CURDATE(), ' ', LPAD(HOUR(NOW()), 2, '0'), ':00:00'), CURDATE(), CONCAT(LPAD(HOUR(NOW()), 2, '0'), ':00:00'), HOUR(NOW()) + 1, 0, 0.75, FLOOR(50 + (RAND() * (150 - 50 + 1))), FLOOR(RAND() * (100 - 1 + 1)) + 1);

+ 0 - 2
ems-cloud/sql/ems_server.sql

@@ -509,10 +509,8 @@ create table adm_ems_device  (
   `device_spec`     varchar(128)    default null                 comment '设备型号',
   `device_status`   int             default null                 comment '设备状态',
   `location`        varchar(200)    default null                 comment '安装位置',
-  `location_type`   varchar(32)     default null                 comment '安装位置层级',
   `location_ref`    varchar(64)     default null                 comment '安装位置关联区域',
   `area_code`       varchar(32)     default null                 comment '归属地块代码',
-  `area_ancestors`  varchar(200)    default null                 comment '区域祖级代码',
   `device_model`    varchar(16)     default null                 comment '设备模型',
   `ref_facs`        varchar(64)     default null                 comment '归属设施代码',
   `ps_code`         varchar(16)     default null                 comment '工艺标识',