Forráskód Böngészése

设备信息配置

lv.wenbin 1 éve
szülő
commit
d0b446fec5

+ 15 - 15
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/EmissionFactorController.java → ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/CaConfigController.java

@@ -29,8 +29,8 @@ import java.util.List;
  * @date 2024-07-11
  */
 @RestController
-@RequestMapping("/basecfg/emissionFactor")
-public class EmissionFactorController extends BaseController
+@RequestMapping("/basecfg/cacfg")
+public class CaConfigController extends BaseController
 {
     @Autowired
     private IEmissionFactorService emissionFactorService;
@@ -38,9 +38,9 @@ public class EmissionFactorController extends BaseController
     /**
      * 查询排放因子维列表
      */
-    @RequiresPermissions("basecfg:emissionFactor:list")
-    @GetMapping("/list")
-    public TableDataInfo list(EmissionFactor emissionFactor)
+    @RequiresPermissions("basecfg:cacfg:list")
+    @GetMapping("/emissionFactor/list")
+    public TableDataInfo listEmissionFactor(EmissionFactor emissionFactor)
     {
         startPage();
         List<EmissionFactor> list = emissionFactorService.selectEmissionFactorList(emissionFactor);
@@ -50,9 +50,9 @@ public class EmissionFactorController extends BaseController
     /**
      * 导出排放因子维列表
      */
-    @RequiresPermissions("basecfg:emissionFactor:export")
+    @RequiresPermissions("basecfg:cacfg:export")
     @Log(title = "排放因子", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
+    @PostMapping("/emissionFactor/export")
     public void export(HttpServletResponse response, EmissionFactor emissionFactor)
     {
         List<EmissionFactor> list = emissionFactorService.selectEmissionFactorList(emissionFactor);
@@ -63,8 +63,8 @@ public class EmissionFactorController extends BaseController
     /**
      * 获取排放因子维详细信息
      */
-    @RequiresPermissions("basecfg:emissionFactor:query")
-    @GetMapping(value = "/{id}")
+    @RequiresPermissions("basecfg:cacfg:query")
+    @GetMapping(value = "/emissionFactor/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
         return success(emissionFactorService.selectEmissionFactorById(id));
@@ -73,9 +73,9 @@ public class EmissionFactorController extends BaseController
     /**
      * 新增排放因子维
      */
-    @RequiresPermissions("basecfg:emissionFactor:add")
+    @RequiresPermissions("basecfg:cacfg:add")
     @Log(title = "排放因子", businessType = BusinessType.INSERT)
-    @PostMapping
+    @PostMapping(value = "/emissionFactor")
     public AjaxResult add(@RequestBody EmissionFactor emissionFactor)
     {
         return toAjax(emissionFactorService.insertEmissionFactor(emissionFactor));
@@ -84,9 +84,9 @@ public class EmissionFactorController extends BaseController
     /**
      * 修改排放因子维
      */
-    @RequiresPermissions("basecfg:emissionFactor:edit")
+    @RequiresPermissions("basecfg:cacfg:edit")
     @Log(title = "排放因子", businessType = BusinessType.UPDATE)
-    @PutMapping
+    @PutMapping(value = "/emissionFactor")
     public AjaxResult edit(@RequestBody EmissionFactor emissionFactor)
     {
         return toAjax(emissionFactorService.updateEmissionFactor(emissionFactor));
@@ -95,9 +95,9 @@ public class EmissionFactorController extends BaseController
     /**
      * 删除排放因子维
      */
-    @RequiresPermissions("basecfg:emissionFactor:remove")
+    @RequiresPermissions("basecfg:cacfg:remove")
     @Log(title = "排放因子", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
+	@DeleteMapping("/emissionFactor/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
         return toAjax(emissionFactorService.deleteEmissionFactorByIds(ids));

+ 17 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/CommonController.java

@@ -12,10 +12,12 @@ package com.ruoyi.ems.controller;
 
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.ems.domain.DevcType;
 import com.ruoyi.ems.domain.ElecValencyType;
 import com.ruoyi.ems.domain.EmsCls;
 import com.ruoyi.ems.domain.EmsTag;
 import com.ruoyi.ems.domain.vo.TreeEntity;
+import com.ruoyi.ems.service.IDevcTypeService;
 import com.ruoyi.ems.service.IElecValencyTypeService;
 import com.ruoyi.ems.service.IEmsClsService;
 import com.ruoyi.ems.service.IEmsTagService;
@@ -48,6 +50,9 @@ public class CommonController extends BaseController {
     @Autowired
     private IEmsTagService emsTagService;
 
+    @Autowired
+    private IDevcTypeService devcTypeService;
+
     /**
      * 电价分类
      *
@@ -71,7 +76,19 @@ public class CommonController extends BaseController {
     }
 
     /**
+     * 设备分类
+     *
+     * @return 分类列表
+     */
+    @GetMapping(value = "/devc/type")
+    public AjaxResult getDevcType() {
+        List<DevcType> types = devcTypeService.selectDevcTypeList(new DevcType());
+        return success(types);
+    }
+
+    /**
      * 标签列表
+     *
      * @return 标签列表
      */
     @GetMapping(value = "/emstag")

+ 12 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceController.java

@@ -48,6 +48,18 @@ public class DeviceController extends BaseController
     }
 
     /**
+     * 查询能源设备列表
+     */
+    @RequiresPermissions("basecfg:device:list")
+    @GetMapping("/listByAreaTree")
+    public TableDataInfo listByAreaTree(EmsDevice emsDevice)
+    {
+        startPage();
+        List<EmsDevice> list = deviceService.selectEmsDeviceList(emsDevice);
+        return getDataTable(list);
+    }
+
+    /**
      * 导出能源设备列表
      */
     @RequiresPermissions("basecfg:device:export")

+ 65 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/DevcType.java

@@ -0,0 +1,65 @@
+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;
+
+/**
+ * 设备类型对象 dim_devc_type
+ * 
+ * @author ruoyi
+ * @date 2024-08-05
+ */
+public class DevcType extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 标签代码 */
+    @Excel(name = "标签代码")
+    private Long typeCode;
+
+    /** 标签名称 */
+    @Excel(name = "标签名称")
+    private String typeName;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setTypeCode(Long typeCode) 
+    {
+        this.typeCode = typeCode;
+    }
+
+    public Long getTypeCode() 
+    {
+        return typeCode;
+    }
+    public void setTypeName(String typeName) 
+    {
+        this.typeName = typeName;
+    }
+
+    public String getTypeName() 
+    {
+        return typeName;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("typeCode", getTypeCode())
+            .append("typeName", getTypeName())
+            .toString();
+    }
+}

+ 15 - 2
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsDevice.java

@@ -27,9 +27,12 @@ public class EmsDevice extends BaseEntity
     private String deviceName;
 
     /** 设备类型 */
-    @Excel(name = "设备类型")
     private Long deviceType;
 
+    /** 设备类型名称 */
+    @Excel(name = "设备类型")
+    private String deviceTypeName;
+
     /** 设备状态 */
     @Excel(name = "设备状态")
     private Long deviceStatus;
@@ -87,7 +90,16 @@ public class EmsDevice extends BaseEntity
     {
         return deviceType;
     }
-    public void setDeviceStatus(Long deviceStatus) 
+
+    public String getDeviceTypeName() {
+        return deviceTypeName;
+    }
+
+    public void setDeviceTypeName(String deviceTypeName) {
+        this.deviceTypeName = deviceTypeName;
+    }
+
+    public void setDeviceStatus(Long deviceStatus)
     {
         this.deviceStatus = deviceStatus;
     }
@@ -147,6 +159,7 @@ public class EmsDevice extends BaseEntity
             .append("deviceCode", getDeviceCode())
             .append("deviceName", getDeviceName())
             .append("deviceType", getDeviceType())
+            .append("deviceTypeName", getDeviceTypeName())
             .append("deviceStatus", getDeviceStatus())
             .append("areaType", getAreaType())
             .append("refArea", getRefArea())

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/DevcTypeMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.DevcType;
+
+/**
+ * 设备类型Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-08-05
+ */
+public interface DevcTypeMapper {
+    /**
+     * 查询设备类型
+     *
+     * @param id 设备类型主键
+     * @return 设备类型
+     */
+    DevcType selectDevcTypeById(Long id);
+
+    /**
+     * 查询设备类型列表
+     *
+     * @param devcType 设备类型
+     * @return 设备类型集合
+     */
+    List<DevcType> selectDevcTypeList(DevcType devcType);
+
+    /**
+     * 新增设备类型
+     *
+     * @param devcType 设备类型
+     * @return 结果
+     */
+    int insertDevcType(DevcType devcType);
+
+    /**
+     * 修改设备类型
+     *
+     * @param devcType 设备类型
+     * @return 结果
+     */
+    int updateDevcType(DevcType devcType);
+
+    /**
+     * 删除设备类型
+     *
+     * @param id 设备类型主键
+     * @return 结果
+     */
+    int deleteDevcTypeById(Long id);
+
+    /**
+     * 批量删除设备类型
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteDevcTypeByIds(Long[] ids);
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IDevcTypeService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.service;
+
+import com.ruoyi.ems.domain.DevcType;
+
+import java.util.List;
+
+/**
+ * 设备类型Service接口
+ *
+ * @author ruoyi
+ * @date 2024-08-05
+ */
+public interface IDevcTypeService {
+    /**
+     * 查询设备类型
+     *
+     * @param id 设备类型主键
+     * @return 设备类型
+     */
+    DevcType selectDevcTypeById(Long id);
+
+    /**
+     * 查询设备类型列表
+     *
+     * @param devcType 设备类型
+     * @return 设备类型集合
+     */
+    List<DevcType> selectDevcTypeList(DevcType devcType);
+
+    /**
+     * 新增设备类型
+     *
+     * @param devcType 设备类型
+     * @return 结果
+     */
+    int insertDevcType(DevcType devcType);
+
+    /**
+     * 修改设备类型
+     *
+     * @param devcType 设备类型
+     * @return 结果
+     */
+    int updateDevcType(DevcType devcType);
+
+    /**
+     * 批量删除设备类型
+     *
+     * @param ids 需要删除的设备类型主键集合
+     * @return 结果
+     */
+    int deleteDevcTypeByIds(Long[] ids);
+
+    /**
+     * 删除设备类型信息
+     *
+     * @param id 设备类型主键
+     * @return 结果
+     */
+    int deleteDevcTypeById(Long id);
+}

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

@@ -0,0 +1,94 @@
+package com.ruoyi.ems.service.impl;
+
+import com.ruoyi.ems.domain.DevcType;
+import com.ruoyi.ems.mapper.DevcTypeMapper;
+import com.ruoyi.ems.service.IDevcTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 设备类型Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-08-05
+ */
+@Service
+public class DevcTypeServiceImpl implements IDevcTypeService
+{
+    @Autowired
+    private DevcTypeMapper devcTypeMapper;
+
+    /**
+     * 查询设备类型
+     * 
+     * @param id 设备类型主键
+     * @return 设备类型
+     */
+    @Override
+    public DevcType selectDevcTypeById(Long id)
+    {
+        return devcTypeMapper.selectDevcTypeById(id);
+    }
+
+    /**
+     * 查询设备类型列表
+     * 
+     * @param devcType 设备类型
+     * @return 设备类型
+     */
+    @Override
+    public List<DevcType> selectDevcTypeList(DevcType devcType)
+    {
+        return devcTypeMapper.selectDevcTypeList(devcType);
+    }
+
+    /**
+     * 新增设备类型
+     * 
+     * @param devcType 设备类型
+     * @return 结果
+     */
+    @Override
+    public int insertDevcType(DevcType devcType)
+    {
+        return devcTypeMapper.insertDevcType(devcType);
+    }
+
+    /**
+     * 修改设备类型
+     * 
+     * @param devcType 设备类型
+     * @return 结果
+     */
+    @Override
+    public int updateDevcType(DevcType devcType)
+    {
+        return devcTypeMapper.updateDevcType(devcType);
+    }
+
+    /**
+     * 批量删除设备类型
+     * 
+     * @param ids 需要删除的设备类型主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDevcTypeByIds(Long[] ids)
+    {
+        return devcTypeMapper.deleteDevcTypeByIds(ids);
+    }
+
+    /**
+     * 删除设备类型信息
+     * 
+     * @param id 设备类型主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDevcTypeById(Long id)
+    {
+        return devcTypeMapper.deleteDevcTypeById(id);
+    }
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/DevcTypeMapper.xml

@@ -0,0 +1,61 @@
+<?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.DevcTypeMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.DevcType" id="devcTypeResult">
+        <result property="id"    column="id"    />
+        <result property="typeCode"    column="type_code"    />
+        <result property="typeName"    column="type_name"    />
+    </resultMap>
+
+    <sql id="selectDevcTypeVo">
+        select id, type_code, type_name from dim_devc_type
+    </sql>
+
+    <select id="selectDevcTypeList" parameterType="com.ruoyi.ems.domain.DevcType" resultMap="devcTypeResult">
+        <include refid="selectDevcTypeVo"/>
+        <where>  
+            <if test="typeCode != null "> and type_code = #{typeCode}</if>
+            <if test="typeName != null  and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
+        </where>
+    </select>
+    
+    <select id="selectDevcTypeById" parameterType="Long" resultMap="devcTypeResult">
+        <include refid="selectDevcTypeVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertDevcType" parameterType="com.ruoyi.ems.domain.DevcType" useGeneratedKeys="true" keyProperty="id">
+        insert into dim_devc_type
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="typeCode != null">type_code,</if>
+            <if test="typeName != null and typeName != ''">type_name,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="typeCode != null">#{typeCode},</if>
+            <if test="typeName != null and typeName != ''">#{typeName},</if>
+         </trim>
+    </insert>
+
+    <update id="updateDevcType" parameterType="com.ruoyi.ems.domain.DevcType">
+        update dim_devc_type
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="typeCode != null">type_code = #{typeCode},</if>
+            <if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteDevcTypeById" parameterType="Long">
+        delete from dim_devc_type where id = #{id}
+    </delete>
+
+    <delete id="deleteDevcTypeByIds" parameterType="String">
+        delete from dim_devc_type where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

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

@@ -6,22 +6,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <resultMap type="com.ruoyi.ems.domain.EmsDevice" id="EmsDeviceResult">
         <result property="id"    column="id"    />
-        <result property="deviceCode"    column="device_code"    />
-        <result property="deviceName"    column="device_name"    />
-        <result property="deviceType"    column="device_type"    />
-        <result property="deviceStatus"   column="device_status"    />
-        <result property="areaType"       column="area_type"    />
-        <result property="refArea"        column="ref_area"    />
-        <result property="refFacs"        column="ref_facs"    />
-        <result property="refFacsName"    column="ref_facs_name"    />
+        <result property="deviceCode"        column="device_code"    />
+        <result property="deviceName"        column="device_name"    />
+        <result property="deviceType"        column="device_type"    />
+        <result property="deviceTypeName"    column="device_type_name"    />
+        <result property="deviceStatus"      column="device_status"    />
+        <result property="areaType"          column="area_type"    />
+        <result property="refArea"           column="ref_area"    />
+        <result property="refFacs"           column="ref_facs"    />
+        <result property="refFacsName"       column="ref_facs_name"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
     </resultMap>
 
     <sql id="selectEmsDeviceVo">
         select
-            d.`id`, d.`device_code`, d.`device_name`, d.`device_type`, d.`device_status`, d.`area_type`, d.`ref_area`, d.`ref_facs`, f.`facs_name` as ref_facs_name, d.`create_time`, d.`update_time`
+            d.`id`, d.`device_code`, d.`device_name`, d.`device_type`, dt.`type_name` as device_type_name, d.`device_status`, d.`area_type`, d.`ref_area`, d.`ref_facs`, f.`facs_name` as ref_facs_name, d.`create_time`, d.`update_time`
         from adm_ems_device d
+            LEFT JOIN dim_devc_type dt ON d.`device_type` = dt.`type_code`
             LEFT JOIN adm_ems_facs f ON d.`ref_facs` = f.`facs_code`
     </sql>
 

+ 56 - 7
ems-cloud/sql/ems_server.sql

@@ -237,7 +237,11 @@ INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `vers
 INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('C1', '电化学储能站', 'C', null, 'GB/T 43033-2013');
 INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('C2', '飞轮、压缩空气等机械储能站', 'C', null, 'GB/T 43033-2013');
 INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('C3', '蓄冷/热站', 'C', null, 'GB/T 43033-2013');
-INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('c4', '储氢站', 'C', null, 'GB/T 43033-2013');
+INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('C4', '储氢站', 'C', null, 'GB/T 43033-2013');
+INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('Z001', '室内照明', 'Z', null, null);
+INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('Z002', '室外照明', 'Z', null, null);
+INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('Z010', '公共设施', 'Z', null, null);
+INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `version`) VALUES ('Z020', '空调设施', 'Z', null, null);
 
 -- ----------------------------
 -- 标签分类
@@ -255,6 +259,26 @@ create table dim_ems_tag (
 INSERT INTO `dim_ems_tag` (`tag_model`, `tag_code`, `tag_name`) VALUES ('Area', 'Area_00', '公共区域');
 INSERT INTO `dim_ems_tag` (`tag_model`, `tag_code`, `tag_name`) VALUES ('Area', 'Area_01', '商户区域');
 
+
+-- ----------------------------
+-- 设备类型
+-- ----------------------------
+drop table if exists dim_devc_type;
+create table dim_devc_type (
+  `id`            bigint(20)      not null auto_increment    comment '序号',
+  `type_code`     int             not null                   comment '标签代码',
+  `type_name`     varchar(128)    not null                   comment '标签名称',
+  primary key (`id`),
+  unique key ux_devc_type(`type_code`)
+) engine=innodb auto_increment=1 comment = '设备类型';
+
+INSERT INTO `dim_devc_type` (`type_code`, `type_name`) VALUES (0, '未分类');
+INSERT INTO `dim_devc_type` (`type_code`, `type_name`) VALUES (1, '照明设备');
+INSERT INTO `dim_devc_type` (`type_code`, `type_name`) VALUES (2, '暖通设备');
+INSERT INTO `dim_devc_type` (`type_code`, `type_name`) VALUES (3, '运输设备');
+INSERT INTO `dim_devc_type` (`type_code`, `type_name`) VALUES (4, '服务设备');
+INSERT INTO `dim_devc_type` (`type_code`, `type_name`) VALUES (5, '信息设备');
+
 -- ----------------------------
 -- 电价计量分类
 -- ----------------------------
@@ -466,12 +490,18 @@ create table adm_ems_facs  (
 ) engine=innodb auto_increment=1 comment = '能源设施/系统表';
 
 -- 能源设施/系统DEMO数据
-INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('W201', '北区供电网', 'W', 'W2', 1, '321283124S3001', '华设');
-INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('W202', '南区供电网', 'W', 'W2', 1, '321283124S3002', '华设');
-INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('E501', '北区光伏', 'E', 'E5', 1, '321283124S3001', '华设');
-INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('E502', '南区光伏', 'E', 'E5', 1, '321283124S3002', '华设');
-INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z101', '北区负荷', 'Z', 'Z1', 1, '321283124S3001', '华设');
-INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z102', '南区负荷', 'Z', 'Z1', 1, '321283124S3002', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('W201', '北区-供电网', 'W', 'W2', 1, '321283124S3001', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('W202', '南区-供电网', 'W', 'W2', 1, '321283124S3002', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('E501', '北区-光伏', 'E', 'E5', 1, '321283124S3001', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('E502', '南区-光伏', 'E', 'E5', 1, '321283124S3002', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z101', '北区-室内照明', 'Z', 'Z001', 1, '321283124S3001', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z102', '北区-室外照明', 'Z', 'Z002', 1, '321283124S3001', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z110', '北区-公共设施', 'Z', 'Z010', 1, '321283124S3001', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z120', '北区-空调设施', 'Z', 'Z020', 1, '321283124S3001', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z201', '南区-室内照明', 'Z', 'Z001', 1, '321283124S3002', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z202', '南区-室外照明', 'Z', 'Z002', 1, '321283124S3002', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z210', '南区-公共设施', 'Z', 'Z010', 1, '321283124S3002', '华设');
+INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_type`, `facs_subtype`, `enable`, `ref_area`, `manufacturer`) VALUES ('Z220', '南区-空调设施', 'Z', 'Z020', 1, '321283124S3002', '华设');
 
 
 -- ----------------------------
@@ -542,6 +572,25 @@ create table adm_ems_device  (
 
 
 -- ----------------------------
+-- 计量设备表
+-- ----------------------------
+drop table if exists adm_meter_device;
+create table adm_meter_device  (
+  `id`              bigint(20)      not null auto_increment      comment '序号',
+  `device_code`     varchar(16)     not null                     comment '设备代码',
+  `device_name`     varchar(32)     not null                     comment '设备名称',
+  `meter_cls`       varchar(16)     not null                     comment '计量介质',
+  `meter_obj_type`  int             not null                     comment '计量对象类型 1-区块 2-设备',
+  `obj_code`        varchar(32)     not null                     comment '计量对象编码',
+  `col_cycle`       int             not null                     comment '采集周期',
+  `col_mode`        int             not null                     comment '采集方式',
+  `spec_desc`       varchar(128)    default null                 comment '规格描述',
+  primary key (`id`),
+  unique key ux_meter_device(`device_code`)
+) engine=innodb auto_increment=1 comment = '计量设备表';
+
+
+-- ----------------------------
 -- 能源策略表
 -- ----------------------------
 drop table if exists adm_op_energy_strategy;

+ 10 - 10
ems-cloud/sql/ems_sys.sql

@@ -223,16 +223,16 @@ insert into sys_menu values ('531',  '用能报表', '111', '2',  'statement-con
 insert into sys_menu values ('532',  '告警报表', '111', '3',  'statement-warn',    'analysis/statement/warn',    '', 1, 0, 'C', '0', '0',    'analysis:statement:warn',      'warn',     'admin', sysdate(), '', null, '告警报表');
 insert into sys_menu values ('533',  '自定义报表', '111', '4',  'statement-warn',  'analysis/statement/custom',   '', 1, 0, 'C', '0', '0',   'analysis:statement:custom',    'statement-zdy',   'admin', sysdate(), '', null, '自定义报表');
 -- 业务配置菜单
-insert into sys_menu values ('534',  '服务区',     '123', '1',  'basecfg-servicearea',    'basecfg/area/index',             '', 1, 0, 'C', '0', '0',   'basecfg:area:list',           'cfgwrite',   'admin', sysdate(), '', null, '服务区配置');
-insert into sys_menu values ('535',  '建筑配置',   '123', '2',  'basecfg-building',       'basecfg/building/index',         '', 1, 0, 'C', '0', '0',   'basecfg:building:list',        'cfgwrite',   'admin', sysdate(), '', null, '楼宇建筑配置');
-insert into sys_menu values ('536',  '区块配置',   '123', '3',  'basecfg-zoning',         'basecfg/zoning/index',           '', 1, 0, 'C', '0', '0',   'basecfg:zoning:list',          'cfgwrite',   'admin', sysdate(), '', null, '区块配置');
-insert into sys_menu values ('537',  '设施分类',   '124', '1',  'basecfg-facstype',       'basecfg/facstype/index',         '', 1, 0, 'C', '0', '0',   'basecfg:facstype:list',        'cfgwrite',   'admin', sysdate(), '', null, '设施配置');
-insert into sys_menu values ('538',  '能源设施',   '124', '2',  'basecfg-facscfg',        'basecfg/emsfacs/index',          '', 1, 0, 'C', '0', '0',   'basecfg:emsfacs:list',         'cfgwrite',   'admin', sysdate(), '', null, '设施配置');
-insert into sys_menu values ('539',  '能流关系',   '124', '3',  'basecfg-flowrel',        'basecfg/flowrel/index',          '', 1, 0, 'C', '0', '0',   'basecfg:flowrel:list',         'cfgwrite',   'admin', sysdate(), '', null, '设备配置');
-insert into sys_menu values ('540',  '用能设备',   '124', '4',  'basecfg-devccfg',        'basecfg/device/index',           '', 1, 0, 'C', '0', '0',   'basecfg:device:list',          'cfgwrite',   'admin', sysdate(), '', null, '设备配置');
-insert into sys_menu values ('541',  '国网电价',   '125', '1',  'basecfg-electricity',    'basecfg/electricity/index',   '', 1, 0, 'C', '0', '0',   'basecfg:electricity:list',  'cfgwrite',   'admin', sysdate(), '', null, '电价属性');
-insert into sys_menu values ('542',  '碳核算',     '125', '2',  'basecfg-carbon',          'basecfg/carbon/index',          '', 1, 0, 'C', '0', '0',   'basecfg:carbon:list',          'cfgwrite',   'admin', sysdate(), '', null, '核算配置');
-insert into sys_menu values ('543',  '排放因子',   '125', '3',  'basecfg-emissionFactor',  'basecfg/emissionfactor/index',  '', 1, 0, 'C', '0', '0',   'basecfg:emissionFactor:list',  'cfgwrite',   'admin', sysdate(), '', null, '碳排因子');
+insert into sys_menu values ('534',  '服务区',     '123', '1',  'basecfg-servicearea',    'basecfg/area/index',         '', 1, 0, 'C', '0', '0',   'basecfg:area:list',           'cfgwrite',   'admin', sysdate(), '', null, '服务区配置');
+insert into sys_menu values ('535',  '建筑配置',   '123', '2',  'basecfg-building',       'basecfg/building/index',     '', 1, 0, 'C', '0', '0',   'basecfg:building:list',        'cfgwrite',   'admin', sysdate(), '', null, '楼宇建筑配置');
+insert into sys_menu values ('536',  '区块配置',   '123', '3',  'basecfg-zoning',         'basecfg/zoning/index',       '', 1, 0, 'C', '0', '0',   'basecfg:zoning:list',          'cfgwrite',   'admin', sysdate(), '', null, '区块配置');
+insert into sys_menu values ('537',  '设施分类',   '124', '1',  'basecfg-facstype',       'basecfg/facstype/index',     '', 1, 0, 'C', '0', '0',   'basecfg:facstype:list',        'cfgwrite',   'admin', sysdate(), '', null, '设施配置');
+insert into sys_menu values ('538',  '能源设施',   '124', '2',  'basecfg-facscfg',        'basecfg/emsfacs/index',      '', 1, 0, 'C', '0', '0',   'basecfg:emsfacs:list',         'cfgwrite',   'admin', sysdate(), '', null, '设施配置');
+insert into sys_menu values ('539',  '能流关系',   '124', '3',  'basecfg-flowrel',        'basecfg/flowrel/index',      '', 1, 0, 'C', '0', '0',   'basecfg:flowrel:list',         'cfgwrite',   'admin', sysdate(), '', null, '设备配置');
+insert into sys_menu values ('540',  '用能设备',   '124', '4',  'basecfg-devccfg',        'basecfg/device/index',       '', 1, 0, 'C', '0', '0',   'basecfg:device:list',          'cfgwrite',   'admin', sysdate(), '', null, '设备配置');
+insert into sys_menu values ('541',  '国网电价',   '125', '1',  'basecfg-electricity',    'basecfg/electricity/index',   '', 1, 0, 'C', '0', '0',  'basecfg:electricity:list',     'cfgwrite',   'admin', sysdate(), '', null, '电价属性');
+insert into sys_menu values ('542',  '计量设备',   '125', '2',  'basecfg-meterdevc',      'basecfg/meterdevc/index',     '', 1, 0, 'C', '0', '0',  'basecfg:meterdevc:list',       'cfgwrite',   'admin', sysdate(), '', null, '核算配置');
+insert into sys_menu values ('543',  '碳核算',     '125', '3',  'basecfg-cacfg',          'basecfg/cacfg/index',        '', 1, 0, 'C', '0', '0',   'basecfg:cacfg:list',           'cfgwrite',   'admin', sysdate(), '', null, '碳排因子');
 
 
 -- 用户管理按钮