lv.wenbin пре 9 месеци
родитељ
комит
651e0d319d
27 измењених фајлова са 1844 додато и 757 уклоњено
  1. 1 1
      ems-application/ruoyi-admin/src/main/resources/application.yml
  2. 47 130
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java
  3. 185 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaOldController.java
  4. 59 171
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/Area.java
  5. 192 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaAttr.java
  6. 249 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaOld.java
  7. 54 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaAttrMapper.java
  8. 18 36
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaMapper.java
  9. 79 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaOldMapper.java
  10. 2 2
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/model/TreeEntity.java
  11. 53 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaAttrService.java
  12. 104 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaOldService.java
  13. 16 59
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java
  14. 4 4
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AdmOpAlarmServiceImpl.java
  15. 58 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaAttrServiceImpl.java
  16. 279 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaOldServiceImpl.java
  17. 47 212
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java
  18. 4 4
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ChargingBillServiceImpl.java
  19. 9 9
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsDeviceServiceImpl.java
  20. 8 8
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java
  21. 5 5
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/MeterDeviceServiceImpl.java
  22. 93 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaAttrMapper.xml
  23. 37 89
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaMapper.xml
  24. 143 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaOldMapper.xml
  25. 48 24
      ems-cloud/sql/ems_init_data.sql
  26. 43 0
      ems-cloud/sql/ems_server.sql
  27. 7 3
      ems-cloud/sql/ems_sys.sql

+ 1 - 1
ems-application/ruoyi-admin/src/main/resources/application.yml

@@ -16,7 +16,7 @@ ruoyi:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 9100
+  port: 8100
   servlet:
     # 应用的访问路径
     context-path: /

+ 47 - 130
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java

@@ -1,185 +1,102 @@
 package com.ruoyi.ems.controller;
 
-import com.ruoyi.common.core.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.ruoyi.common.core.web.domain.AjaxResult;
-import com.ruoyi.common.core.web.page.TableDataInfo;
-import com.ruoyi.common.log.annotation.Log;
-import com.ruoyi.common.log.enums.BusinessType;
-import com.ruoyi.common.security.annotation.RequiresPermissions;
-import com.ruoyi.ems.domain.Area;
-import com.ruoyi.ems.model.TreeEntity;
-import com.ruoyi.ems.service.IAreaService;
-import io.swagger.annotations.Api;
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
+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 javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.List;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.service.IAreaService;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
 
 /**
- * 服务区Controller
- *
+ * 区域对象Controller
+ * 
  * @author ruoyi
- * @date 2024-07-09
+ * @date 2024-11-01
  */
 @RestController
 @RequestMapping("/basecfg/area")
-@Api(value = "AreaController", description = "地块管理")
-public class AreaController extends BaseController {
+public class AreaController extends BaseController
+{
     @Autowired
     private IAreaService areaService;
 
     /**
-     * 查询服务区列表
+     * 查询区域对象列表
      */
-    @RequiresPermissions("basecfg:area:list")
+    @RequiresPermissions("ems:area:list")
     @GetMapping("/list")
-    public TableDataInfo list(Area area) {
-        startPage();
+    public AjaxResult list(Area area)
+    {
         List<Area> list = areaService.selectAreaList(area);
-        return getDataTable(list);
-    }
-
-    /**
-     * 查询服务区列表 (根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
-     */
-    @GetMapping("/listWithFacsCategory")
-    public AjaxResult listWithFacsCategory(@RequestParam(name = "facsCategory") String facsCategory,
-        @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory) {
-        List<Area> list = areaService.selectWithFacsCategory(facsCategory, facsSubCategory);
-        return success(list);
-    }
-
-    /**
-     * 查询服务区列表 (根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
-     */
-    @GetMapping("/listWithFacsCategoryAsTree")
-    public AjaxResult listWithFacsCategoryAsTree(@RequestParam(name = "facsCategory") String facsCategory,
-        @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory) {
-        List<Area> areas = areaService.selectWithFacsCategory(facsCategory, facsSubCategory);
-        List<TreeEntity> retList = new ArrayList<>();
-
-        for (Area area : areas) {
-            TreeEntity tree = new TreeEntity();
-            tree.setId(area.getAreaCode());
-            tree.setLabel(area.getAreaName());
-            retList.add(tree);
-        }
-
-        return success(retList);
-    }
-
-    /**
-     * 查询服务区基本信息列表
-     */
-    @RequiresPermissions("basecfg:area:list")
-    @GetMapping("/listTotal")
-    public AjaxResult listTotal() {
-        List<Area> list = areaService.selectAreaList(new Area());
         return success(list);
     }
 
     /**
-     * 导出服务区列表
+     * 导出区域对象列表
      */
-    @RequiresPermissions("basecfg:area:export")
-    @Log(title = "区块划分", businessType = BusinessType.EXPORT)
+    @RequiresPermissions("ems:area:export")
+    @Log(title = "区域对象", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, Area area) {
+    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, "服务区数据");
+        util.exportExcel(response, list, "区域对象数据");
     }
 
     /**
-     * 获取服务区详细信息
+     * 获取区域对象详细信息
      */
-    @RequiresPermissions("basecfg:area:query")
+    @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));
     }
 
     /**
-     * 获取服务区树
-     *
-     * @param tier 层级 Area、Building、Zoning
-     * @return 区域位置树
-     */
-    @GetMapping(value = "/areaTree")
-    public AjaxResult getAreaTree(@RequestParam(name = "tier") String tier) {
-        return success(areaService.selectAreaTreeList(tier));
-    }
-
-    /**
-     * 获取服务区树
-     *
-     * @param tier    层级 Area、Building、Zoning
-     * @param tagCode 标签
-     * @return 区域位置树
-     */
-    @GetMapping(value = "/areaTreeByTag")
-    public AjaxResult getCoTree(@RequestParam(name = "tier") String tier,
-        @RequestParam(name = "tagCode") String tagCode) {
-        return success(areaService.selectAreaTreeByTag(tier, tagCode));
-    }
-
-    /**
-     * 获取服务区树
-     *
-     * @param tier 层级 Area、Building、Zoning
-     * @param code 代码
-     * @return 区域位置树
-     */
-    @GetMapping(value = "/areaTreeByCode")
-    public AjaxResult getAreaTreeByCode(@RequestParam(name = "tier") String tier,
-        @RequestParam(name = "code") String code) {
-        return success(areaService.selectAreaTreeByCode(tier, code));
-    }
-
-    /**
-     * 新增服务区
+     * 新增区域对象
      */
-    @RequiresPermissions("basecfg:area:add")
-    @Log(title = "区块划分", businessType = BusinessType.INSERT)
+    @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));
     }
 
     /**
-     * 修改服务
+     * 修改区域对象
      */
-    @RequiresPermissions("basecfg:area:edit")
-    @Log(title = "区块划分", businessType = BusinessType.UPDATE)
+    @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));
     }
 
     /**
-     * 删除服务
+     * 删除区域对象
      */
-    @RequiresPermissions("basecfg:area:remove")
-    @Log(title = "区块划分", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
+    @RequiresPermissions("ems:area:remove")
+    @Log(title = "区域对象", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
         return toAjax(areaService.deleteAreaByIds(ids));
     }
 }

+ 185 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaOldController.java

