Browse Source

能流关系扩展

lv.wenbin 10 months ago
parent
commit
390ec7bb4b

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/EmsObjAttrController.java

@@ -27,7 +27,7 @@ import java.util.List;
  * @date 2024-09-23
  */
 @RestController
-@RequestMapping("/obj/attr")
+@RequestMapping("/object/attr")
 @Api(value = "EmsObjAttrController", description = "能源对象属性管理")
 public class EmsObjAttrController extends BaseController
 {

+ 14 - 29
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/FacsFlowRelController.java → ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/EmsObjFlowRelController.java

@@ -1,14 +1,13 @@
 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.EmsFacsFlowRel;
-import com.ruoyi.ems.service.IEmsFacsFlowRelService;
+import com.ruoyi.ems.domain.EmsObjFlowRel;
+import com.ruoyi.ems.service.IEmsObjFlowRelService;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
@@ -20,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -30,46 +28,33 @@ import java.util.List;
  * @date 2024-07-10
  */
 @RestController
-@RequestMapping("/basecfg/flowrel")
-@Api(value = "FacsFlowRelController", description = "能流关系管理")
-public class FacsFlowRelController extends BaseController
+@RequestMapping("/object/flowrel")
+@Api(value = "EmsObjFlowRelController", description = "对象能流关系管理")
+public class EmsObjFlowRelController extends BaseController
 {
     @Autowired
-    private IEmsFacsFlowRelService facsFlowRelService;
+    private IEmsObjFlowRelService facsFlowRelService;
 
     /**
      * 查询能源设施能流关系列表
      */
     @RequiresPermissions("basecfg:flowrel:list")
     @GetMapping("/list")
-    public TableDataInfo list(EmsFacsFlowRel emsFacsFlowRel)
+    public TableDataInfo list(EmsObjFlowRel flowRel)
     {
         startPage();
-        List<EmsFacsFlowRel> list = facsFlowRelService.selectEmsFacsFlowRelList(emsFacsFlowRel);
+        List<EmsObjFlowRel> list = facsFlowRelService.selectFlowRelList(flowRel);
         return getDataTable(list);
     }
 
     /**
-     * 导出能源设施能流关系列表
-     */
-    @RequiresPermissions("basecfg:flowrel:export")
-    @Log(title = "能源设施能流关系", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, EmsFacsFlowRel emsFacsFlowRel)
-    {
-        List<EmsFacsFlowRel> list = facsFlowRelService.selectEmsFacsFlowRelList(emsFacsFlowRel);
-        ExcelUtil<EmsFacsFlowRel> util = new ExcelUtil<EmsFacsFlowRel>(EmsFacsFlowRel.class);
-        util.exportExcel(response, list, "能源设施能流关系数据");
-    }
-
-    /**
      * 获取能源设施能流关系详细信息
      */
     @RequiresPermissions("basecfg:flowrel:query")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
-        return success(facsFlowRelService.selectEmsFacsFlowRelById(id));
+        return success(facsFlowRelService.selectFlowRelById(id));
     }
 
     /**
@@ -78,9 +63,9 @@ public class FacsFlowRelController extends BaseController
     @RequiresPermissions("basecfg:flowrel:add")
     @Log(title = "能源设施能流关系", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody EmsFacsFlowRel emsFacsFlowRel)
+    public AjaxResult add(@RequestBody EmsObjFlowRel facsFlowRel)
     {
-        return toAjax(facsFlowRelService.insertEmsFacsFlowRel(emsFacsFlowRel));
+        return toAjax(facsFlowRelService.insertFlowRel(facsFlowRel));
     }
 
     /**
@@ -89,9 +74,9 @@ public class FacsFlowRelController extends BaseController
     @RequiresPermissions("basecfg:flowrel:edit")
     @Log(title = "能源设施能流关系", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody EmsFacsFlowRel emsFacsFlowRel)
+    public AjaxResult edit(@RequestBody EmsObjFlowRel flowRel)
     {
-        return toAjax(facsFlowRelService.updateEmsFacsFlowRel(emsFacsFlowRel));
+        return toAjax(facsFlowRelService.updateFlowRel(flowRel));
     }
 
     /**
@@ -102,6 +87,6 @@ public class FacsFlowRelController extends BaseController
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
-        return toAjax(facsFlowRelService.deleteEmsFacsFlowRelByIds(ids));
+        return toAjax(facsFlowRelService.deleteFlowRelByIds(ids));
     }
 }

+ 0 - 161
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsFacsFlowRel.java

@@ -1,161 +0,0 @@
-package com.ruoyi.ems.domain;
-
-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_ems_facs_flow_rel
- * 
- * @author ruoyi
- * @date 2024-07-10
- */
-public class EmsFacsFlowRel extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 序号 */
-    private Long id;
-
-    /** 编码 */
-    @Excel(name = "编码")
-    private String code;
-
-    /** 能源输出设施 */
-    private String exportFacsCode;
-
-    /** 能源输出设施名称 */
-    @Excel(name = "能源输出设施")
-    private String exportFacsName;
-
-    /** 能源流入设施 */
-    private String inputFacsCode;
-
-    /** 能源流入设施名称 */
-    @Excel(name = "能源流入设施")
-    private String inputFacsName;
-
-    /** 能源流动介质 */
-    private String emsCls;
-
-    /** 能源流动介质名称 */
-    @Excel(name = "能源流动介质")
-    private String emsClsName;
-
-    /** 供能状态
-     *  0-停止,1-供应中
-     */
-    @Excel(name = "供能状态")
-    private Long state;
-
-    /**
-     * 动作类型
-     * 4501-购电,4502-上网,4503-充电,4504-放电,4505-自产自销
-     */
-    @Excel(name = "动作类型")
-    private String actionType;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setCode(String code) 
-    {
-        this.code = code;
-    }
-
-    public String getCode() 
-    {
-        return code;
-    }
-    public void setExportFacsCode(String exportFacsCode) 
-    {
-        this.exportFacsCode = exportFacsCode;
-    }
-
-    public String getExportFacsCode() 
-    {
-        return exportFacsCode;
-    }
-    public void setInputFacsCode(String inputFacsCode) 
-    {
-        this.inputFacsCode = inputFacsCode;
-    }
-
-    public String getInputFacsCode() 
-    {
-        return inputFacsCode;
-    }
-    public void setEmsCls(String emsCls) 
-    {
-        this.emsCls = emsCls;
-    }
-
-    public String getEmsCls() 
-    {
-        return emsCls;
-    }
-    public void setState(Long state) 
-    {
-        this.state = state;
-    }
-
-    public Long getState() 
-    {
-        return state;
-    }
-    public void setActionType(String actionType) 
-    {
-        this.actionType = actionType;
-    }
-
-    public String getActionType() 
-    {
-        return actionType;
-    }
-
-    public String getExportFacsName() {
-        return exportFacsName;
-    }
-
-    public void setExportFacsName(String exportFacsName) {
-        this.exportFacsName = exportFacsName;
-    }
-
-    public String getInputFacsName() {
-        return inputFacsName;
-    }
-
-    public void setInputFacsName(String inputFacsName) {
-        this.inputFacsName = inputFacsName;
-    }
-
-    public String getEmsClsName() {
-        return emsClsName;
-    }
-
-    public void setEmsClsName(String emsClsName) {
-        this.emsClsName = emsClsName;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("code", getCode())
-            .append("exportFacsCode", getExportFacsCode())
-            .append("inputFacsCode", getInputFacsCode())
-            .append("emsCls", getEmsCls())
-            .append("state", getState())
-            .append("actionType", getActionType())
-            .append("createTime", getCreateTime())
-            .append("updateTime", getUpdateTime())
-            .toString();
-    }
-}