@@ -0,0 +1,185 @@
+package com.ruoyi.ems.controller;
+
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.web.page.TableDataInfo;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.ems.domain.AreaOld;
+import com.ruoyi.ems.model.TreeEntity;
+import com.ruoyi.ems.service.IAreaOldService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+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 javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 服务区Controller
+ *
+ * @author ruoyi
+ * @date 2024-07-09
+ */
+@RestController
+@RequestMapping("/basecfg/areaold")
+@Api(value = "AreaController", description = "地块管理")
+public class AreaOldController extends BaseController {
+    @Autowired
+    private IAreaOldService areaService;
+
+    /**
+     * 查询服务区列表
+     */
+    @RequiresPermissions("basecfg:area:list")
+    @GetMapping("/list")
+    public TableDataInfo list(AreaOld area) {
+        startPage();
+        List<AreaOld> list = areaService.selectAreaList(area);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询服务区列表 (根据下挂设施)
+     *
+     * @param facsCategory    设施类别
+     * @param facsSubCategory 设施子类别
+     */
+    @GetMapping("/listWithFacsCategory")
+    public AjaxResult listWithFacsCategory(@RequestParam(name = "facsCategory") String facsCategory,
+        @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory) {
+        List<AreaOld> list = areaService.selectWithFacsCategory(facsCategory, facsSubCategory);
+        return success(list);
+    }
+
+    /**
+     * 查询服务区列表 (根据下挂设施)
+     *
+     * @param facsCategory    设施类别
+     * @param facsSubCategory 设施子类别
+     */
+    @GetMapping("/listWithFacsCategoryAsTree")
+    public AjaxResult listWithFacsCategoryAsTree(@RequestParam(name = "facsCategory") String facsCategory,
+        @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory) {
+        List<AreaOld> areas = areaService.selectWithFacsCategory(facsCategory, facsSubCategory);
+        List<TreeEntity> retList = new ArrayList<>();
+
+        for (AreaOld area : areas) {
+            TreeEntity tree = new TreeEntity();
+            tree.setId(area.getAreaCode());
+            tree.setLabel(area.getAreaName());
+            retList.add(tree);
+        }
+
+        return success(retList);
+    }
+
+    /**
+     * 查询服务区基本信息列表
+     */
+    @RequiresPermissions("basecfg:area:list")
+    @GetMapping("/listTotal")
+    public AjaxResult listTotal() {
+        List<AreaOld> list = areaService.selectAreaList(new AreaOld());
+        return success(list);
+    }
+
+    /**
+     * 导出服务区列表
+     */
+    @RequiresPermissions("basecfg:area:export")
+    @Log(title = "区块划分", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, AreaOld area) {
+        List<AreaOld> list = areaService.selectAreaList(area);
+        ExcelUtil<AreaOld> util = new ExcelUtil<AreaOld>(AreaOld.class);
+        util.exportExcel(response, list, "服务区数据");
+    }
+
+    /**
+     * 获取服务区详细信息
+     */
+    @RequiresPermissions("basecfg:area:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(areaService.selectAreaById(id));
+    }
+
+    /**
+     * 获取服务区树
+     *
+     * @param tier 层级 Area、Building、Zoning
+     * @return 区域位置树
+     */
+    @GetMapping(value = "/areaTree")
+    public AjaxResult getAreaTree(@RequestParam(name = "tier") String tier) {
+        return success(areaService.selectAreaTreeList(tier));
+    }
+
+    /**
+     * 获取服务区树
+     *
+     * @param tier    层级 Area、Building、Zoning
+     * @param tagCode 标签
+     * @return 区域位置树
+     */
+    @GetMapping(value = "/areaTreeByTag")
+    public AjaxResult getCoTree(@RequestParam(name = "tier") String tier,
+        @RequestParam(name = "tagCode") String tagCode) {
+        return success(areaService.selectAreaTreeByTag(tier, tagCode));
+    }
+
+    /**
+     * 获取服务区树
+     *
+     * @param tier 层级 Area、Building、Zoning
+     * @param code 代码
+     * @return 区域位置树
+     */
+    @GetMapping(value = "/areaTreeByCode")
+    public AjaxResult getAreaTreeByCode(@RequestParam(name = "tier") String tier,
+        @RequestParam(name = "code") String code) {
+        return success(areaService.selectAreaTreeByCode(tier, code));
+    }
+
+    /**
+     * 新增服务区
+     */
+    @RequiresPermissions("basecfg:area:add")
+    @Log(title = "区块划分", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AreaOld area) {
+        return toAjax(areaService.insertArea(area));
+    }
+
+    /**
+     * 修改服务区
+     */
+    @RequiresPermissions("basecfg:area:edit")
+    @Log(title = "区块划分", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AreaOld area) {
+        return toAjax(areaService.updateArea(area));
+    }
+
+    /**
+     * 删除服务区
+     */
+    @RequiresPermissions("basecfg:area:remove")
+    @Log(title = "区块划分", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(areaService.deleteAreaByIds(ids));
+    }
+}

+ 59 - 171
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/Area.java

@@ -1,228 +1,122 @@
 package com.ruoyi.ems.domain;
 
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.core.annotation.Excel;
-import com.ruoyi.common.core.web.domain.BaseEntity;
+import com.ruoyi.common.core.web.domain.TreeEntity;
 
 /**
- * 服务区对象 adm_service_area
- * 
+ * 区域对象对象 adm_area
+ *
  * @author ruoyi
- * @date 2024-07-09
+ * @date 2024-11-01
  */
-public class Area extends BaseEntity
+public class Area extends TreeEntity
 {
     private static final long serialVersionUID = 1L;
 
     /** 序号 */
     private Long id;
 
-    /** 服务区代码 */
-    @Excel(name = "服务区代码")
+    /** 区代码 */
+    @Excel(name = "区代码")
     private String areaCode;
 
-    /** 服务区名称 */
-    @Excel(name = "服务区名称")
+    /** 上级区域代码 */
+    @Excel(name = "上级区域代码")
+    private String parentCode;
+
+    /** 区域名称 */
+    @Excel(name = "区域名称")
     private String areaName;
 
-    @Excel(name = "服务区简称")
+    /** 区域简称 */
+    @Excel(name = "区域简称")
     private String shortName;
 
-    /** 服务星级 */
-    @Excel(name = "服务星级")
-    private Long serviceStar;
-
-    /** 所在城市 */
-    @Excel(name = "所在城市")
-    private String city;
-
-    /** 所在高速 */
-    @Excel(name = "所在高速")
-    private String highway;
-
-    /** 方向 */
-    @Excel(name = "方向")
-    private String direction;
-
-    /** 地址 */
-    @Excel(name = "地址")
-    private String address;
-
-    /** 所有单位 */
-    @Excel(name = "所有单位")
-    private String attrOrg;
-
-    /** 所有单位 */
-    @Excel(name = "管理单位")
-    private String mgrOrg;
-
-    /** 开业时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "开业时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date openDate;
+    /** 区域简称 */
+    @Excel(name = "区域简称")
+    private String desc;
 
-    /** 占地面积(亩) */
-    @Excel(name = "占地面积(亩)")
-    private Long landArea;
+    /** 区域状态 */
+    @Excel(name = "区域状态")
+    private Integer status;
 
-    /** 建筑面积(平方米) */
-    @Excel(name = "建筑面积(平方米)")
-    private Long floorArea;
+    /**
+     * 区域属性
+     */
+    private AreaAttr areaAttr;
 
-    /** 经度 */
-    @Excel(name = "经度")
-    private Double longitude;
-
-    /** 纬度 */
-    @Excel(name = "纬度")
-    private Double latitude;
-
-    public void setId(Long id) 
+    public void setId(Long id)
     {
         this.id = id;
     }
 
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setAreaCode(String areaCode) 
+    public void setAreaCode(String areaCode)
     {
         this.areaCode = areaCode;
     }
 
-    public String getAreaCode() 
+    public String getAreaCode()
     {
         return areaCode;
     }
-    public void setAreaName(String areaName) 
-    {
-        this.areaName = areaName;
-    }
-
-    public String getAreaName() 
-    {
-        return areaName;
-    }
-
-    public String getShortName() {
-        return shortName;
-    }
-
-    public void setShortName(String shortName) {
-        this.shortName = shortName;
-    }
-
-    public void setServiceStar(Long serviceStar)
+    public void setParentCode(String parentCode)
     {
-        this.serviceStar = serviceStar;
+        this.parentCode = parentCode;
     }
 
-    public Long getServiceStar() 
-    {
-        return serviceStar;
-    }
-    public void setCity(String city) 
+    public String getParentCode()
     {
-        this.city = city;
+        return parentCode;
     }
-
-    public String getCity() 
+    public void setAreaName(String areaName)
     {
-        return city;
-    }
-    public void setHighway(String highway) 
-    {
-        this.highway = highway;
-    }
-
-    public String getHighway() 
-    {
-        return highway;
-    }
-    public void setDirection(String direction) 
-    {
-        this.direction = direction;
-    }
-
-    public String getDirection() 
-    {
-        return direction;
-    }
-    public void setAddress(String address) 
-    {
-        this.address = address;
-    }
-
-    public String getAddress() 
-    {
-        return address;
-    }
-    public void setAttrOrg(String attrOrg) 
-    {
-        this.attrOrg = attrOrg;
-    }
-
-    public String getAttrOrg() 
-    {
-        return attrOrg;
-    }
-    public void setMgrOrg(String mgrOrg) 
-    {
-        this.mgrOrg = mgrOrg;
+        this.areaName = areaName;
     }
 
-    public String getMgrOrg() 
+    public String getAreaName()
     {
-        return mgrOrg;
+        return areaName;
     }
-    public void setOpenDate(Date openDate) 
+    public void setShortName(String shortName)
     {
-        this.openDate = openDate;
+        this.shortName = shortName;
     }
 
-    public Date getOpenDate() 
+    public String getShortName()
     {
-        return openDate;
+        return shortName;
     }
-    public void setLandArea(Long landArea) 
+    public void setDesc(String desc)
     {
-        this.landArea = landArea;
+        this.desc = desc;
     }
 
-    public Long getLandArea() 
+    public String getDesc()
     {
-        return landArea;
+        return desc;
     }
-    public void setFloorArea(Long floorArea) 
+    public void setStatus(Integer status)
     {
-        this.floorArea = floorArea;
+        this.status = status;
     }
 
-    public Long getFloorArea() 
-    {
-        return floorArea;
-    }
-    public void setLongitude(Double longitude)
+    public Integer getStatus()
     {
-        this.longitude = longitude;
+        return status;
     }
 
-    public Double getLongitude()
-    {
-        return longitude;
-    }
-    public void setLatitude(Double latitude)
-    {
-        this.latitude = latitude;
+    public AreaAttr getAreaAttr() {
+        return areaAttr;
     }
 
-    public Double getLatitude()
-    {
-        return latitude;
+    public void setAreaAttr(AreaAttr areaAttr) {
+        this.areaAttr = areaAttr;
     }
 
     @Override
@@ -230,20 +124,14 @@ public class Area extends BaseEntity
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("id", getId())
             .append("areaCode", getAreaCode())
+            .append("parentCode", getParentCode())
+            .append("ancestors", getAncestors())
             .append("areaName", getAreaName())
             .append("shortName", getShortName())
-            .append("serviceStar", getServiceStar())
-            .append("city", getCity())
-            .append("highway", getHighway())
-            .append("direction", getDirection())
-            .append("address", getAddress())
-            .append("attrOrg", getAttrOrg())
-            .append("mgrOrg", getMgrOrg())
-            .append("openDate", getOpenDate())
-            .append("landArea", getLandArea())
-            .append("floorArea", getFloorArea())
-            .append("longitude", getLongitude())
-            .append("latitude", getLatitude())
+            .append("desc", getDesc())
+            .append("orderNum", getOrderNum())
+            .append("status", getStatus())
+            .append("areaAttr", getAreaAttr() != null ? getAreaAttr().toString() : "")
             .toString();
     }
 }

+ 192 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaAttr.java

@@ -0,0 +1,192 @@
+package com.ruoyi.ems.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 区域对象属性对象 adm_area_attr
+ * 
+ * @author ruoyi
+ * @date 2024-11-01
+ */
+public class AreaAttr
+{
+    /** 序号 */
+    private Long id;
+
+    /** 区域代码 */
+    @Excel(name = "区域代码")
+    private String areaCode;
+
+    /** 所有单位 */
+    @Excel(name = "所有单位")
+    private String attrOrg;
+
+    /** 管理单位 */
+    @Excel(name = "管理单位")
+    private String mgrOrg;
+
+    /** 负责人 */
+    @Excel(name = "负责人")
+    private String leader;
+
+    /** 联系电话 */
+    @Excel(name = "联系电话")
+    private String phone;
+
+    /** 开通时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开通时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date openDate;
+
+    /** 建筑面积(平方米 m²) */
+    @Excel(name = "建筑面积")
+    private Long floorArea;
+
+    /** 使用面积(平方米 m²) */
+    @Excel(name = "使用面积")
+    private Long usableArea;
+
+    /** 楼层 */
+    @Excel(name = "楼层")
+    private Long floor;
+
+    /** 经度 */
+    @Excel(name = "经度")
+    private Long longitude;
+
+    /** 纬度 */
+    @Excel(name = "纬度")
+    private Long latitude;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setAreaCode(String areaCode) 
+    {
+        this.areaCode = areaCode;
+    }
+
+    public String getAreaCode() 
+    {
+        return areaCode;
+    }
+    public void setAttrOrg(String attrOrg) 
+    {
+        this.attrOrg = attrOrg;
+    }
+
+    public String getAttrOrg() 
+    {
+        return attrOrg;
+    }
+    public void setMgrOrg(String mgrOrg) 
+    {
+        this.mgrOrg = mgrOrg;
+    }
+
+    public String getMgrOrg() 
+    {
+        return mgrOrg;
+    }
+    public void setLeader(String leader) 
+    {
+        this.leader = leader;
+    }
+
+    public String getLeader() 
+    {
+        return leader;
+    }
+    public void setPhone(String phone) 
+    {
+        this.phone = phone;
+    }
+
+    public String getPhone() 
+    {
+        return phone;
+    }
+    public void setOpenDate(Date openDate) 
+    {
+        this.openDate = openDate;
+    }
+
+    public Date getOpenDate() 
+    {
+        return openDate;
+    }
+    public void setFloorArea(Long floorArea) 
+    {
+        this.floorArea = floorArea;
+    }
+
+    public Long getFloorArea() 
+    {
+        return floorArea;
+    }
+    public void setUsableArea(Long usableArea) 
+    {
+        this.usableArea = usableArea;
+    }
+
+    public Long getUsableArea() 
+    {
+        return usableArea;
+    }
+    public void setFloor(Long floor) 
+    {
+        this.floor = floor;
+    }
+
+    public Long getFloor() 
+    {
+        return floor;
+    }
+    public void setLongitude(Long longitude) 
+    {
+        this.longitude = longitude;
+    }
+
+    public Long getLongitude() 
+    {
+        return longitude;
+    }
+    public void setLatitude(Long latitude) 
+    {
+        this.latitude = latitude;
+    }
+
+    public Long getLatitude() 
+    {
+        return latitude;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("areaCode", getAreaCode())
+            .append("attrOrg", getAttrOrg())
+            .append("mgrOrg", getMgrOrg())
+            .append("leader", getLeader())
+            .append("phone", getPhone())
+            .append("openDate", getOpenDate())
+            .append("floorArea", getFloorArea())
+            .append("usableArea", getUsableArea())
+            .append("floor", getFloor())
+            .append("longitude", getLongitude())
+            .append("latitude", getLatitude())
+            .toString();
+    }
+}

+ 249 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaOld.java

@@ -0,0 +1,249 @@
+package com.ruoyi.ems.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 服务区对象 adm_service_area
+ * 
+ * @author ruoyi
+ * @date 2024-07-09
+ */
+public class AreaOld extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 服务区代码 */
+    @Excel(name = "服务区代码")
+    private String areaCode;
+
+    /** 服务区名称 */
+    @Excel(name = "服务区名称")
+    private String areaName;
+
+    @Excel(name = "服务区简称")
+    private String shortName;
+
+    /** 服务星级 */
+    @Excel(name = "服务星级")
+    private Long serviceStar;
+
+    /** 所在城市 */
+    @Excel(name = "所在城市")
+    private String city;
+
+    /** 所在高速 */
+    @Excel(name = "所在高速")
+    private String highway;
+
+    /** 方向 */
+    @Excel(name = "方向")
+    private String direction;
+
+    /** 地址 */
+    @Excel(name = "地址")
+    private String address;
+
+    /** 所有单位 */
+    @Excel(name = "所有单位")
+    private String attrOrg;
+
+    /** 所有单位 */
+    @Excel(name = "管理单位")
+    private String mgrOrg;
+
+    /** 开业时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开业时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date openDate;
+
+    /** 占地面积(亩) */
+    @Excel(name = "占地面积(亩)")
+    private Long landArea;
+
+    /** 建筑面积(平方米) */
+    @Excel(name = "建筑面积(平方米)")
+    private Long floorArea;
+
+    /** 经度 */
+    @Excel(name = "经度")
+    private Double longitude;
+
+    /** 纬度 */
+    @Excel(name = "纬度")
+    private Double latitude;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setAreaCode(String areaCode) 
+    {
+        this.areaCode = areaCode;
+    }
+
+    public String getAreaCode() 
+    {
+        return areaCode;
+    }
+    public void setAreaName(String areaName) 
+    {
+        this.areaName = areaName;
+    }
+
+    public String getAreaName() 
+    {
+        return areaName;
+    }
+
+    public String getShortName() {
+        return shortName;
+    }
+
+    public void setShortName(String shortName) {
+        this.shortName = shortName;
+    }
+
+    public void setServiceStar(Long serviceStar)
+    {
+        this.serviceStar = serviceStar;
+    }
+
+    public Long getServiceStar() 
+    {
+        return serviceStar;
+    }
+    public void setCity(String city) 
+    {
+        this.city = city;
+    }
+
+    public String getCity() 
+    {
+        return city;
+    }
+    public void setHighway(String highway) 
+    {
+        this.highway = highway;
+    }
+
+    public String getHighway() 
+    {
+        return highway;
+    }
+    public void setDirection(String direction) 
+    {
+        this.direction = direction;
+    }
+
+    public String getDirection() 
+    {
+        return direction;
+    }
+    public void setAddress(String address) 
+    {
+        this.address = address;
+    }
+
+    public String getAddress() 
+    {
+        return address;
+    }
+    public void setAttrOrg(String attrOrg) 
+    {
+        this.attrOrg = attrOrg;
+    }
+
+    public String getAttrOrg() 
+    {
+        return attrOrg;
+    }
+    public void setMgrOrg(String mgrOrg) 
+    {
+        this.mgrOrg = mgrOrg;
+    }
+
+    public String getMgrOrg() 
+    {
+        return mgrOrg;
+    }
+    public void setOpenDate(Date openDate) 
+    {
+        this.openDate = openDate;
+    }
+
+    public Date getOpenDate() 
+    {
+        return openDate;
+    }
+    public void setLandArea(Long landArea) 
+    {
+        this.landArea = landArea;
+    }
+
+    public Long getLandArea() 
+    {
+        return landArea;
+    }
+    public void setFloorArea(Long floorArea) 
+    {
+        this.floorArea = floorArea;
+    }
+
+    public Long getFloorArea() 
+    {
+        return floorArea;
+    }
+    public void setLongitude(Double longitude)
+    {
+        this.longitude = longitude;
+    }
+
+    public Double getLongitude()
+    {
+        return longitude;
+    }
+    public void setLatitude(Double latitude)
+    {
+        this.latitude = latitude;
+    }
+
+    public Double getLatitude()
+    {
+        return latitude;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("areaCode", getAreaCode())
+            .append("areaName", getAreaName())
+            .append("shortName", getShortName())
+            .append("serviceStar", getServiceStar())
+            .append("city", getCity())
+            .append("highway", getHighway())
+            .append("direction", getDirection())
+            .append("address", getAddress())
+            .append("attrOrg", getAttrOrg())
+            .append("mgrOrg", getMgrOrg())
+            .append("openDate", getOpenDate())
+            .append("landArea", getLandArea())
+            .append("floorArea", getFloorArea())
+            .append("longitude", getLongitude())
+            .append("latitude", getLatitude())
+            .toString();
+    }
+}

+ 54 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaAttrMapper.java

@@ -0,0 +1,54 @@
+package com.ruoyi.ems.mapper;
+
+import com.ruoyi.ems.domain.AreaAttr;
+
+import java.util.List;
+
+/**
+ * 区域对象属性Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-11-01
+ */
+public interface AreaAttrMapper
+{
+    /**
+     * 查询区域对象属性
+     * 
+     * @param areaCode 区域对象代码
+     * @return 区域对象属性
+     */
+     AreaAttr selectAreaAttrByCode(String areaCode);
+
+    /**
+     * 查询区域对象属性列表
+     * 
+     * @param list 区域对象代码集合
+     * @return 区域对象属性集合
+     */
+     List<AreaAttr> selectAreaAttrList(List<String> list);
+
+    /**
+     * 新增区域对象属性
+     * 
+     * @param areaAttr 区域对象属性
+     * @return 结果
+     */
+     int insertAreaAttr(AreaAttr areaAttr);
+
+    /**
+     * 修改区域对象属性
+     * 
+     * @param areaAttr 区域对象属性
+     * @return 结果
+     */
+     int updateAreaAttr(AreaAttr areaAttr);
+
+    /**
+     * 删除区域对象属性
+     * 
+     * @param areaCode 区域对象代码
+     * @return 结果
+     */
+     int deleteAreaAttrByCode(String areaCode);
+}

+ 18 - 36
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaMapper.java

@@ -3,74 +3,56 @@ package com.ruoyi.ems.mapper;
 import java.util.List;
 
 import com.ruoyi.ems.domain.Area;
-import org.apache.ibatis.annotations.Param;
 
 /**
- * 服务区Mapper接口
+ * 区域对象Mapper接口
  *
  * @author ruoyi
- * @date 2024-07-09
+ * @date 2024-11-01
  */
 public interface AreaMapper {
     /**
-     * 查询服务
+     * 查询区域对象
      *
-     * @param id 服务区主键
-     * @return 服务
+     * @param id 区域对象主键
+     * @return 区域对象
      */
     Area selectAreaById(Long id);
 
     /**
-     * 查询服务
+     * 查询区域对象列表
      *
-     * @param code 服务区主键
-     * @return 服务
+     * @param admArea 区域对象
+     * @return 区域对象集合
      */
-    Area selectAreaByCode(String code);
+    List<Area> selectAreaList(Area admArea);
 
     /**
-     * 查询服务区列表
+     * 新增区域对象
      *
-     * @param admServiceArea 服务区
-     * @return 服务区集合
-     */
-    List<Area> selectAreaList(Area admServiceArea);
-
-    /**
-     * 查询服务区列表(根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
-     */
-    List<Area> selectWithFacsCategory(@Param("facsCategory") String facsCategory,
-        @Param("facsSubCategory") String facsSubCategory);
-
-    /**
-     * 新增服务区
-     *
-     * @param admServiceArea 服务区
+     * @param admArea 区域对象
      * @return 结果
      */
-    int insertArea(Area admServiceArea);
+    int insertArea(Area admArea);
 
     /**
-     * 修改服务
+     * 修改区域对象
      *
-     * @param admServiceArea 服务
+     * @param admArea 区域对象
      * @return 结果
      */
-    int updateArea(Area admServiceArea);
+    int updateArea(Area admArea);
 
     /**
-     * 删除服务
+     * 删除区域对象
      *
-     * @param id 服务区主键
+     * @param id 区域对象主键
      * @return 结果
      */
     int deleteAreaById(Long id);
 
     /**
-     * 批量删除服务
+     * 批量删除区域对象
      *
      * @param ids 需要删除的数据主键集合
      * @return 结果

+ 79 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaOldMapper.java

@@ -0,0 +1,79 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.AreaOld;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 服务区Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-07-09
+ */
+public interface AreaOldMapper {
+    /**
+     * 查询服务区
+     *
+     * @param id 服务区主键
+     * @return 服务区
+     */
+    AreaOld selectAreaById(Long id);
+
+    /**
+     * 查询服务区
+     *
+     * @param code 服务区主键
+     * @return 服务区
+     */
+    AreaOld selectAreaByCode(String code);
+
+    /**
+     * 查询服务区列表
+     *
+     * @param admServiceArea 服务区
+     * @return 服务区集合
+     */
+    List<AreaOld> selectAreaList(AreaOld admServiceArea);
+
+    /**
+     * 查询服务区列表(根据下挂设施)
+     *
+     * @param facsCategory    设施类别
+     * @param facsSubCategory 设施子类别
+     */
+    List<AreaOld> selectWithFacsCategory(@Param("facsCategory") String facsCategory,
+        @Param("facsSubCategory") String facsSubCategory);
+
+    /**
+     * 新增服务区
+     *
+     * @param admServiceArea 服务区
+     * @return 结果
+     */
+    int insertArea(AreaOld admServiceArea);
+
+    /**
+     * 修改服务区
+     *
+     * @param admServiceArea 服务区
+     * @return 结果
+     */
+    int updateArea(AreaOld admServiceArea);
+
+    /**
+     * 删除服务区
+     *
+     * @param id 服务区主键
+     * @return 结果
+     */
+    int deleteAreaById(Long id);
+
+    /**
+     * 批量删除服务区
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteAreaByIds(Long[] ids);
+}

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

@@ -11,7 +11,7 @@
 package com.ruoyi.ems.model;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
-import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaOld;
 import com.ruoyi.ems.domain.AreaBuilding;
 import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.domain.EmsCls;
@@ -51,7 +51,7 @@ public class TreeEntity {
 
     }
 
-    public TreeEntity(Area area) {
+    public TreeEntity(AreaOld area) {
         this.id = area.getAreaCode();
         this.label = area.getAreaName();
         this.tier = AreaTier.Area.name();

+ 53 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaAttrService.java

@@ -0,0 +1,53 @@
+package com.ruoyi.ems.service;
+
+import com.ruoyi.ems.domain.AreaAttr;
+
+import java.util.List;
+
+/**
+ * 区域对象属性Service接口
+ *
+ * @author ruoyi
+ * @date 2024-11-01
+ */
+public interface IAreaAttrService {
+    /**
+     * 查询区域对象属性
+     *
+     * @param areaCode 区域对象代码
+     * @return 区域对象属性
+     */
+    AreaAttr selectAreaAttrByCode(String areaCode);
+
+    /**
+     * 查询区域对象属性列表
+     *
+     * @param areaCodes 区域对象属性列表
+     * @return 区域对象属性集合
+     */
+    List<AreaAttr> selectAreaAttrList(List<String> areaCodes);
+
+    /**
+     * 新增区域对象属性
+     *
+     * @param areaAttr 区域对象属性
+     * @return 结果
+     */
+    int insertAreaAttr(AreaAttr areaAttr);
+
+    /**
+     * 修改区域对象属性
+     *
+     * @param areaAttr 区域对象属性
+     * @return 结果
+     */
+    int updateAreaAttr(AreaAttr areaAttr);
+
+    /**
+     * 删除区域对象属性信息
+     *
+     * @param areaCode 区域对象代码
+     * @return 结果
+     */
+    int deleteAreaAttrByCode(String areaCode);
+}

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

@@ -0,0 +1,104 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.AreaOld;
+import com.ruoyi.ems.model.TreeEntity;
+
+/**
+ * 服务区Service接口
+ *
+ * @author ruoyi
+ * @date 2024-07-09
+ */
+public interface IAreaOldService {
+    /**
+     * 查询服务区
+     *
+     * @param id 服务区主键
+     * @return 服务区
+     */
+    AreaOld selectAreaById(Long id);
+
+    /**
+     * 查询服务区
+     *
+     * @param code 区域编码
+     * @return 服务区
+     */
+    AreaOld selectAreaByCode(String code);
+
+    /**
+     * 查询服务区列表
+     *
+     * @param area 服务区
+     * @return 服务区集合
+     */
+    List<AreaOld> selectAreaList(AreaOld area);
+
+    /**
+     * 查询服务区列表(根据下挂设施)
+     *
+     * @param facsCategory    设施类型
+     * @param facsSubCategory 设施子类型
+     */
+    List<AreaOld> selectWithFacsCategory(String facsCategory, String facsSubCategory);
+
+    /**
+     * 查询区域位置树
+     *
+     * @param tier 层级
+     * @return 区域位置树
+     */
+    List<TreeEntity> selectAreaTreeList(String tier);
+
+    /**
+     * 查询区域位置树byCode
+     *
+     * @param tier 层级
+     * @param code 编码
+     * @return 区域位置树
+     */
+    List<TreeEntity> selectAreaTreeByCode(String tier, String code);
+
+    /**
+     * 查询区域位置树by标签
+     *
+     * @param tier 层级
+     * @param code 编码
+     * @return 区域位置树
+     */
+    List<TreeEntity> selectAreaTreeByTag(String tier, String code);
+
+    /**
+     * 新增服务区
+     *
+     * @param area 服务区
+     * @return 结果
+     */
+    int insertArea(AreaOld area);
+
+    /**
+     * 修改服务区
+     *
+     * @param area 服务区
+     * @return 结果
+     */
+    int updateArea(AreaOld area);
+
+    /**
+     * 批量删除服务区
+     *
+     * @param ids 需要删除的服务区主键集合
+     * @return 结果
+     */
+    int deleteAreaByIds(Long[] ids);
+
+    /**
+     * 删除服务区信息
+     *
+     * @param id 服务区主键
+     * @return 结果
+     */
+    int deleteAreaById(Long id);
+}

+ 16 - 59
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java

@@ -3,101 +3,58 @@ package com.ruoyi.ems.service;
 import java.util.List;
 
 import com.ruoyi.ems.domain.Area;
-import com.ruoyi.ems.model.TreeEntity;
 
 /**
- * 服务区Service接口
+ * 区域对象Service接口
  *
  * @author ruoyi
- * @date 2024-07-09
+ * @date 2024-11-01
  */
 public interface IAreaService {
     /**
-     * 查询服务
+     * 查询区域对象
      *
-     * @param id 服务区主键
-     * @return 服务
+     * @param id 区域对象主键
+     * @return 区域对象
      */
     Area selectAreaById(Long id);
 
     /**
-     * 查询服务
+     * 查询区域对象列表
      *
-     * @param code 区域编码
-     * @return 服务区
-     */
-    Area selectAreaByCode(String code);
-
-    /**
-     * 查询服务区列表
-     *
-     * @param area 服务区
-     * @return 服务区集合
+     * @param area 区域对象
+     * @return 区域对象集合
      */
     List<Area> selectAreaList(Area area);
 
     /**
-     * 查询服务区列表(根据下挂设施)
-     *
-     * @param facsCategory    设施类型
-     * @param facsSubCategory 设施子类型
-     */
-    List<Area> selectWithFacsCategory(String facsCategory, String facsSubCategory);
-
-    /**
-     * 查询区域位置树
-     *
-     * @param tier 层级
-     * @return 区域位置树
-     */
-    List<TreeEntity> selectAreaTreeList(String tier);
-
-    /**
-     * 查询区域位置树byCode
-     *
-     * @param tier 层级
-     * @param code 编码
-     * @return 区域位置树
-     */
-    List<TreeEntity> selectAreaTreeByCode(String tier, String code);
-
-    /**
-     * 查询区域位置树by标签
-     *
-     * @param tier 层级
-     * @param code 编码
-     * @return 区域位置树
-     */
-    List<TreeEntity> selectAreaTreeByTag(String tier, String code);
-
-    /**
-     * 新增服务区
+     * 新增区域对象
      *
-     * @param area 服务
+     * @param area 区域对象
      * @return 结果
      */
     int insertArea(Area area);
 
     /**
-     * 修改服务
+     * 修改区域对象
      *
-     * @param area 服务区
+     * @param Area 区域对象
      * @return 结果
      */
     int updateArea(Area area);
 
     /**
-     * 批量删除服务
+     * 批量删除区域对象
      *
-     * @param ids 需要删除的服务区主键集合
+     * @param ids 需要删除的区域对象主键集合
      * @return 结果
      */
     int deleteAreaByIds(Long[] ids);
 
     /**
-     * 删除服务区信息
+     * 删除区域对象信息
      *
-     * @param id 服务区主键
+     * @param id 区域对象主键
      * @return 结果
      */
     int deleteAreaById(Long id);

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

@@ -3,13 +3,13 @@ package com.ruoyi.ems.service.impl;
 import com.ruoyi.common.core.enums.AlarmObjType;
 import com.ruoyi.common.core.utils.DateTimeUtil;
 import com.ruoyi.ems.domain.AdmOpAlarm;
-import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaOld;
 import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsFacs;
 import com.ruoyi.ems.mapper.AdmOpAlarmMapper;
 import com.ruoyi.ems.mapper.AreaBuildingZoningMapper;
-import com.ruoyi.ems.mapper.AreaMapper;
+import com.ruoyi.ems.mapper.AreaOldMapper;
 import com.ruoyi.ems.mapper.EmsDeviceMapper;
 import com.ruoyi.ems.mapper.EmsFacsMapper;
 import com.ruoyi.ems.service.IAdmOpAlarmService;
@@ -33,7 +33,7 @@ public class AdmOpAlarmServiceImpl implements IAdmOpAlarmService {
     private AdmOpAlarmMapper admOpAlarmMapper;
 
     @Autowired
-    private AreaMapper areaMapper;
+    private AreaOldMapper areaMapper;
 
     @Autowired
     private AreaBuildingZoningMapper areaBuildingZoningMapper;
@@ -155,7 +155,7 @@ public class AdmOpAlarmServiceImpl implements IAdmOpAlarmService {
 
     private String getObjInfo(Integer objType, String objCode) {
         if (AlarmObjType.AREA.getCode().equals(objType)) {
-            Area area = areaMapper.selectAreaByCode(objCode);
+            AreaOld area = areaMapper.selectAreaByCode(objCode);
             if (ObjectUtils.isEmpty(area)) {
                 return StringUtils.EMPTY;
             }

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

@@ -0,0 +1,58 @@
+package com.ruoyi.ems.service.impl;
+
+import com.ruoyi.ems.domain.AreaAttr;
+import com.ruoyi.ems.mapper.AreaAttrMapper;
+import com.ruoyi.ems.service.IAreaAttrService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 区域对象属性Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-11-01
+ */
+@Service
+public class AreaAttrServiceImpl implements IAreaAttrService {
+    @Autowired
+    private AreaAttrMapper areaAttrMapper;
+
+    @Override
+    public AreaAttr selectAreaAttrByCode(String areaCode) {
+        return areaAttrMapper.selectAreaAttrByCode(areaCode);
+    }
+
+    @Override
+    public List<AreaAttr> selectAreaAttrList(List<String> areaCodes) {
+        return areaAttrMapper.selectAreaAttrList(areaCodes);
+    }
+
+    /**
+     * 新增区域对象属性
+     *
+     * @param admAreaAttr 区域对象属性
+     * @return 结果
+     */
+    @Override
+    public int insertAreaAttr(AreaAttr admAreaAttr) {
+        return areaAttrMapper.insertAreaAttr(admAreaAttr);
+    }
+
+    /**
+     * 修改区域对象属性
+     *
+     * @param admAreaAttr 区域对象属性
+     * @return 结果
+     */
+    @Override
+    public int updateAreaAttr(AreaAttr admAreaAttr) {
+        return areaAttrMapper.updateAreaAttr(admAreaAttr);
+    }
+
+    @Override
+    public int deleteAreaAttrByCode(String areaCode) {
+        return areaAttrMapper.deleteAreaAttrByCode(areaCode);
+    }
+}

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

@@ -0,0 +1,279 @@
+package com.ruoyi.ems.service.impl;
+
+import com.alibaba.druid.util.StringUtils;
+import com.ruoyi.common.core.enums.AreaTier;
+import com.ruoyi.ems.domain.AreaOld;
+import com.ruoyi.ems.domain.AreaBuilding;
+import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.model.TreeEntity;
+import com.ruoyi.ems.mapper.AreaOldMapper;
+import com.ruoyi.ems.service.IAreaBuildingService;
+import com.ruoyi.ems.service.IAreaBuildingZoningService;
+import com.ruoyi.ems.service.IAreaOldService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 服务区Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-07-09
+ */
+@Service
+public class AreaOldServiceImpl implements IAreaOldService {
+    @Autowired
+    private AreaOldMapper areaMapper;
+
+    @Autowired
+    private IAreaBuildingService buildingService;
+
+    @Autowired
+    private IAreaBuildingZoningService zoningService;
+
+    /**
+     * 查询服务区
+     *
+     * @param id 服务区主键
+     * @return 服务区
+     */
+    @Override
+    public AreaOld selectAreaById(Long id) {
+        return areaMapper.selectAreaById(id);
+    }
+
+    /**
+     * 查询服务区
+     *
+     * @param code 服务区代码
+     * @return 服务区
+     */
+    @Override
+    public AreaOld selectAreaByCode(String code) {
+        return areaMapper.selectAreaByCode(code);
+    }
+
+    /**
+     * 查询服务区列表
+     *
+     * @param area 服务区
+     * @return 服务区
+     */
+    @Override
+    public List<AreaOld> selectAreaList(AreaOld area) {
+        return areaMapper.selectAreaList(area);
+    }
+
+    /**
+     * 查询服务区列表(根据下挂设施)
+     *
+     * @param facsCategory    设施类别
+     * @param facsSubCategory 设施子类别
+     */
+    @Override
+    public List<AreaOld> selectWithFacsCategory(String facsCategory, String facsSubCategory) {
+        return areaMapper.selectWithFacsCategory(facsCategory, facsSubCategory);
+    }
+
+    /**
+     * 新增服务区
+     *
+     * @param area 服务区
+     * @return 结果
+     */
+    @Override
+    public int insertArea(AreaOld area) {
+        return areaMapper.insertArea(area);
+    }
+
+    /**
+     * 修改服务区
+     *
+     * @param area 服务区
+     * @return 结果
+     */
+    @Override
+    public int updateArea(AreaOld area) {
+        return areaMapper.updateArea(area);
+    }
+
+    /**
+     * 批量删除服务区
+     *
+     * @param ids 需要删除的服务区主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAreaByIds(Long[] ids) {
+        for (Long id : ids) {
+            deleteRel(id);
+        }
+
+        return areaMapper.deleteAreaByIds(ids);
+    }
+
+    /**
+     * 删除服务区信息
+     *
+     * @param id 服务区主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAreaById(Long id) {
+        deleteRel(id);
+        return areaMapper.deleteAreaById(id);
+    }
+
+    @Override
+    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);
+            });
+        }
+
+        return entities;
+    }
+
+    @Override
+    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);
+            }
+        }
+
+        return retList;
+    }
+
+    @Override
+    public List<TreeEntity> selectAreaTreeByTag(String tier, String tagCode) {
+        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);
+                }
+            }
+        }
+
+        return retList;
+    }
+
+    private void deleteRel(long id) {
+        AreaOld area = areaMapper.selectAreaById(id);
+
+        if (null != area) {
+            AreaBuilding buildingParam = new AreaBuilding();
+            buildingParam.setAreaCode(area.getAreaCode());
+
+            List<AreaBuilding> buildings = buildingService.selectAreaBuildingList(buildingParam);
+
+            for (AreaBuilding building : buildings) {
+                buildingService.deleteAreaBuilding(building);
+            }
+        }
+    }
+
+    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());
+    }
+
+    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());
+    }
+}

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

@@ -1,29 +1,23 @@
 package com.ruoyi.ems.service.impl;
 
-import com.alibaba.druid.util.StringUtils;
-import com.ruoyi.common.core.enums.AreaTier;
-import com.ruoyi.ems.domain.Area;
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
-import com.ruoyi.ems.model.TreeEntity;
-import com.ruoyi.ems.mapper.AreaMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaService;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
+import com.ruoyi.ems.domain.AreaAttr;
+import com.ruoyi.ems.service.IAreaAttrService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.ems.mapper.AreaMapper;
+import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.service.IAreaService;
+
 /**
- * 服务区Service业务层处理
+ * 区域对象Service业务层处理
  *
  * @author ruoyi
- * @date 2024-07-09
+ * @date 2024-11-01
  */
 @Service
 public class AreaServiceImpl implements IAreaService {
@@ -31,249 +25,90 @@ public class AreaServiceImpl implements IAreaService {
     private AreaMapper areaMapper;
 
     @Autowired
-    private IAreaBuildingService buildingService;
-
-    @Autowired
-    private IAreaBuildingZoningService zoningService;
+    private IAreaAttrService attrService;
 
     /**
-     * 查询服务
+     * 查询区域对象
      *
-     * @param id 服务区主键
-     * @return 服务
+     * @param id 区域对象主键
+     * @return 区域对象
      */
     @Override
     public Area selectAreaById(Long id) {
-        return areaMapper.selectAreaById(id);
-    }
+        Area area = areaMapper.selectAreaById(id);
 
-    /**
-     * 查询服务区
-     *
-     * @param code 服务区代码
-     * @return 服务区
-     */
-    @Override
-    public Area selectAreaByCode(String code) {
-        return areaMapper.selectAreaByCode(code);
-    }
+        if (area != null) {
+            area.setAreaAttr(attrService.selectAreaAttrByCode(area.getAreaCode()));
+        }
 
-    /**
-     * 查询服务区列表
-     *
-     * @param area 服务区
-     * @return 服务区
-     */
-    @Override
-    public List<Area> selectAreaList(Area area) {
-        return areaMapper.selectAreaList(area);
+        return area;
     }
 
     /**
-     * 查询服务区列表(根据下挂设施)
+     * 查询区域对象列表
      *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
+     * @param Area 区域对象
+     * @return 区域对象
      */
     @Override
-    public List<Area> selectWithFacsCategory(String facsCategory, String facsSubCategory) {
-        return areaMapper.selectWithFacsCategory(facsCategory, facsSubCategory);
+    public List<Area> selectAreaList(Area Area) {
+        List<Area> list = areaMapper.selectAreaList(Area);
+        fillAreaAttr(list);
+        return list;
     }
 
     /**
-     * 新增服务
+     * 新增区域对象
      *
-     * @param area 服务区
+     * @param Area 区域对象
      * @return 结果
      */
     @Override
-    public int insertArea(Area area) {
-        return areaMapper.insertArea(area);
+    public int insertArea(Area Area) {
+        return areaMapper.insertArea(Area);
     }
 
     /**
-     * 修改服务
+     * 修改区域对象
      *
-     * @param area 服务区
+     * @param Area 区域对象
      * @return 结果
      */
     @Override
-    public int updateArea(Area area) {
-        return areaMapper.updateArea(area);
+    public int updateArea(Area Area) {
+        return areaMapper.updateArea(Area);
     }
 
     /**
-     * 批量删除服务
+     * 批量删除区域对象
      *
-     * @param ids 需要删除的服务区主键
+     * @param ids 需要删除的区域对象主键
      * @return 结果
      */
     @Override
     public int deleteAreaByIds(Long[] ids) {
-        for (Long id : ids) {
-            deleteRel(id);
-        }
-
         return areaMapper.deleteAreaByIds(ids);
     }
 
     /**
-     * 删除服务区信息
+     * 删除区域对象信息
      *
-     * @param id 服务区主键
+     * @param id 区域对象主键
      * @return 结果
      */
     @Override
     public int deleteAreaById(Long id) {
-        deleteRel(id);
         return areaMapper.deleteAreaById(id);
     }
 
-    @Override
-    public List<TreeEntity> selectAreaTreeList(String tier) {
-        List<TreeEntity> entities = null;
-
-        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-            List<Area> areas = areaMapper.selectAreaList(new Area());
-            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-        }
-        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
-            List<Area> areas = areaMapper.selectAreaList(new Area());
-            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<Area> areas = areaMapper.selectAreaList(new Area());
-            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;
-    }
-
-    @Override
-    public List<TreeEntity> selectAreaTreeByCode(String tier, String code) {
-        List<TreeEntity> retList = new ArrayList<>();
-
-        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-            Area 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;
-    }
-
-    @Override
-    public List<TreeEntity> selectAreaTreeByTag(String tier, String tagCode) {
-        List<TreeEntity> retList = new ArrayList<>();
-        List<String> tagCodes = Arrays.asList(tagCode);
-
-        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-            List<Area> areas = areaMapper.selectAreaList(new Area());
-            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;
-                    }
-                }
+    private void fillAreaAttr(List<Area> list) {
+        List<String> codes = list.stream().map(Area::getAreaCode).distinct().collect(Collectors.toList());
+        List<AreaAttr> areaAttrs = attrService.selectAreaAttrList(codes);
+        Map<String, AreaAttr> map = areaAttrs.stream()
+            .collect(Collectors.toMap(AreaAttr::getAreaCode, Function.identity()));
 
-                if (flag) {
-                    retList.add(area);
-                }
-            }
+        for (Area area : list) {
+            area.setAreaAttr(map.get(area.getAreaCode()));
         }
-        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
-            List<Area> areas = areaMapper.selectAreaList(new Area());
-            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;
-    }
-
-    private void deleteRel(long id) {
-        Area area = areaMapper.selectAreaById(id);
-
-        if (null != area) {
-            AreaBuilding buildingParam = new AreaBuilding();
-            buildingParam.setAreaCode(area.getAreaCode());
-
-            List<AreaBuilding> buildings = buildingService.selectAreaBuildingList(buildingParam);
-
-            for (AreaBuilding building : buildings) {
-                buildingService.deleteAreaBuilding(building);
-            }
-        }
-    }
-
-    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());
-    }
-
-    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());
     }
 }

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

@@ -16,7 +16,7 @@ import com.ruoyi.common.core.enums.MeterObjTag;
 import com.ruoyi.common.core.enums.MeterObjType;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.StringUtils;
-import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaOld;
 import com.ruoyi.ems.domain.AreaBuilding;
 import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.domain.ChargingBill;
@@ -30,7 +30,7 @@ import com.ruoyi.ems.mapper.MeterDeviceMapper;
 import com.ruoyi.ems.mapper.MeterReadingMapper;
 import com.ruoyi.ems.service.IAreaBuildingService;
 import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaService;
+import com.ruoyi.ems.service.IAreaOldService;
 import com.ruoyi.ems.service.IChargingBillService;
 import com.ruoyi.ems.service.ICoChargingConfigService;
 import org.apache.commons.collections4.MapUtils;
@@ -68,7 +68,7 @@ public class ChargingBillServiceImpl implements IChargingBillService {
     private MeterDeviceMapper meterDeviceMapper;
 
     @Autowired
-    private IAreaService areaService;
+    private IAreaOldService areaService;
 
     @Autowired
     private IAreaBuildingService buildingService;
@@ -466,7 +466,7 @@ public class ChargingBillServiceImpl implements IChargingBillService {
         String objName = "未知";
 
         if (StringUtils.equals(AreaTier.Area.name(), queryParam.getTier())) {
-            Area area = areaService.selectAreaByCode(queryParam.getObjArea());
+            AreaOld area = areaService.selectAreaByCode(queryParam.getObjArea());
             objName = area != null ? area.getShortName() : "未知";
         }
         else if (StringUtils.equals(AreaTier.Building.name(), queryParam.getTier())) {

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

@@ -2,7 +2,7 @@ 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.Area;
+import com.ruoyi.ems.domain.AreaOld;
 import com.ruoyi.ems.domain.AreaBuilding;
 import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.domain.EmsDevice;
@@ -10,7 +10,7 @@ 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.IAreaService;
+import com.ruoyi.ems.service.IAreaOldService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -34,7 +34,7 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
     private EmsDeviceMapper emsDeviceMapper;
 
     @Autowired
-    private IAreaService areaService;
+    private IAreaOldService areaService;
 
     @Autowired
     private IAreaBuildingService buildingService;
@@ -172,9 +172,9 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
      */
     private void fillFieldBath(List<EmsDevice> list) {
         if (CollectionUtils.isNotEmpty(list)) {
-            List<Area> areas = areaService.selectAreaList(new Area());
-            Map<String, Area> areaMap = areas.stream()
-                .collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
+            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()));
@@ -188,10 +188,10 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
         }
     }
 
-    private void fillAreaName(EmsDevice emsDevice, Map<String, Area> areaMap, Map<String, AreaBuilding> buildingMap,
+    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())) {
-            Area area = areaMap.get(emsDevice.getLocationRef());
+            AreaOld area = areaMap.get(emsDevice.getLocationRef());
 
             if (null != area) {
                 emsDevice.setLocationRefName(area.getAreaName());
@@ -238,7 +238,7 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
 
     private void fillAreaName(EmsDevice emsDevice) {
         if (StringUtils.equals(emsDevice.getLocationType(), AreaTier.Area.name())) {
-            Area area = areaService.selectAreaByCode(emsDevice.getLocationRef());
+            AreaOld area = areaService.selectAreaByCode(emsDevice.getLocationRef());
 
             if (null != area) {
                 emsDevice.setLocationRefName(area.getAreaName());

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

@@ -9,7 +9,7 @@ import com.ruoyi.common.core.utils.DateTimeUtil;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.ExpressUtil;
 import com.ruoyi.common.core.utils.StreamUtils;
-import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaOld;
 import com.ruoyi.ems.domain.AreaBuilding;
 import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.domain.EmsDevice;
@@ -21,7 +21,7 @@ import com.ruoyi.ems.mapper.AdmEmsIndexRangeMapper;
 import com.ruoyi.ems.mapper.EmsFacsMapper;
 import com.ruoyi.ems.service.IAreaBuildingService;
 import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaService;
+import com.ruoyi.ems.service.IAreaOldService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import org.apache.commons.collections4.CollectionUtils;
@@ -55,7 +55,7 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     private IEmsDeviceService deviceService;
 
     @Autowired
-    private IAreaService areaService;
+    private IAreaOldService areaService;
 
     @Autowired
     private IAreaBuildingService buildingService;
@@ -107,13 +107,13 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     public List<TreeEntity> getFacsDevTree(QueryDevice queryDevice) {
         List<TreeEntity> retList = new ArrayList<>();
 
-        List<Area> areas = areaService.selectAreaList(new Area());
+        List<AreaOld> areas = areaService.selectAreaList(new AreaOld());
         List<AreaBuilding> buildings = buildingService.selectAreaBuildingList(new AreaBuilding());
         List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(new AreaBuildingZoning());
 
         if (StringUtils.isEmpty(queryDevice.getAreaCode())) {
             if (CollectionUtils.isNotEmpty(areas)) {
-                for (Area area : areas) {
+                for (AreaOld area : areas) {
                     EmsFacs facsParam = new EmsFacs();
                     facsParam.setRefArea(area.getAreaCode());
                     facsParam.setFacsCategory(queryDevice.getDeviceCategory());
@@ -130,7 +130,7 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
             }
         }
         else {
-            Area area = areaService.selectAreaByCode(queryDevice.getAreaCode());
+            AreaOld area = areaService.selectAreaByCode(queryDevice.getAreaCode());
 
             if (null != area) {
                 EmsFacs facsParam = new EmsFacs();
@@ -151,10 +151,10 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
         return retList;
     }
 
-    private List<TreeEntity> buildFacsDevSub(QueryDevice queryParam, List<EmsFacs> facsList, List<Area> areas,
+    private List<TreeEntity> buildFacsDevSub(QueryDevice queryParam, List<EmsFacs> facsList, List<AreaOld> areas,
         List<AreaBuilding> buildings, List<AreaBuildingZoning> zonings) {
         List<TreeEntity> retList = new ArrayList<>();
-        Map<String, Area> areaMap = areas.stream().collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
+        Map<String, AreaOld> areaMap = areas.stream().collect(Collectors.toMap(AreaOld::getAreaCode, Function.identity()));
         Map<String, AreaBuilding> buildingMap = buildings.stream()
             .collect(Collectors.toMap(AreaBuilding::getBldgCode, Function.identity()));
         Map<String, AreaBuildingZoning> zoningMap = zonings.stream()

+ 5 - 5
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/MeterDeviceServiceImpl.java

@@ -2,7 +2,7 @@ package com.ruoyi.ems.service.impl;
 
 import com.ruoyi.common.core.enums.MeterObjSubType;
 import com.ruoyi.common.core.enums.MeterObjType;
-import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaOld;
 import com.ruoyi.ems.domain.AreaBuilding;
 import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.domain.EmsDevice;
@@ -11,7 +11,7 @@ import com.ruoyi.ems.domain.MeterDevice;
 import com.ruoyi.ems.mapper.MeterDeviceMapper;
 import com.ruoyi.ems.service.IAreaBuildingService;
 import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaService;
+import com.ruoyi.ems.service.IAreaOldService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import com.ruoyi.ems.service.IMeterDeviceService;
@@ -32,7 +32,7 @@ public class MeterDeviceServiceImpl implements IMeterDeviceService {
     private MeterDeviceMapper meterDeviceMapper;
 
     @Autowired
-    private IAreaService areaService;
+    private IAreaOldService areaService;
 
     @Autowired
     private IAreaBuildingService buildingService;
@@ -131,7 +131,7 @@ public class MeterDeviceServiceImpl implements IMeterDeviceService {
         // 计量区块
         if (MeterObjType.METER_ABZ.getType() == meterDevice.getObjType()) {
             if (MeterObjSubType.METER_AREA.getType() == meterDevice.getObjSubType()) {
-                Area area = areaService.selectAreaByCode(meterDevice.getObjCode());
+                AreaOld area = areaService.selectAreaByCode(meterDevice.getObjCode());
                 meterDevice.setObjName(area != null ? area.getShortName() : "未知");
             }
             else if (MeterObjSubType.METER_BUILDING.getType() == meterDevice.getObjSubType()) {
@@ -159,7 +159,7 @@ public class MeterDeviceServiceImpl implements IMeterDeviceService {
                 EmsFacs facs = facsService.selectEmsFacsByCode(meterDevice.getObjCode());
 
                 if (facs != null) {
-                    Area area = areaService.selectAreaByCode(facs.getRefArea());
+                    AreaOld area = areaService.selectAreaByCode(facs.getRefArea());
                     meterDevice.setObjName(
                         area != null ? area.getShortName() + "/" + facs.getFacsName() : facs.getFacsName());
                 }

+ 93 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaAttrMapper.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.ems.mapper.AreaAttrMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.AreaAttr" id="areaAttrResult">
+        <result property="id"    column="id"    />
+        <result property="areaCode"    column="area_code"    />
+        <result property="attrOrg"    column="attr_org"    />
+        <result property="mgrOrg"    column="mgr_org"    />
+        <result property="leader"    column="leader"    />
+        <result property="phone"    column="phone"    />
+        <result property="openDate"    column="open_date"    />
+        <result property="floorArea"    column="floor_area"    />
+        <result property="usableArea"    column="usable_area"    />
+        <result property="floor"    column="floor"    />
+        <result property="longitude"    column="longitude"    />
+        <result property="latitude"    column="latitude"    />
+    </resultMap>
+
+    <sql id="selectAreaAttrVo">
+        select id, area_code, attr_org, mgr_org, leader, phone, open_date, floor_area, usable_area, floor, longitude, latitude from adm_area_attr
+    </sql>
+
+    <select id="selectAreaAttrList" resultMap="areaAttrResult">
+        <include refid="selectAreaAttrVo"/>
+        <where>
+            area_code in
+            (
+              <foreach collection="list" item="item" index="index" separator=",">
+                #{item}
+              </foreach>
+            )
+        </where>
+    </select>
+    
+    <select id="selectAreaAttrByCode" parameterType="String" resultMap="areaAttrResult">
+        <include refid="selectAreaAttrVo"/>
+        where area_code = #{areaCode}
+    </select>
+        
+    <insert id="insertAreaAttr" parameterType="com.ruoyi.ems.domain.AreaAttr" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_area_attr
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
+            <if test="attrOrg != null">attr_org,</if>
+            <if test="mgrOrg != null">mgr_org,</if>
+            <if test="leader != null">leader,</if>
+            <if test="phone != null">phone,</if>
+            <if test="openDate != null">open_date,</if>
+            <if test="floorArea != null">floor_area,</if>
+            <if test="usableArea != null">usable_area,</if>
+            <if test="floor != null">floor,</if>
+            <if test="longitude != null">longitude,</if>
+            <if test="latitude != null">latitude,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
+            <if test="attrOrg != null">#{attrOrg},</if>
+            <if test="mgrOrg != null">#{mgrOrg},</if>
+            <if test="leader != null">#{leader},</if>
+            <if test="phone != null">#{phone},</if>
+            <if test="openDate != null">#{openDate},</if>
+            <if test="floorArea != null">#{floorArea},</if>
+            <if test="usableArea != null">#{usableArea},</if>
+            <if test="floor != null">#{floor},</if>
+            <if test="longitude != null">#{longitude},</if>
+            <if test="latitude != null">#{latitude},</if>
+         </trim>
+    </insert>
+
+    <update id="updateAreaAttr" parameterType="com.ruoyi.ems.domain.AreaAttr">
+        update adm_area_attr
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="attrOrg != null">attr_org = #{attrOrg},</if>
+            <if test="mgrOrg != null">mgr_org = #{mgrOrg},</if>
+            <if test="leader != null">leader = #{leader},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="openDate != null">open_date = #{openDate},</if>
+            <if test="floorArea != null">floor_area = #{floorArea},</if>
+            <if test="usableArea != null">usable_area = #{usableArea},</if>
+            <if test="floor != null">floor = #{floor},</if>
+            <if test="longitude != null">longitude = #{longitude},</if>
+            <if test="latitude != null">latitude = #{latitude},</if>
+        </trim>
+        where area_code = #{areaCode}
+    </update>
+
+    <delete id="deleteAreaAttrByCode" parameterType="String">
+        delete from adm_area_attr where area_code = #{areaCode}
+    </delete>
+</mapper>

+ 37 - 89
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaMapper.xml

@@ -4,138 +4,86 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.ems.mapper.AreaMapper">
     
-    <resultMap type="com.ruoyi.ems.domain.Area" id="AdmServiceAreaResult">
+    <resultMap type="com.ruoyi.ems.domain.Area" id="areaResult">
         <result property="id"    column="id"    />
         <result property="areaCode"    column="area_code"    />
+        <result property="parentCode"    column="parent_code"    />
+        <result property="ancestors"    column="ancestors"    />
         <result property="areaName"    column="area_name"    />
         <result property="shortName"    column="short_name"    />
-        <result property="serviceStar"    column="service_star"    />
-        <result property="city"    column="city"    />
-        <result property="highway"    column="highway"    />
-        <result property="direction"    column="direction"    />
-        <result property="address"    column="address"    />
-        <result property="attrOrg"    column="attr_org"    />
-        <result property="mgrOrg"    column="mgr_org"    />
-        <result property="openDate"    column="open_date"    />
-        <result property="landArea"    column="land_area"    />
-        <result property="floorArea"    column="floor_area"    />
-        <result property="longitude"    column="longitude"    />
-        <result property="latitude"    column="latitude"    />
+        <result property="desc"    column="desc"    />
+        <result property="orderNum"    column="order_num"    />
+        <result property="status"    column="status"    />
     </resultMap>
 
     <sql id="selectAreaVo">
-        select id, area_code, area_name, short_name, service_star, city, highway, direction, address, attr_org, mgr_org, open_date, land_area, floor_area, longitude, latitude from adm_service_area
+        select id, area_code, parent_code, ancestors, area_name, short_name, `desc`, order_num, status from adm_area
     </sql>
 
-    <select id="selectAreaList" parameterType="com.ruoyi.ems.domain.Area" resultMap="AdmServiceAreaResult">
+    <select id="selectAreaList" parameterType="com.ruoyi.ems.domain.Area" resultMap="areaResult">
         <include refid="selectAreaVo"/>
         <where>  
             <if test="areaCode != null  and areaCode != ''"> and area_code = #{areaCode}</if>
+            <if test="parentCode != null  and parentCode != ''"> and parent_code = #{parentCode}</if>
+            <if test="ancestors != null  and ancestors != ''"> and ancestors = #{ancestors}</if>
             <if test="areaName != null  and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
             <if test="shortName != null  and shortName != ''"> and short_name like concat('%', #{shortName}, '%')</if>
-            <if test="serviceStar != null "> and service_star = #{serviceStar}</if>
-            <if test="city != null  and city != ''"> and city = #{city}</if>
-            <if test="highway != null  and highway != ''"> and highway = #{highway}</if>
-            <if test="direction != null  and direction != ''"> and direction = #{direction}</if>
-            <if test="address != null  and address != ''"> and address = #{address}</if>
-            <if test="attrOrg != null  and attrOrg != ''"> and attr_org = #{attrOrg}</if>
-            <if test="mgrOrg != null  and mgrOrg != ''"> and mgr_org = #{mgrOrg}</if>
-            <if test="openDate != null "> and open_date = #{openDate}</if>
-            <if test="landArea != null "> and land_area = #{landArea}</if>
-            <if test="floorArea != null "> and floor_area = #{floorArea}</if>
-            <if test="longitude != null "> and longitude = #{longitude}</if>
-            <if test="latitude != null "> and latitude = #{latitude}</if>
+            <if test="desc != null  and desc != ''"> and desc = #{desc}</if>
+            <if test="orderNum != null "> and order_num = #{orderNum}</if>
+            <if test="status != null "> and status = #{status}</if>
         </where>
     </select>
-
-    <select id="selectWithFacsCategory"  resultMap="AdmServiceAreaResult">
-        SELECT
-            a.id, a.area_code, a.area_name, a.short_name, a.service_star, a.city, a.highway, a.direction, a.address, a.attr_org, a.mgr_org, a.open_date, a.land_area, a.floor_area, a.longitude, a.latitude
-        FROM adm_service_area a
-        INNER JOIN adm_ems_facs f ON f.ref_area = a.area_code
-        <where>
-            <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="AdmServiceAreaResult">
+    <select id="selectAreaById" parameterType="Long" resultMap="areaResult">
         <include refid="selectAreaVo"/>
-        where `id` = #{id}
-    </select>
-
-    <select id="selectAreaByCode" parameterType="String" resultMap="AdmServiceAreaResult">
-        <include refid="selectAreaVo"/>
-        where area_code = #{code}
+        where id = #{id}
     </select>
         
     <insert id="insertArea" parameterType="com.ruoyi.ems.domain.Area" useGeneratedKeys="true" keyProperty="id">
-        insert into adm_service_area
+        insert into adm_area
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="areaCode != null and areaCode != ''">area_code,</if>
+            <if test="parentCode != null">parent_code,</if>
+            <if test="ancestors != null">ancestors,</if>
             <if test="areaName != null and areaName != ''">area_name,</if>
-            <if test="shortName != null and shortName != ''">short_name,</if>
-            <if test="serviceStar != null">service_star,</if>
-            <if test="city != null">city,</if>
-            <if test="highway != null">highway,</if>
-            <if test="direction != null">direction,</if>
-            <if test="address != null">address,</if>
-            <if test="attrOrg != null">attr_org,</if>
-            <if test="mgrOrg != null">mgr_org,</if>
-            <if test="openDate != null">open_date,</if>
-            <if test="landArea != null">land_area,</if>
-            <if test="floorArea != null">floor_area,</if>
-            <if test="longitude != null">longitude,</if>
-            <if test="latitude != null">latitude,</if>
+            <if test="shortName != null">short_name,</if>
+            <if test="desc != null">desc,</if>
+            <if test="orderNum != null">order_num,</if>
+            <if test="status != null">status,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
+            <if test="parentCode != null">#{parentCode},</if>
+            <if test="ancestors != null">#{ancestors},</if>
             <if test="areaName != null and areaName != ''">#{areaName},</if>
-            <if test="shortName != null and shortName != ''">#{shortName},</if>
-            <if test="serviceStar != null">#{serviceStar},</if>
-            <if test="city != null">#{city},</if>
-            <if test="highway != null">#{highway},</if>
-            <if test="direction != null">#{direction},</if>
-            <if test="address != null">#{address},</if>
-            <if test="attrOrg != null">#{attrOrg},</if>
-            <if test="mgrOrg != null">#{mgrOrg},</if>
-            <if test="openDate != null">#{openDate},</if>
-            <if test="landArea != null">#{landArea},</if>
-            <if test="floorArea != null">#{floorArea},</if>
-            <if test="longitude != null">#{longitude},</if>
-            <if test="latitude != null">#{latitude},</if>
+            <if test="shortName != null">#{shortName},</if>
+            <if test="desc != null">#{desc},</if>
+            <if test="orderNum != null">#{orderNum},</if>
+            <if test="status != null">#{status},</if>
          </trim>
     </insert>
 
     <update id="updateArea" parameterType="com.ruoyi.ems.domain.Area">
-        update adm_service_area
+        update adm_area
         <trim prefix="SET" suffixOverrides=",">
             <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
+            <if test="parentCode != null">parent_code = #{parentCode},</if>
+            <if test="ancestors != null">ancestors = #{ancestors},</if>
             <if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
-            <if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
-            <if test="serviceStar != null">service_star = #{serviceStar},</if>
-            <if test="city != null">city = #{city},</if>
-            <if test="highway != null">highway = #{highway},</if>
-            <if test="direction != null">direction = #{direction},</if>
-            <if test="address != null">address = #{address},</if>
-            <if test="attrOrg != null">attr_org = #{attrOrg},</if>
-            <if test="mgrOrg != null">mgr_org = #{mgrOrg},</if>
-            <if test="openDate != null">open_date = #{openDate},</if>
-            <if test="landArea != null">land_area = #{landArea},</if>
-            <if test="floorArea != null">floor_area = #{floorArea},</if>
-            <if test="longitude != null">longitude = #{longitude},</if>
-            <if test="latitude != null">latitude = #{latitude},</if>
+            <if test="shortName != null">short_name = #{shortName},</if>
+            <if test="desc != null">desc = #{desc},</if>
+            <if test="orderNum != null">order_num = #{orderNum},</if>
+            <if test="status != null">status = #{status},</if>
         </trim>
         where id = #{id}
     </update>
 
     <delete id="deleteAreaById" parameterType="Long">
-        delete from adm_service_area where id = #{id}
+        delete from adm_area where id = #{id}
     </delete>
 
     <delete id="deleteAreaByIds" parameterType="String">
-        delete from adm_service_area where id in 
+        delete from adm_area where id in 
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 143 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaOldMapper.xml

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.ems.mapper.AreaOldMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.AreaOld" id="AdmServiceAreaResult">
+        <result property="id"    column="id"    />
+        <result property="areaCode"    column="area_code"    />
+        <result property="areaName"    column="area_name"    />
+        <result property="shortName"    column="short_name"    />
+        <result property="serviceStar"    column="service_star"    />
+        <result property="city"    column="city"    />
+        <result property="highway"    column="highway"    />
+        <result property="direction"    column="direction"    />
+        <result property="address"    column="address"    />
+        <result property="attrOrg"    column="attr_org"    />
+        <result property="mgrOrg"    column="mgr_org"    />
+        <result property="openDate"    column="open_date"    />
+        <result property="landArea"    column="land_area"    />
+        <result property="floorArea"    column="floor_area"    />
+        <result property="longitude"    column="longitude"    />
+        <result property="latitude"    column="latitude"    />
+    </resultMap>
+
+    <sql id="selectAreaVo">
+        select id, area_code, area_name, short_name, service_star, city, highway, direction, address, attr_org, mgr_org, open_date, land_area, floor_area, longitude, latitude from adm_service_area
+    </sql>
+
+    <select id="selectAreaList" parameterType="com.ruoyi.ems.domain.AreaOld" resultMap="AdmServiceAreaResult">
+        <include refid="selectAreaVo"/>
+        <where>  
+            <if test="areaCode != null  and areaCode != ''"> and area_code = #{areaCode}</if>
+            <if test="areaName != null  and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
+            <if test="shortName != null  and shortName != ''"> and short_name like concat('%', #{shortName}, '%')</if>
+            <if test="serviceStar != null "> and service_star = #{serviceStar}</if>
+            <if test="city != null  and city != ''"> and city = #{city}</if>
+            <if test="highway != null  and highway != ''"> and highway = #{highway}</if>
+            <if test="direction != null  and direction != ''"> and direction = #{direction}</if>
+            <if test="address != null  and address != ''"> and address = #{address}</if>
+            <if test="attrOrg != null  and attrOrg != ''"> and attr_org = #{attrOrg}</if>
+            <if test="mgrOrg != null  and mgrOrg != ''"> and mgr_org = #{mgrOrg}</if>
+            <if test="openDate != null "> and open_date = #{openDate}</if>
+            <if test="landArea != null "> and land_area = #{landArea}</if>
+            <if test="floorArea != null "> and floor_area = #{floorArea}</if>
+            <if test="longitude != null "> and longitude = #{longitude}</if>
+            <if test="latitude != null "> and latitude = #{latitude}</if>
+        </where>
+    </select>
+
+    <select id="selectWithFacsCategory"  resultMap="AdmServiceAreaResult">
+        SELECT
+            a.id, a.area_code, a.area_name, a.short_name, a.service_star, a.city, a.highway, a.direction, a.address, a.attr_org, a.mgr_org, a.open_date, a.land_area, a.floor_area, a.longitude, a.latitude
+        FROM adm_service_area a
+        INNER JOIN adm_ems_facs f ON f.ref_area = a.area_code
+        <where>
+            <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="AdmServiceAreaResult">
+        <include refid="selectAreaVo"/>
+        where `id` = #{id}
+    </select>
+
+    <select id="selectAreaByCode" parameterType="String" resultMap="AdmServiceAreaResult">
+        <include refid="selectAreaVo"/>
+        where area_code = #{code}
+    </select>
+        
+    <insert id="insertArea" parameterType="com.ruoyi.ems.domain.AreaOld" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_service_area
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
+            <if test="areaName != null and areaName != ''">area_name,</if>
+            <if test="shortName != null and shortName != ''">short_name,</if>
+            <if test="serviceStar != null">service_star,</if>
+            <if test="city != null">city,</if>
+            <if test="highway != null">highway,</if>
+            <if test="direction != null">direction,</if>
+            <if test="address != null">address,</if>
+            <if test="attrOrg != null">attr_org,</if>
+            <if test="mgrOrg != null">mgr_org,</if>
+            <if test="openDate != null">open_date,</if>
+            <if test="landArea != null">land_area,</if>
+            <if test="floorArea != null">floor_area,</if>
+            <if test="longitude != null">longitude,</if>
+            <if test="latitude != null">latitude,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
+            <if test="areaName != null and areaName != ''">#{areaName},</if>
+            <if test="shortName != null and shortName != ''">#{shortName},</if>
+            <if test="serviceStar != null">#{serviceStar},</if>
+            <if test="city != null">#{city},</if>
+            <if test="highway != null">#{highway},</if>
+            <if test="direction != null">#{direction},</if>
+            <if test="address != null">#{address},</if>
+            <if test="attrOrg != null">#{attrOrg},</if>
+            <if test="mgrOrg != null">#{mgrOrg},</if>
+            <if test="openDate != null">#{openDate},</if>
+            <if test="landArea != null">#{landArea},</if>
+            <if test="floorArea != null">#{floorArea},</if>
+            <if test="longitude != null">#{longitude},</if>
+            <if test="latitude != null">#{latitude},</if>
+         </trim>
+    </insert>
+
+    <update id="updateArea" parameterType="com.ruoyi.ems.domain.AreaOld">
+        update adm_service_area
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
+            <if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
+            <if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
+            <if test="serviceStar != null">service_star = #{serviceStar},</if>
+            <if test="city != null">city = #{city},</if>
+            <if test="highway != null">highway = #{highway},</if>
+            <if test="direction != null">direction = #{direction},</if>
+            <if test="address != null">address = #{address},</if>
+            <if test="attrOrg != null">attr_org = #{attrOrg},</if>
+            <if test="mgrOrg != null">mgr_org = #{mgrOrg},</if>
+            <if test="openDate != null">open_date = #{openDate},</if>
+            <if test="landArea != null">land_area = #{landArea},</if>
+            <if test="floorArea != null">floor_area = #{floorArea},</if>
+            <if test="longitude != null">longitude = #{longitude},</if>
+            <if test="latitude != null">latitude = #{latitude},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteAreaById" parameterType="Long">
+        delete from adm_service_area where id = #{id}
+    </delete>
+
+    <delete id="deleteAreaByIds" parameterType="String">
+        delete from adm_service_area where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 48 - 24
ems-cloud/sql/ems_init_data.sql

@@ -1,27 +1,51 @@
--- 地块初始数据
-INSERT INTO `adm_service_area` (`area_code`, `area_name`, `short_name`, `service_star`, `city`, `highway`, `direction`, `address`, `attr_org`, `mgr_org`, `open_date`, `land_area`, `floor_area`, `longitude`, `latitude`) VALUES ('321283124S3001', '常泰高速服务区(北区)', '北区', 4, '泰州', 'S30如常高速', '常州方向', '江苏省泰州市泰兴市虹桥镇常泰高速常州方向', null, null, '2025-01-01', '72.5', '6000', '120.050937', '32.071956');
-INSERT INTO `adm_service_area` (`area_code`, `area_name`, `short_name`, `service_star`, `city`, `highway`, `direction`, `address`, `attr_org`, `mgr_org`, `open_date`, `land_area`, `floor_area`, `longitude`, `latitude`) VALUES ('321283124S3002', '常泰高速服务区(南区)', '南区', 4, '泰州', 'S30如常高速', '泰兴方向', '江苏省泰州市泰兴市虹桥镇常泰高速泰州方向', null, null, '2025-01-01', '72.5', '6000', '120.052389', '32.070408');
-INSERT INTO `adm_service_area` (`area_code`, `area_name`, `short_name`, `service_star`, `city`, `highway`, `direction`, `address`, `attr_org`, `mgr_org`, `open_date`, `land_area`, `floor_area`, `longitude`, `latitude`) VALUES ('321283124S3003', '主路沿线光伏', '主路', 4, '泰州', 'S30如常高速', NULL, '江苏省泰州市泰兴市虹桥镇常泰高速泰州方向', NULL, NULL, '2025-01-01', 72.5, 6000, 120.052389, 32.070408);
-
--- 建筑初始数据
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300101', '综合楼', '北区中部', 2, 1, 13.7, 4700, '一层提供商业、餐饮、卫生间、开水服务,二层为办公区、会议区', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300102', '配电泵房', '北区西北角', 1, 0, null, 300, '配电设施,水泵设施工作区', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300103', '维修间&货车之家', '北区东侧', 2, 0, null, 300, '提供车辆维修服务', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300104', '加油站', '北区西南角', 1, 0, null, 200, '提供加油服务', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300105', '警务站', '北区东北角', 1, 0, null, 50000, '警务办公场地', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300106', '停车场', '北区广场', 1, 0, null, 50000, '车位', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300199', '北区光伏', '屋顶', null, null, null, null, null, '321283124S3001');
-
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300201', '综合楼', '南区中部', 2, 1, 14.2, 4788.2, '一层提供商业、餐饮、卫生间、开水服务,二层为员工餐厅、展厅', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300202', '配电泵房', '南区东南角', 1, 0, null, 300, '配电设施,水泵设施工作区', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300203', '维修间&货车之家', '南区西侧', 2, 0, null, 300, '提供车辆维修服务', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300204', '加油站', '南区东北角', 1, 0, null, 200, '提供加油服务', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300205', '宿舍楼', '南区西南角', 2, 0, null, 920, '提供员工住宿服务', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300206', '停车场', '南区广场', 1, 0, null, 50000, '车位', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300299', '南区光伏', '屋顶', null, null, null, null, null, '321283124S3002');
-
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('S30K140-S30K150', '桩号段S30K140-S30K150', 'S30K140+300-S30K150+200', 1, 0, NULL, NULL, NULL, '321283124S3003');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('S30K150-S30K180', '桩号段S30K150-S30K180', 'S30K150+300-S30K180+300', 1, 0, NULL, NULL, NULL, '321283124S3003');
+-- 区域初始数据
+-- 服务区
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001', '0', '0', '常泰高速服务区(北区)', '北区', '江苏省泰州市泰兴市虹桥镇常泰高速常州方向', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002', '0', '0', '常泰高速服务区(南区)', '南区', '江苏省泰州市泰兴市虹桥镇常泰高速泰州方向', 2, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3003', '0', '0', '主路沿线', '主路', '主路沿线光伏', 3, 0);
+-- 建筑
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300101', '321283124S3001', '0,321283124S3001', '综合楼', '综合楼', '北区中部', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300102', '321283124S3001', '0,321283124S3001', '配电泵房', '配电泵房', '北区西北角', 2, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300103', '321283124S3001', '0,321283124S3001', '维修间&货车之家', '维修站', '北区东侧', 3, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300104', '321283124S3001', '0,321283124S3001', '加油站', '加油站', '北区西南角', 4, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300105', '321283124S3001', '0,321283124S3001', '警务站', '警务站', '北区东北角', 5, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300106', '321283124S3001', '0,321283124S3001', '停车位', '停车位', '北区广场', 6, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300150', '321283124S3001', '0,321283124S3001', '北区光伏', '光伏', '北区', 7, 0);
+
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300201', '321283124S3002', '0,321283124S3002', '综合楼', '综合楼', '南区中部', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300202', '321283124S3002', '0,321283124S3002', '配电泵房', '配电泵房', '南区东南角', 2, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300203', '321283124S3002', '0,321283124S3002', '维修间&货车之家', '维修站', '南区西侧', 3, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300204', '321283124S3002', '0,321283124S3002', '加油站', '加油站', '南区东北角', 4, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300205', '321283124S3002', '0,321283124S3002', '宿舍楼', '警务站', '南区西南角', 5, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300206', '321283124S3002', '0,321283124S3002', '停车位', '停车位', '南区广场', 6, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S300250', '321283124S3002', '0,321283124S3002', '南区光伏', '光伏', '南区', 7, 0);
+
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('S30K140-S30K150', '321283124S3003', '0,321283124S3003', '桩号段S30K140-S30K150', '桩号段S30K140-S30K150', '区段S30K140+300-S30K150+200', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('S30K150-S30K180', '321283124S3003', '0,321283124S3003', '桩号段S30K140-S30K150', '桩号段S30K140-S30K150', '区段S30K150+300-S30K180+300', 2, 0);
+
+-- 区域属性属性
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S3001', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 7250, 6000, NULL, 120.050937, 32.071956);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S3002', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 7250, 6000, NULL, 120.052389, 32.070408);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S3003', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, 120.051596, 32.071064);
+
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300101', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 4100, 4100, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300102', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 300, 300, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300103', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 300, 300, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300104', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 200, 200, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300105', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 70, 70, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300106', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300150', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, NULL, NULL);
+
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300201', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 4100, 4100, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300202', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 300, 300, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300203', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 300, 300, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300204', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 200, 200, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300205', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', 920, 920, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300206', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('321283124S300250', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, NULL, NULL);
+
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('S30K140-S30K150', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('S30K150-S30K180', '常泰大桥服务区', '润扬大桥投资管理有限公司', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, NULL, NULL);
 
 
 -- 建筑初始数据

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

@@ -371,6 +371,46 @@ INSERT INTO `dim_ems_emission_factor` (`region_code`, `region_name`, `region_typ
 INSERT INTO `dim_ems_emission_factor` (`region_code`, `region_name`, `region_type`, `factor_value`, `factor_type`, `version`) VALUES ('CN', '中国', '0', '0.5942', '2', '2021');
 INSERT INTO `dim_ems_emission_factor` (`region_code`, `region_name`, `region_type`, `factor_value`, `factor_type`, `version`) VALUES ('CN', '中国', '0', '0.8426', '3', '2021');
 
+-- ----------------------------
+-- 区域对象表
+-- ----------------------------
+drop table if exists adm_area;
+create table adm_area (
+  `id`             bigint(20)      not null auto_increment    comment '序号',
+  `area_code`      varchar(32)     not null                   comment '区域代码',
+  `parent_code`    varchar(32)     default null               comment '上级区域代码',
+  `ancestors`      varchar(1024)   default null               comment '祖籍列表',
+  `area_name`      varchar(64)     not null                   comment '区域名称',
+  `short_name`     varchar(32)     default null               comment '区域简称',
+  `desc`           varchar(128)    default null               comment '区域简称',
+  `order_num`      int             default null               comment '显示顺序',
+  `status`         int             default null               comment '区域状态',
+  primary key (`id`),
+  unique key ux_area_code(`area_code`)
+) engine=innodb auto_increment=1 comment = '区域对象表';
+
+
+-- ----------------------------
+-- 区域对象属性表
+-- ----------------------------
+drop table if exists adm_area_attr;
+create table adm_area_attr (
+  `id`             bigint(20)      not null auto_increment    comment '序号',
+  `area_code`      varchar(32)     not null                   comment '区域代码',
+  `attr_org`       varchar(64)     default null               comment '所有单位',
+  `mgr_org`        varchar(64)     default null               comment '管理单位',
+  `leader`         varchar(64)     default null               comment '负责人',
+  `phone`          varchar(64)     default null               comment '联系电话',
+  `open_date`      date            default null               comment '开通时间',
+  `floor_area`     double          default null               comment '建筑面积(平方米 m²)',
+  `usable_area`    double          default null               comment '使用面积(平方米 m²)',
+  `floor`          int             default null               comment '楼层',
+  `longitude`      double          default null               comment '经度',
+  `latitude`       double          default null               comment '纬度',
+  primary key (`id`),
+  unique key ux_area_attr_code(`area_code`)
+) engine=innodb auto_increment=1 comment = '区域对象属性表';
+
 
 -- ----------------------------
 -- 服务区表
@@ -540,6 +580,7 @@ create table adm_ems_obj_model  (
   unique key ux_ems_obj_attr(`model_code`)
 ) engine=innodb auto_increment=1 comment = '能源对象模型表';
 
+
 -- 对象模型初始数据
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`) VALUES ('M_W2', '国网供电模型', 1);
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`) VALUES ('M_E5', '光伏设施模型', 1);
@@ -549,6 +590,7 @@ INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`) VALUES
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`) VALUES ('M_W2_QR', '漏电保护器模型', 2);
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`) VALUES ('M_W2_QF', '断路器模型', 2);
 
+
 -- ----------------------------
 -- 能源对象属性表
 -- ----------------------------
@@ -564,6 +606,7 @@ create table adm_ems_obj_attr  (
   unique key ux_ems_obj_attr(`model_code`, `attr_key`)
 ) engine=innodb auto_increment=1 comment = '能源对象属性表';
 
+
 -- 对象属性初始数据
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_type`, `attr_key`, `attr_name`, `attr_unit`) VALUES ('M_W2', 0, 'voltageLevel', '电压等级', 'kV');
 INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_type`, `attr_key`, `attr_name`, `attr_unit`) VALUES ('M_W2', 0, 'frequency', '电流频率', 'Hz');

+ 7 - 3
ems-cloud/sql/ems_sys.sql

@@ -199,6 +199,7 @@ INSERT INTO sys_menu VALUES ('152',  '告警列表',       '6',    '2',  'warn-l
 INSERT INTO sys_menu VALUES ('153',  '巡检任务',       '6',    '3',  'oper-task',           'task/index',             '', 1, 0, 'C', '0', '0',    'oper-mgr:task', 'task', 'admin', '2024-08-29 15:40:27', 'admin', '2024-08-29 16:02:38', '巡检任务');
 insert into sys_menu values ('154',  '巡检报告',       '6',    '4',  'oper-report',         'task/report/index',      '', 1, 0, 'C', '0', '0',    'oper-mgr:report',        'note',           'admin', sysdate(), '', null, '巡检报告');
 
+insert into sys_menu values ('160',  '区域配置',       '7',    '1',  'areacfg',            'basecfg/area1/index',    '', 1, 0, 'C', '0', '0',   'basecfg:area:list',      'cfgwrite',       'admin', sysdate(), '', null, '区域配置');
 insert into sys_menu values ('161',  '建筑区块',       '7',    '1',  'buildingcfg',        '',                       '', 1, 0, 'M', '0', '0',   'basecfg:building',       'building',       'admin', sysdate(), '', null, '用户管理菜单');
 insert into sys_menu values ('162',  '设备设施',       '7',    '2',  'devicecfg',          '',                       '', 1, 0, 'M', '0', '0',   'basecfg:device',         'devicemgr',      'admin', sysdate(), '', null, '用户管理菜单');
 insert into sys_menu values ('163',  '能源计量',       '7',    '3',  'energycfg',          '',                       '', 1, 0, 'M', '0', '0',   'basecfg:energy',         'energy',         'admin', sysdate(), '', null, '用户管理菜单');
@@ -970,12 +971,15 @@ create table sys_logininfor (
   info_id        bigint(20)     not null auto_increment   comment '访问ID',
   user_name      varchar(50)    default ''                comment '用户账号',
   ipaddr         varchar(128)   default ''                comment '登录IP地址',
+  login_location varchar(255)   default ''                comment '登录地点',
+  browser        varchar(50)    default ''                comment '浏览器类型',
+  os             varchar(50)    default ''                comment '操作系统',
   status         char(1)        default '0'               comment '登录状态(0成功 1失败)',
-  msg            varchar(255)   default ''                comment '提示信息',
-  access_time    datetime                                 comment '访问时间',
+  msg            varchar(255)   default ''                comment '提示息',
+  login_time     datetime                                 comment '访问时间',
   primary key (info_id),
   key idx_sys_logininfor_s  (status),
-  key idx_sys_logininfor_lt (access_time)
+  key idx_sys_logininfor_lt (login_time)
 ) engine=innodb auto_increment=100 comment = '系统访问记录';