+ 143 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsObjFlowRel.java

@@ -0,0 +1,143 @@
+package com.ruoyi.ems.domain;
+
+import com.ruoyi.common.core.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 对象能流关系对象 adm_ems_flow_rel
+ * 
+ * @author ruoyi
+ * @date 2024-07-10
+ */
+public class EmsObjFlowRel extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 能源输出对象 */
+    private String exportObj;
+
+    /** 能源输出对象类型 */
+    private Integer exportObjType;
+
+    /** 能源输出对象名称 */
+    private String exportObjName;
+
+    /** 能源流入对象 */
+    private String inputObj;
+
+    /** 能源流入对象类型 */
+    private Integer inputObjType;
+
+    /** 能源流入对象名称 */
+    private String inputObjName;
+
+    /** 能源流动介质 */
+    private String emsCls;
+
+    /** 能源流动介质名称 */
+    private String emsClsName;
+
+    /**
+     * 能流描述
+     */
+    private String flowDesc;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getExportObj() {
+        return exportObj;
+    }
+
+    public void setExportObj(String exportObj) {
+        this.exportObj = exportObj;
+    }
+
+    public Integer getExportObjType() {
+        return exportObjType;
+    }
+
+    public void setExportObjType(Integer exportObjType) {
+        this.exportObjType = exportObjType;
+    }
+
+    public String getExportObjName() {
+        return exportObjName;
+    }
+
+    public void setExportObjName(String exportObjName) {
+        this.exportObjName = exportObjName;
+    }
+
+    public String getInputObj() {
+        return inputObj;
+    }
+
+    public void setInputObj(String inputObj) {
+        this.inputObj = inputObj;
+    }
+
+    public Integer getInputObjType() {
+        return inputObjType;
+    }
+
+    public void setInputObjType(Integer inputObjType) {
+        this.inputObjType = inputObjType;
+    }
+
+    public String getInputObjName() {
+        return inputObjName;
+    }
+
+    public void setInputObjName(String inputObjName) {
+        this.inputObjName = inputObjName;
+    }
+
+    public String getEmsCls() {
+        return emsCls;
+    }
+
+    public void setEmsCls(String emsCls) {
+        this.emsCls = emsCls;
+    }
+
+    public String getEmsClsName() {
+        return emsClsName;
+    }
+
+    public void setEmsClsName(String emsClsName) {
+        this.emsClsName = emsClsName;
+    }
+
+    public String getFlowDesc() {
+        return flowDesc;
+    }
+
+    public void setFlowDesc(String flowDesc) {
+        this.flowDesc = flowDesc;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("exportObj", getExportObj())
+            .append("exportObjType", getExportObjType())
+            .append("inputObj", getInputObj())
+            .append("inputObjType", getInputObjType())
+            .append("emsCls", getEmsCls())
+            .append("flowDesc", getFlowDesc())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 11 - 11
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/EmsFacsFlowRelMapper.java → ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/EmsObjFlowRelMapper.java

@@ -2,7 +2,7 @@ package com.ruoyi.ems.mapper;
 
 import java.util.List;
 
-import com.ruoyi.ems.domain.EmsFacsFlowRel;
+import com.ruoyi.ems.domain.EmsObjFlowRel;
 
 /**
  * 能源设施能流关系Mapper接口
@@ -10,38 +10,38 @@ import com.ruoyi.ems.domain.EmsFacsFlowRel;
  * @author ruoyi
  * @date 2024-07-10
  */
-public interface EmsFacsFlowRelMapper {
+public interface EmsObjFlowRelMapper {
     /**
      * 查询能源设施能流关系
      *
      * @param id 能源设施能流关系主键
      * @return 能源设施能流关系
      */
-    EmsFacsFlowRel selectEmsFacsFlowRelById(Long id);
+    EmsObjFlowRel selectFlowRelById(Long id);
 
     /**
      * 查询能源设施能流关系列表
      *
-     * @param emsFacsFlowRel 能源设施能流关系
+     * @param flowRel 能源设施能流关系
      * @return 能源设施能流关系集合
      */
-    List<EmsFacsFlowRel> selectEmsFacsFlowRelList(EmsFacsFlowRel emsFacsFlowRel);
+    List<EmsObjFlowRel> selectFlowRelList(EmsObjFlowRel flowRel);
 
     /**
      * 新增能源设施能流关系
      *
-     * @param emsFacsFlowRel 能源设施能流关系
+     * @param flowRel 能源设施能流关系
      * @return 结果
      */
-    int insertEmsFacsFlowRel(EmsFacsFlowRel emsFacsFlowRel);
+    int insertFlowRel(EmsObjFlowRel flowRel);
 
     /**
      * 修改能源设施能流关系
      *
-     * @param emsFacsFlowRel 能源设施能流关系
+     * @param flowRel 能源设施能流关系
      * @return 结果
      */
-    int updateEmsFacsFlowRel(EmsFacsFlowRel emsFacsFlowRel);
+    int updateFlowRel(EmsObjFlowRel flowRel);
 
     /**
      * 删除能源设施能流关系
@@ -49,7 +49,7 @@ public interface EmsFacsFlowRelMapper {
      * @param id 能源设施能流关系主键
      * @return 结果
      */
-    int deleteEmsFacsFlowRelById(Long id);
+    int deleteFlowRelById(Long id);
 
     /**
      * 批量删除能源设施能流关系
@@ -57,5 +57,5 @@ public interface EmsFacsFlowRelMapper {
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    int deleteEmsFacsFlowRelByIds(Long[] ids);
+    int deleteFlowRelByIds(Long[] ids);
 }

+ 11 - 11
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IEmsFacsFlowRelService.java → ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IEmsObjFlowRelService.java

@@ -1,7 +1,7 @@
 package com.ruoyi.ems.service;
 
 import java.util.List;
-import com.ruoyi.ems.domain.EmsFacsFlowRel;
+import com.ruoyi.ems.domain.EmsObjFlowRel;
 
 /**
  * 能源设施能流关系Service接口
@@ -9,38 +9,38 @@ import com.ruoyi.ems.domain.EmsFacsFlowRel;
  * @author ruoyi
  * @date 2024-07-10
  */
-public interface IEmsFacsFlowRelService {
+public interface IEmsObjFlowRelService {
     /**
      * 查询能源设施能流关系
      *
      * @param id 能源设施能流关系主键
      * @return 能源设施能流关系
      */
-    EmsFacsFlowRel selectEmsFacsFlowRelById(Long id);
+    EmsObjFlowRel selectFlowRelById(Long id);
 
     /**
      * 查询能源设施能流关系列表
      *
-     * @param emsFacsFlowRel 能源设施能流关系
+     * @param flowRel 能源设施能流关系
      * @return 能源设施能流关系集合
      */
-    List<EmsFacsFlowRel> selectEmsFacsFlowRelList(EmsFacsFlowRel emsFacsFlowRel);
+    List<EmsObjFlowRel> selectFlowRelList(EmsObjFlowRel flowRel);
 
     /**
      * 新增能源设施能流关系
      *
-     * @param emsFacsFlowRel 能源设施能流关系
+     * @param flowRel 能源设施能流关系
      * @return 结果
      */
-    int insertEmsFacsFlowRel(EmsFacsFlowRel emsFacsFlowRel);
+    int insertFlowRel(EmsObjFlowRel flowRel);
 
     /**
      * 修改能源设施能流关系
      *
-     * @param emsFacsFlowRel 能源设施能流关系
+     * @param flowRel 能源设施能流关系
      * @return 结果
      */
-    int updateEmsFacsFlowRel(EmsFacsFlowRel emsFacsFlowRel);
+    int updateFlowRel(EmsObjFlowRel flowRel);
 
     /**
      * 批量删除能源设施能流关系
@@ -48,7 +48,7 @@ public interface IEmsFacsFlowRelService {
      * @param ids 需要删除的能源设施能流关系主键集合
      * @return 结果
      */
-    int deleteEmsFacsFlowRelByIds(Long[] ids);
+    int deleteFlowRelByIds(Long[] ids);
 
     /**
      * 删除能源设施能流关系信息
@@ -56,5 +56,5 @@ public interface IEmsFacsFlowRelService {
      * @param id 能源设施能流关系主键
      * @return 结果
      */
-    int deleteEmsFacsFlowRelById(Long id);
+    int deleteFlowRelById(Long id);
 }

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

@@ -1,96 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import java.util.List;
-import com.ruoyi.common.core.utils.DateUtils;
-import com.ruoyi.ems.domain.EmsFacsFlowRel;
-import com.ruoyi.ems.mapper.EmsFacsFlowRelMapper;
-import com.ruoyi.ems.service.IEmsFacsFlowRelService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * 能源设施能流关系Service业务层处理
- * 
- * @author ruoyi
- * @date 2024-07-10
- */
-@Service
-public class EmsFacsFlowRelServiceImpl implements IEmsFacsFlowRelService
-{
-    @Autowired
-    private EmsFacsFlowRelMapper emsFacsFlowRelMapper;
-
-    /**
-     * 查询能源设施能流关系
-     * 
-     * @param id 能源设施能流关系主键
-     * @return 能源设施能流关系
-     */
-    @Override
-    public EmsFacsFlowRel selectEmsFacsFlowRelById(Long id)
-    {
-        return emsFacsFlowRelMapper.selectEmsFacsFlowRelById(id);
-    }
-
-    /**
-     * 查询能源设施能流关系列表
-     * 
-     * @param emsFacsFlowRel 能源设施能流关系
-     * @return 能源设施能流关系
-     */
-    @Override
-    public List<EmsFacsFlowRel> selectEmsFacsFlowRelList(EmsFacsFlowRel emsFacsFlowRel)
-    {
-        return emsFacsFlowRelMapper.selectEmsFacsFlowRelList(emsFacsFlowRel);
-    }
-
-    /**
-     * 新增能源设施能流关系
-     * 
-     * @param emsFacsFlowRel 能源设施能流关系
-     * @return 结果
-     */
-    @Override
-    public int insertEmsFacsFlowRel(EmsFacsFlowRel emsFacsFlowRel)
-    {
-        emsFacsFlowRel.setCreateTime(DateUtils.getNowDate());
-        return emsFacsFlowRelMapper.insertEmsFacsFlowRel(emsFacsFlowRel);
-    }
-
-    /**
-     * 修改能源设施能流关系
-     * 
-     * @param emsFacsFlowRel 能源设施能流关系
-     * @return 结果
-     */
-    @Override
-    public int updateEmsFacsFlowRel(EmsFacsFlowRel emsFacsFlowRel)
-    {
-        emsFacsFlowRel.setUpdateTime(DateUtils.getNowDate());
-        return emsFacsFlowRelMapper.updateEmsFacsFlowRel(emsFacsFlowRel);
-    }
-
-    /**
-     * 批量删除能源设施能流关系
-     * 
-     * @param ids 需要删除的能源设施能流关系主键
-     * @return 结果
-     */
-    @Override
-    public int deleteEmsFacsFlowRelByIds(Long[] ids)
-    {
-        return emsFacsFlowRelMapper.deleteEmsFacsFlowRelByIds(ids);
-    }
-
-    /**
-     * 删除能源设施能流关系信息
-     * 
-     * @param id 能源设施能流关系主键
-     * @return 结果
-     */
-    @Override
-    public int deleteEmsFacsFlowRelById(Long id)
-    {
-        return emsFacsFlowRelMapper.deleteEmsFacsFlowRelById(id);
-    }
-}

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

@@ -0,0 +1,96 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.ems.domain.EmsObjFlowRel;
+import com.ruoyi.ems.mapper.EmsObjFlowRelMapper;
+import com.ruoyi.ems.service.IEmsFacsService;
+import com.ruoyi.ems.service.IEmsObjFlowRelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 能源设施能流关系Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-07-10
+ */
+@Service
+public class EmsObjFlowRelServiceImpl implements IEmsObjFlowRelService
+{
+    @Autowired
+    private EmsObjFlowRelMapper flowRelMapper;
+
+    /**
+     * 查询能源设施能流关系
+     * 
+     * @param id 能源设施能流关系主键
+     * @return 能源设施能流关系
+     */
+    @Override
+    public EmsObjFlowRel selectFlowRelById(Long id)
+    {
+        return flowRelMapper.selectFlowRelById(id);
+    }
+
+    /**
+     * 查询能源设施能流关系列表
+     * 
+     * @param FlowRel 能源设施能流关系
+     * @return 能源设施能流关系
+     */
+    @Override
+    public List<EmsObjFlowRel> selectFlowRelList(EmsObjFlowRel FlowRel)
+    {
+        return flowRelMapper.selectFlowRelList(FlowRel);
+    }
+
+    /**
+     * 新增能源设施能流关系
+     * 
+     * @param FlowRel 能源设施能流关系
+     * @return 结果
+     */
+    @Override
+    public int insertFlowRel(EmsObjFlowRel FlowRel)
+    {
+        FlowRel.setCreateTime(DateUtils.getNowDate());
+        return flowRelMapper.insertFlowRel(FlowRel);
+    }
+
+    /**
+     * 修改能源设施能流关系
+     * 
+     * @param FlowRel 能源设施能流关系
+     * @return 结果
+     */
+    @Override
+    public int updateFlowRel(EmsObjFlowRel FlowRel)
+    {
+        return flowRelMapper.updateFlowRel(FlowRel);
+    }
+
+    /**
+     * 批量删除能源设施能流关系
+     * 
+     * @param ids 需要删除的能源设施能流关系主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFlowRelByIds(Long[] ids)
+    {
+        return flowRelMapper.deleteFlowRelByIds(ids);
+    }
+
+    /**
+     * 删除能源设施能流关系信息
+     * 
+     * @param id 能源设施能流关系主键
+     * @return 结果
+     */
+    @Override
+    public int deleteFlowRelById(Long id)
+    {
+        return flowRelMapper.deleteFlowRelById(id);
+    }
+}

+ 0 - 97
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsFacsFlowRelMapper.xml

@@ -1,97 +0,0 @@
-<?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.EmsFacsFlowRelMapper">
-    
-    <resultMap type="com.ruoyi.ems.domain.EmsFacsFlowRel" id="EmsFacsFlowRelResult">
-        <result property="id"    column="id"    />
-        <result property="code"    column="code"    />
-        <result property="exportFacsCode"    column="export_facs_code"    />
-        <result property="exportFacsName"    column="export_facs_Name"    />
-        <result property="inputFacsCode"    column="input_facs_code"    />
-        <result property="inputFacsName"    column="input_facs_name"    />
-        <result property="emsCls"    column="ems_cls"    />
-        <result property="emsClsName" column="ems_cls_name" />
-        <result property="state"    column="state"    />
-        <result property="actionType"    column="action_type"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateTime"    column="update_time"    />
-    </resultMap>
-
-    <sql id="selectEmsFacsFlowRelVo">
-        select
-            r.`id`, r.`code`, r.`export_facs_code`, f1.`facs_name` as export_facs_name, r.`input_facs_code`, f2.`facs_name` as input_facs_name, r.`ems_cls`, c.`name` as ems_cls_name, r.`state`, r.`action_type`, r.`create_time`, r.`update_time`
-        from adm_ems_facs_flow_rel r
-            LEFT JOIN adm_ems_facs f1 ON r.`export_facs_code` = f1.`facs_code`
-            LEFT JOIN adm_ems_facs f2 ON r.input_facs_code = f2.`facs_code`
-            LEFT JOIN dim_gb_ems_cls c ON r.`ems_cls` = c.`code`
-    </sql>
-
-    <select id="selectEmsFacsFlowRelList" parameterType="com.ruoyi.ems.domain.EmsFacsFlowRel" resultMap="EmsFacsFlowRelResult">
-        <include refid="selectEmsFacsFlowRelVo"/>
-        <where>  
-            <if test="code != null  and code != ''"> and r.`code` = #{code}</if>
-            <if test="exportFacsCode != null  and exportFacsCode != ''"> and r.`export_facs_code` = #{exportFacsCode}</if>
-            <if test="inputFacsCode != null  and inputFacsCode != ''"> and r.`input_facs_code` = #{inputFacsCode}</if>
-            <if test="emsCls != null  and emsCls != ''"> and r.`ems_cls` = #{emsCls}</if>
-            <if test="state != null "> and r.`state` = #{state}</if>
-            <if test="actionType != null  and actionType != ''"> and r.`action_type` = #{actionType}</if>
-        </where>
-    </select>
-    
-    <select id="selectEmsFacsFlowRelById" parameterType="Long" resultMap="EmsFacsFlowRelResult">
-        <include refid="selectEmsFacsFlowRelVo"/>
-        where r.`id` = #{id}
-    </select>
-        
-    <insert id="insertEmsFacsFlowRel" parameterType="com.ruoyi.ems.domain.EmsFacsFlowRel" useGeneratedKeys="true" keyProperty="id">
-        insert into adm_ems_facs_flow_rel
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="code != null and code != ''">code,</if>
-            <if test="exportFacsCode != null and exportFacsCode != ''">export_facs_code,</if>
-            <if test="inputFacsCode != null and inputFacsCode != ''">input_facs_code,</if>
-            <if test="emsCls != null and emsCls != ''">ems_cls,</if>
-            <if test="state != null">state,</if>
-            <if test="actionType != null and actionType != ''">action_type,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="code != null and code != ''">#{code},</if>
-            <if test="exportFacsCode != null and exportFacsCode != ''">#{exportFacsCode},</if>
-            <if test="inputFacsCode != null and inputFacsCode != ''">#{inputFacsCode},</if>
-            <if test="emsCls != null and emsCls != ''">#{emsCls},</if>
-            <if test="state != null">#{state},</if>
-            <if test="actionType != null and actionType != ''">#{actionType},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-         </trim>
-    </insert>
-
-    <update id="updateEmsFacsFlowRel" parameterType="com.ruoyi.ems.domain.EmsFacsFlowRel">
-        update adm_ems_facs_flow_rel
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="code != null and code != ''">code = #{code},</if>
-            <if test="exportFacsCode != null and exportFacsCode != ''">export_facs_code = #{exportFacsCode},</if>
-            <if test="inputFacsCode != null and inputFacsCode != ''">input_facs_code = #{inputFacsCode},</if>
-            <if test="emsCls != null and emsCls != ''">ems_cls = #{emsCls},</if>
-            <if test="state != null">state = #{state},</if>
-            <if test="actionType != null and actionType != ''">action_type = #{actionType},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteEmsFacsFlowRelById" parameterType="Long">
-        delete from adm_ems_facs_flow_rel where id = #{id}
-    </delete>
-
-    <delete id="deleteEmsFacsFlowRelByIds" parameterType="String">
-        delete from adm_ems_facs_flow_rel where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 96 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsObjFlowRelMapper.xml

@@ -0,0 +1,96 @@
+<?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.EmsObjFlowRelMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.EmsObjFlowRel" id="flowRelResult">
+        <result property="id"    column="id"    />
+        <result property="exportObj"       column="export_obj"    />
+        <result property="exportObjName"   column="export_obj_name"    />
+        <result property="exportObjType"   column="export_obj_type"    />
+        <result property="inputObj"        column="input_obj"    />
+        <result property="inputObjName"    column="input_obj_name"    />
+        <result property="inputObjType"    column="input_obj_type"    />
+        <result property="emsCls"          column="ems_cls"    />
+        <result property="emsClsName"      column="ems_cls_name" />
+        <result property="flowDesc"        column="flow_desc"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectEmsFacsFlowRelVo">
+        select
+            r.`id`, r.`export_obj`, r.`export_obj_type`, r.`input_obj`, r.`input_obj_type`, r.`ems_cls`, c.`name` as ems_cls_name, r.`flow_desc`, r.`create_time`, r.`update_time`,
+            COALESCE(
+              (SELECT facs.facs_name FROM adm_ems_facs facs WHERE facs.facs_code = r.export_obj AND r.export_obj_type = 1),
+              (SELECT dev.device_name FROM adm_ems_device dev WHERE dev.device_code = r.export_obj AND r.export_obj_type = 2)
+            ) AS export_obj_name,
+		    COALESCE(
+              (SELECT facs.facs_name FROM adm_ems_facs facs WHERE facs.facs_code = r.input_obj AND r.input_obj_type = 1),
+              (SELECT dev.device_name FROM adm_ems_device dev WHERE dev.device_code = r.input_obj AND r.input_obj_type = 2)
+            ) AS input_obj_name
+        from adm_ems_flow_rel r
+            LEFT JOIN dim_gb_ems_cls c ON r.`ems_cls` = c.`code`
+    </sql>
+
+    <select id="selectFlowRelList" parameterType="com.ruoyi.ems.domain.EmsObjFlowRel" resultMap="flowRelResult">
+        <include refid="selectEmsFacsFlowRelVo"/>
+        <where>  
+            <if test="exportObj != null  and exportObj != ''"> and r.`export_obj` = #{exportObj}</if>
+            <if test="exportObjType != null"> and r.`export_obj_type` = #{exportObjType}</if>
+            <if test="inputObj != null  and inputObj != ''"> and r.`input_obj` = #{inputObj}</if>
+            <if test="inputObjType != null  and inputObjType != ''"> and r.`input_obj_type` = #{inputObjType}</if>
+            <if test="emsCls != null  and emsCls != ''"> and r.`ems_cls` = #{emsCls}</if>
+        </where>
+    </select>
+    
+    <select id="selectFlowRelById" parameterType="Long" resultMap="flowRelResult">
+        <include refid="selectEmsFacsFlowRelVo"/>
+        where r.`id` = #{id}
+    </select>
+        
+    <insert id="insertFlowRel" parameterType="com.ruoyi.ems.domain.EmsObjFlowRel" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_ems_flow_rel
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="exportObj != null  and exportObj != ''">export_obj,</if>
+            <if test="exportObjType != null">export_obj_type,</if>
+            <if test="inputObj != null  and inputObj != ''">input_obj,</if>
+            <if test="inputObjType != null">input_obj_type,</if>
+            <if test="emsCls != null and emsCls != ''">ems_cls,</if>
+            <if test="flowDesc != null and flowDesc != ''">flow_desc,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="exportObj != null  and exportObj != ''">#{exportObj},</if>
+            <if test="exportObjType != null">#{exportObjType},</if>
+            <if test="inputObj != null  and inputObj != ''">#{inputObj},</if>
+            <if test="inputObjType != null">#{inputObjType},</if>
+            <if test="emsCls != null and emsCls != ''">#{emsCls},</if>
+            <if test="flowDesc != null and flowDesc != ''">#{flowDesc},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFlowRel" parameterType="com.ruoyi.ems.domain.EmsObjFlowRel">
+        update adm_ems_flow_rel
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="exportObj != null  and exportObj != ''">export_obj = #{exportObj},</if>
+            <if test="exportObjType != null">export_obj_type = #{exportObjType},</if>
+            <if test="inputObj != null  and inputObj != ''">input_obj = #{inputObj},</if>
+            <if test="inputObjType != null">input_obj_type = #{inputObjType},</if>
+            <if test="emsCls != null and emsCls != ''">ems_cls = #{emsCls},</if>
+            <if test="flowDesc != null and flowDesc != ''">flow_desc = #{flowDesc},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFlowRelById" parameterType="Long">
+        delete from adm_ems_flow_rel where id = #{id}
+    </delete>
+
+    <delete id="deleteFlowRelByIds" parameterType="String">
+        delete from adm_ems_flow_rel where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 16 - 9
ems-cloud/sql/ems_init_data.sql

@@ -146,9 +146,14 @@ INSERT INTO `adm_ems_obj_event` (`model_code`, `event_type`, `event_key`, `event
 
 
 -- 能源设施能流关系DEMO数据
-INSERT INTO `adm_ems_facs_flow_rel` (`code`, `export_facs_code`, `input_facs_code`, `ems_cls`, `state`, `action_type`) VALUES ('W201_Z101', 'W201', 'Z101', '45', 1, '4501');
-INSERT INTO `adm_ems_facs_flow_rel` (`code`, `export_facs_code`, `input_facs_code`, `ems_cls`, `state`, `action_type`) VALUES ('E501_W201', 'E501', 'W201', '45', 1, '4502');
-INSERT INTO `adm_ems_facs_flow_rel` (`code`, `export_facs_code`, `input_facs_code`, `ems_cls`, `state`, `action_type`) VALUES ('E501_Z101', 'E501', 'Z101', '45', 1, '4505');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('W201', 1, 'Z101', 1, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('E501', 1, 'W201', 1, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('E501', 1, 'Z101', 1, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-T-1001', 2, 'D-B-1001', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-B-T-1001', 2, 'D-B-1002', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-N-T-1002', 2, 'D-N-1001', 2, '45', '供电');
+INSERT INTO `adm_ems_flow_rel` (`export_obj`, `export_obj_type`, `input_obj`, `input_obj_type`, `ems_cls`, `flow_desc`) VALUES ('D-N-T-1002', 2, 'D-N-1002', 2, '45', '供电');
+
 
 -- 能源设备
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R101-001', '开水炉',              'Z040', '美的', 'C10', '开水间', '2', 'Zoning', 'B-101', '321283124S3001,321283124S300101,B-101', null, 'Z110', null, 'SYS_BA');
@@ -232,12 +237,12 @@ INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R122-101', '断路器',            'W2', null, null, null, '1', 'Zoning', 'N-122', '321283124S3002,321283124S300202,N-122', null, 'W201', null, 'SYS_BA');
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R123-101', '电源插座',          'W2', null, null, null, '1', 'Zoning', 'N-123', '321283124S3002,321283124S300203,N-123', null, 'Z110', null, 'SYS_BA');
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R124-101', '加热器',            'Z020', null, null, null, '1', 'Zoning', 'N-124', '321283124S3002,321283124S300203,N-124', null, 'Z102', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R125-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-125', '321283124S3002,321283124S300204,N-125' null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R126-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-126', '321283124S3002,321283124S300204,N-126' null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R127-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-127', '321283124S3002,321283124S300204,N-127' null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R128-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-128', '321283124S3002,321283124S300204,N-128' null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R129-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-129', '321283124S3002,321283124S300205,N-129' null, 'Z110', null, 'SYS_BA');
-INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R130-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-130', '321283124S3002,321283124S300205,N-130' null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R125-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-125', '321283124S3002,321283124S300204,N-125', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R126-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-126', '321283124S3002,321283124S300204,N-126', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R127-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-127', '321283124S3002,321283124S300204,N-127', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R128-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-128', '321283124S3002,321283124S300204,N-128', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R129-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-129', '321283124S3002,321283124S300205,N-129', null, 'Z110', null, 'SYS_BA');
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R130-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-130', '321283124S3002,321283124S300205,N-130', null, 'Z110', null, 'SYS_BA');
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R131-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-131', '321283124S3002,321283124S300205,N-131', null, 'Z110', null, 'SYS_BA');
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Z010-R132-101', '空调',              'Z020', null, null, null, '1', 'Zoning', 'N-132', '321283124S3002,321283124S300205,N-132', null, 'Z110', null, 'SYS_BA');
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'Car-101', '照明灯',                  'Z010', null, null, null, '1', 'Zoning', '321283124S3002_CW-XK', '321283124S3002,321283124S300206,321283124S3002_CW-XK', null, 'Z102', null, 'SYS_BA');
@@ -252,6 +257,8 @@ INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-002', '光伏板2',      'E5', null, null, null, '1', 'Building', 'S30K140-S30K150', '321283124S3003,S30K140-S30K150', null, 'E503', null, 'SYS_GF');
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ( 'E503-K140-K150-003', '光伏板3',      'E5', null, null, null, '1', 'Building', 'S30K150-S30K180', '321283124S3003,S30K150-S30K180', null, 'E503', null, 'SYS_GF');
 
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-T-1001', '变压器', 'W2', '西门子', 'T221123', '北区', 1, 'Area', '321283124S3001', '321283124S3001', null, 'W201', 'T', null);
+INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-T-1002', '变压器', 'W2', '西门子', 'T221212', '南区', 1, 'Area', '321283124S3002', '321283124S3002', null, 'W201', 'T', null);
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-1001', '配电柜', 'W2', '安科瑞', 'DX2121021', '综合楼配电间', 1, 'Area', '321283124S3001', '321283124S3001', null, 'W201', 'AP', null);
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-1002', '配电柜', 'W2', '安科瑞', 'DX2121021', '广场配电柜',   1, 'Area', '321283124S3001', '321283124S3001', null, 'W201', 'AP', null);
 INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_category`, `device_brand`, `device_spec`, `location`, `device_status`, `area_type`, `ref_area`, `area_ancestors`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-N-1001', '配电柜', 'W2', '安科瑞', 'DX2121021', '综合楼配电间', 1, 'Area', '321283124S3002', '321283124S3002', null, 'W202', 'AP', null);

+ 12 - 11
ems-cloud/sql/ems_server.sql

@@ -262,6 +262,7 @@ create table dim_ems_dev_process (
 ) engine=innodb auto_increment=1 comment = '能源设施工艺系统维表';
 
 -- 能源设备工艺标识维表初始数据
+INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('T', '变压器', null, 'W', 'W2', null);
 INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('AA', '高压配电柜', null, 'W', 'W2', null);
 INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('AH', '高压开关柜', null, 'W', 'W2', null);
 INSERT INTO `dim_ems_dev_process` (`ps_code`, `ps_name`, `desc`, `category_code`, `subcategory_code`, `version`) VALUES ('AJ', '高压电容柜', null, 'W', 'W2', null);
@@ -610,21 +611,21 @@ create table adm_ems_subsystem  (
 -- ----------------------------
 -- 能源设施能流关系表
 -- ----------------------------
-drop table if exists adm_ems_facs_flow_rel;
-create table adm_ems_facs_flow_rel  (
+drop table if exists adm_ems_flow_rel;
+create table adm_ems_flow_rel  (
   `id`                bigint(20)      not null auto_increment      comment '序号',
-  `code`              varchar(32)     not null                     comment '编码',
-  `export_facs_code`  varchar(16)     not null                     comment '能源输出设施',
-  `input_facs_code`   varchar(16)     not null                     comment '能源流入设施',
+  `export_obj`        varchar(64)     not null                     comment '能源输出对象',
+  `export_obj_type`   int             not null                     comment '能源输出对象类型',
+  `input_obj`         varchar(64)     not null                     comment '能源流入对象',
+  `input_obj_type`    int             not null                     comment '能源输入对象类型',
   `ems_cls`           varchar(16)     not null                     comment '能源流动介质',
-  `state`             int             not null                     comment '供能状态 0-停止,1-供应中',
-  `action_type`       varchar(6)      not null                     comment '4501-购电,4502-上网,4503-充电,4504-放电,4505-自产自销',
-  `create_time`     datetime        default CURRENT_TIMESTAMP    comment '创建时间',
+  `flow_desc`         varchar(256)    default null                 comment '能流描述',
+  `create_time`     datetime        default CURRENT_TIMESTAMP      comment '创建时间',
   `update_time`     datetime        default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '更新时间',
   primary key (`id`),
-  unique key ux_ems_facs_flow_rel_code(`code`),
-  key idx_ems_facs_flow_rel_code(`export_facs_code`,`input_facs_code`)
-) engine=innodb auto_increment=1 comment = '能源设施能流关系表';
+  unique key ux_ems_flow_rel_code(`export_obj`,`export_obj_type`,`input_obj`,`input_obj_type`,`ems_cls`),
+  key idx_ems_facs_flow_rel_code(`export_obj`,`input_obj`)
+) engine=innodb auto_increment=1 comment = '能流关系表';
 
 
 -- ----------------------------