lv.wenbin 8 сар өмнө
parent
commit
9aa828b838

+ 3 - 2
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AdmOpAlarmController.java

@@ -101,8 +101,9 @@ public class AdmOpAlarmController extends BaseController {
 
     @GetMapping("/alarm/type/index")
     @RequiresPermissions("ems:alarm-info:query")
-    public AjaxResult qryAlarmTypeIndex(@RequestParam("areaCode") String areaCode) {
-        return success(opAlarmService.qryAlarmTypeIndex(areaCode));
+    public AjaxResult qryAlarmTypeIndex(@RequestParam("areaCode") String areaCode,
+        @RequestParam("startRecTime") String startTime, @RequestParam("endRecTime") String endTime) {
+        return success(opAlarmService.qryAlarmTypeIndex(areaCode, startTime, endTime));
     }
 
     @GetMapping("/alarm/type/index/day")

+ 12 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsDeviceRbook.java

@@ -24,6 +24,9 @@ public class EmsDeviceRbook extends BaseEntity
     @Excel(name = "记录编号")
     private String recordCode;
 
+    /** 区域编号 */
+    private String areaCode;
+
     /** 对象类型 1:设施 2:设备 */
     @Excel(name = "对象类型 1:设施 2:设备")
     private Long objType;
@@ -75,6 +78,15 @@ public class EmsDeviceRbook extends BaseEntity
     {
         return recordCode;
     }
+
+    public String getAreaCode() {
+        return areaCode;
+    }
+
+    public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
+    }
+
     public void setObjType(Long objType)
     {
         this.objType = objType;

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AdmOpAlarmMapper.java

@@ -62,7 +62,7 @@ public interface AdmOpAlarmMapper {
      */
     int deleteAdmOpAlarmByIds(Long[] ids);
 
-    List<Map<String, Object>> qryAlarmTypeIndex(String areaCode);
+    List<Map<String, Object>> qryAlarmTypeIndex(@Param("areaCode") String areaCode, @Param("startTime") String startTime, @Param("endTime")String endTime);
 
     List<Map<String, Object>> qryAlarmTypeIndexDay(@Param("alarmDate") String alarmDate,
         @Param("areaCode") String areaCode);

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

@@ -60,7 +60,7 @@ public interface IAdmOpAlarmService {
      */
     int deleteAdmOpAlarmById(Long id);
 
-    List<Map<String, Object>> qryAlarmTypeIndex(String areaCode);
+    List<Map<String, Object>> qryAlarmTypeIndex(String areaCode, String startTime, String endTime);
 
     List<Map<String, Object>> qryAlarmTypeIndexDay(String areaCode);
 

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

@@ -108,8 +108,8 @@ public class AdmOpAlarmServiceImpl implements IAdmOpAlarmService {
     }
 
     @Override
-    public List<Map<String, Object>> qryAlarmTypeIndex(String areaCode) {
-        return admOpAlarmMapper.qryAlarmTypeIndex(areaCode);
+    public List<Map<String, Object>> qryAlarmTypeIndex(String areaCode, String startTime, String endTime) {
+        return admOpAlarmMapper.qryAlarmTypeIndex(areaCode, startTime, endTime);
     }
 
     @Override

+ 45 - 35
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AdmOpAlarmMapper.xml

@@ -41,7 +41,7 @@
     <select id="selectAdmOpAlarmList" parameterType="com.ruoyi.ems.domain.AdmOpAlarm" resultMap="AdmOpAlarmResult">
         <include refid="selectAdmOpAlarmVo"/>
         <where>
-            <if test="areaCode != null  and areaCode != ''">and area_code = #{areaCode}</if>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'">and area_code = #{areaCode}</if>
             <if test="objType != null ">and obj_type = #{objType}</if>
             <if test="objCode != null  and objCode != ''">and obj_code = #{objCode}</if>
             <if test="alarmCode != null  and alarmCode != ''">and alarm_code = #{alarmCode}</if>
@@ -50,6 +50,9 @@
             <if test="alarmMsg != null  and alarmMsg != ''">and alarm_msg like concat('%', #{alarmMsg}, '%')</if>
             <if test="alarmType != null ">and alarm_type = #{alarmType}</if>
             <if test="alarmState != null ">and alarm_state = #{alarmState}</if>
+            <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
+                and alarm_time &gt;= #{startRecTime} and alarm_time &lt;= #{endRecTime}
+            </if>
             <if test="alarmStateList != null and alarmStateList.size() > 0">
                 and alarm_state in
                 <foreach collection="alarmStateList" item="alarmState" open="(" close=")" separator=",">
@@ -131,7 +134,12 @@
         SELECT count(*)   cnt,
                alarm_type alarmType
         FROM adm_op_alarm
-        WHERE area_code = #{areaCode}
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode !='-1'">area_code = #{areaCode}</if>
+            <if test="startTime != null  and startTime != '' and endTime != null and endTime !=''">
+                and alarm_time &gt;= #{startTime} and alarm_time &lt;= #{endTime}
+            </if>
+        </where>
         GROUP BY alarm_type
     </select>
 
@@ -140,12 +148,12 @@
                alarm_type                       alarmType,
                DATE_FORMAT(alarm_time, '%H:00') dateIndex
         FROM adm_op_alarm
-        WHERE area_code = #{areaCode}
-          and alarm_date = #{alarmDate}
-        GROUP BY DATE_FORMAT(alarm_time, '%H:00'),
-                 alarm_type
-        ORDER BY alarm_type,
-                 dateIndex;
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode !='-1'">and area_code = #{areaCode}</if>
+            <if test="alarmDate != null and alarmDate != ''">and alarm_date = #{alarmDate}</if>
+        </where>
+        GROUP BY DATE_FORMAT(alarm_time, '%H:00'), alarm_type
+        ORDER BY alarm_type, dateIndex
     </select>
 
     <select id="qryAlarmTypeIndexMonth" resultType="java.util.Map">
@@ -153,12 +161,12 @@
                alarm_type                             alarmType,
                DATE_FORMAT(alarm_date, '%Y-%m-%d') AS dateIndex
         FROM adm_op_alarm
-        WHERE area_code = #{areaCode}
-          and alarm_date >= #{alarmDate}
-        GROUP BY alarm_type,
-                 alarm_date
-        ORDER BY alarm_type,
-                 dateIndex;
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode !='-1'">and area_code = #{areaCode}</if>
+            <if test="alarmDate != null and alarmDate != ''">and alarm_date &gt;= #{alarmDate}</if>
+        </where>
+        GROUP BY alarm_type, alarm_date
+        ORDER BY alarm_type, dateIndex
     </select>
 
     <select id="qryAlarmTypeIndexYear" resultType="java.util.Map">
@@ -166,12 +174,12 @@
                alarm_type                          alarmType,
                DATE_FORMAT(alarm_date, '%Y-%m') AS dateIndex
         FROM adm_op_alarm
-        WHERE area_code = #{areaCode}
-          and alarm_date >= #{alarmDate}
-        GROUP BY alarm_type,
-                 DATE_FORMAT(alarm_date, '%Y-%m')
-        ORDER BY alarm_type,
-                 dateIndex;
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode !='-1'">and area_code = #{areaCode}</if>
+            <if test="alarmDate != null and alarmDate != ''">and alarm_date &gt;= #{alarmDate}</if>
+        </where>
+        GROUP BY alarm_type, DATE_FORMAT(alarm_date, '%Y-%m')
+        ORDER BY alarm_type, dateIndex
     </select>
 
     <select id="qrySubSysIndexDay" resultType="java.util.Map">
@@ -182,12 +190,12 @@
         FROM adm_op_alarm alarm
                  left join adm_ems_subsystem sub
                            on alarm.system_code = sub.system_code
-        WHERE area_code = #{areaCode}
-          and alarm_date = #{alarmDate}
-        GROUP BY DATE_FORMAT(alarm_time, '%H:00'),
-                 alarm.system_code
-        ORDER BY alarm.system_code,
-                 dateIndex;
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode !='-1'">and area_code = #{areaCode}</if>
+            <if test="alarmDate != null and alarmDate != ''">and alarm_date = #{alarmDate}</if>
+        </where>
+        GROUP BY DATE_FORMAT(alarm_time, '%H:00'), alarm.system_code
+        ORDER BY alarm.system_code, dateIndex
     </select>
 
     <select id="qrySubSysIndexMonth" resultType="java.util.Map">
@@ -198,12 +206,12 @@
         FROM adm_op_alarm alarm
                  left join adm_ems_subsystem sub
                            on alarm.system_code = sub.system_code
-        WHERE area_code = #{areaCode}
-          and alarm_date >= #{alarmDate}
-        GROUP BY alarm.system_code,
-                 alarm_date
-        ORDER BY alarm.system_code,
-                 dateIndex;
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode !='-1'">and area_code = #{areaCode}</if>
+            <if test="alarmDate != null and alarmDate != ''">and alarm_date &gt;= #{alarmDate}</if>
+        </where>
+        GROUP BY alarm.system_code, alarm_date
+        ORDER BY alarm.system_code, dateIndex
     </select>
 
     <select id="qrySubSysIndexYear" resultType="java.util.Map">
@@ -214,11 +222,13 @@
         FROM adm_op_alarm alarm
                  left join adm_ems_subsystem sub
                            on alarm.system_code = sub.system_code
-        WHERE area_code = #{areaCode}
-          and alarm_date >= #{alarmDate}
+        <where>
+            <if test="areaCode != null and areaCode != '' and areaCode !='-1'">and area_code = #{areaCode}</if>
+            <if test="alarmDate != null and alarmDate != ''">and alarm_date &gt;= #{alarmDate}</if>
+        </where>
         GROUP BY alarm.system_code,
                  DATE_FORMAT(alarm_date, '%Y-%m')
         ORDER BY alarm.system_code,
-                 dateIndex;
+                 dateIndex
     </select>
 </mapper>

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

@@ -6,6 +6,7 @@
     <resultMap type="com.ruoyi.ems.domain.EmsDeviceRbook" id="deviceRbookResult">
         <result property="id" column="id"/>
         <result property="recordCode" column="record_code"/>
+        <result property="areaCode" column="area_code"/>
         <result property="objType" column="obj_type"/>
         <result property="objCode" column="obj_code"/>
         <result property="objName" column="obj_name"/>
@@ -17,9 +18,10 @@
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
     </resultMap>
-    <sql id="selectAdmEmsDeviceRbookVo">
+    <sql id="selectDeviceRbookVo">
         select id,
                record_code,
+               area_code,
                obj_type,
                obj_code,
                obj_name,
@@ -33,27 +35,24 @@
         from adm_ems_device_rbook
     </sql>
     <select id="selectDeviceRbookList" parameterType="com.ruoyi.ems.domain.EmsDeviceRbook" resultMap="deviceRbookResult">
-        <include refid="selectAdmEmsDeviceRbookVo"/>
+        <include refid="selectDeviceRbookVo"/>
         <where>
-            <if test="recordCode != null and recordCode != ''"> and record_code = #{recordCode}</if>
             <if test="objType != null "> and obj_type = #{objType}</if>
-            <if test="objCode != null and objCode != ''"> and obj_code = #{objCode}</if>
             <if test="objName != null and objName != ''"> and obj_name like concat('%', #{objName}, '%')</if>
-            <if test="recordTime != null "> and record_time = #{recordTime}</if>
-            <if test="insLocation != null and insLocation != ''"> and ins_location = #{insLocation}</if>
-            <if test="maintainTitle != null and maintainTitle != ''"> and maintain_title = #{maintainTitle}</if>
-            <if test="maintainContent != null and maintainContent != ''"> and maintain_content = #{maintainContent}</if>
-            <if test="maintainPerson != null and maintainPerson != ''"> and maintain_person = #{maintainPerson}</if>
+            <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
+                and record_time &gt;= #{startRecTime} and record_time &lt;= #{endRecTime}
+            </if>
         </where>
     </select>
     <select id="selectDeviceRbookById" parameterType="Long" resultMap="deviceRbookResult">
-        <include refid="selectAdmEmsDeviceRbookVo"/>
+        <include refid="selectDeviceRbookVo"/>
         where id = #{id}
     </select>
     <insert id="insertDeviceRbook" parameterType="com.ruoyi.ems.domain.EmsDeviceRbook" useGeneratedKeys="true" keyProperty="id">
         insert into adm_ems_device_rbook
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="recordCode != null and recordCode != ''">record_code,</if>
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
             <if test="objType != null">obj_type,</if>
             <if test="objCode != null and objCode != ''">obj_code,</if>
             <if test="objName != null">obj_name,</if>
@@ -67,6 +66,7 @@
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="recordCode != null and recordCode != ''">#{recordCode},</if>
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
             <if test="objType != null">#{objType},</if>
             <if test="objCode != null and objCode != ''">#{objCode},</if>
             <if test="objName != null">#{objName},</if>
@@ -83,6 +83,7 @@
         update adm_ems_device_rbook
         <trim prefix="SET" suffixOverrides=",">
             <if test="recordCode != null and recordCode != ''">record_code = #{recordCode},</if>
+            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
             <if test="objType != null">obj_type = #{objType},</if>
             <if test="objCode != null and objCode != ''">obj_code = #{objCode},</if>
             <if test="objName != null">obj_name = #{objName},</if>
@@ -96,7 +97,6 @@
             <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
         where id = #{id}
-        
     </update>
     <delete id="deleteDeviceRbookById" parameterType="Long">
         delete from adm_ems_device_rbook where id = #{id}

+ 13 - 4
ems-cloud/sql/ems_init_data.sql

@@ -63,8 +63,8 @@ INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `s
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001_CW-DKC', '321283124S300106', '0,321283124S3001,321283124S300106', '大客车停车位', '大客车停车位', '大客车停车位', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001_CW-HC', '321283124S300106', '0,321283124S3001,321283124S300106', '货车车位', '货车车位', '货车车位', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001_CW-WXP', '321283124S300106', '0,321283124S3001,321283124S300106', '危险品车位', '危险品车位', '危险品车位', 1, 0);
-INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001_99-ZHLD', '321283124S300199', '0,321283124S3001,321283124S300199', '综合楼顶', '综合楼顶', '综合楼顶', 1, 0);
-INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001_99-CPD', '321283124S300199', '0,321283124S3001,321283124S300199', '车棚顶', '车棚顶', '车棚顶', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001_99-ZHLD', '321283124S300150', '0,321283124S3001,321283124S300199', '综合楼顶', '综合楼顶', '综合楼顶', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3001_99-CPD', '321283124S300150', '0,321283124S3001,321283124S300199', '车棚顶', '车棚顶', '车棚顶', 1, 0);
 
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('N-101', '321283124S300201', '0,321283124S3002,321283124S300201', '开水泡面间', '开水泡面间', '开水泡面', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('N-102', '321283124S300201', '0,321283124S3002,321283124S300201', '超市', '超市', '超市', 1, 0);
@@ -104,8 +104,8 @@ INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `s
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_CW-DKC', '321283124S300206', '0,321283124S3001,321283124S300206', '大客车停车位', '大客车停车位', '大客车停车位', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_CW-HC', '321283124S300206', '0,321283124S3001,321283124S300206', '货车车位', '货车车位', '货车车位', 1, 0);
 INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_CW-WXP', '321283124S300206', '0,321283124S3001,321283124S300206', '危险品车位', '危险品车位', '危险品车位', 1, 0);
-INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_99-ZHLD', '321283124S300299', '0,321283124S3001,321283124S300299', '综合楼顶', '综合楼顶', '综合楼顶', 1, 0);
-INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_99-CPD', '321283124S300299', '0,321283124S3001,321283124S300299', '车棚顶', '车棚顶', '车棚顶', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_99-ZHLD', '321283124S300250', '0,321283124S3001,321283124S300299', '综合楼顶', '综合楼顶', '综合楼顶', 1, 0);
+INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('321283124S3002_99-CPD', '321283124S300250', '0,321283124S3001,321283124S300299', '车棚顶', '车棚顶', '车棚顶', 1, 0);
 
 
 -- 区域属性属性
@@ -716,3 +716,12 @@ INSERT INTO `adm_ems_obj_use_h` (`area_code`, `obj_type`, `obj_code`, `record_ti
 INSERT INTO `adm_ems_device_rbook` (`record_code`, `obj_type`, `obj_code`, `obj_name`, `record_time`, `ins_location`, `maintain_title`, `maintain_content`, `maintain_person`) VALUES ('TZ-20240901001', 1, 'W201', '北区-电网', '2024-09-01 10:32:00', '北区-广场', '北区广场变压器维护', '执行例行维护', '李大航');
 INSERT INTO `adm_ems_device_rbook` (`record_code`, `obj_type`, `obj_code`, `obj_name`, `record_time`, `ins_location`, `maintain_title`, `maintain_content`, `maintain_person`) VALUES ('TZ-20240901002', 2, 'Z010-R101-001', '北区-开水炉', '2024-09-10 17:34:56', '北区/综合楼/一楼开水间', '开水炉除垢', '执行开水炉除垢', '王凯');
 
+-- 告警数据
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3001', 'SYS_GF', 1, 'B-107', '特色小吃', '2024-11-14', '2024-11-14 09:12:23', '00001', '北区光伏告警', 1, 2);
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3001', 'SYS_CN', 1, 'B-101', '开水泡面间', '2024-11-14', '2024-11-14 20:15:23', '00002', '北区开水间配电告警', 1, 3);
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3001', 'SYS_BA', 2, 'Z101', '照明灯', '2024-11-13', '2024-11-13 12:15:21', '00003', '北区照明设施告警', 2, 3);
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3001', 'SYS_BA', 3, 'Z010-R103-001', '空调', '2024-11-12', '2024-11-12 09:17:49', '0004', '北区公共区域空调告警', 2, 2);
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3001', 'SYS_CN', 2, 'E501', '北区-光伏', '2024-11-15', '2024-11-15 15:02:00', 'E003', '未知告警', 2, 2);
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3002', 'SYS_CN', 2, 'E502', '南区-光伏', '2024-11-15', '2024-11-15 15:03:00', 'Ecc01', '未知告警', 3, 3);
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3001', 'SYS_BA', 4, 'D-B-1001', '综合楼配电间(常泰高速服务区(北区))', '2024-11-15', '2024-11-15 09:33:00', 'E0003', '电流阈值告警', 2, 2);
+INSERT INTO `adm_op_alarm` (`area_code`, `system_code`, `obj_type`, `obj_code`, `obj_name`, `alarm_date`, `alarm_time`, `alarm_code`, `alarm_msg`, `alarm_type`, `alarm_state`) VALUES ('321283124S3001', 'SYS_BA', 4, 'D-B-1001', '综合楼配电间(常泰高速服务区(北区))', '2024-11-15', '2024-11-15 15:21:00', 'E003', '配电柜温度告警', 1, 2);

+ 3 - 1
ems-cloud/sql/ems_server.sql

@@ -804,6 +804,7 @@ INSERT INTO `adm_ems_carbon_account_cfg` (`cfg_code`, `definition`, `emission_ac
 drop table if exists adm_op_alarm_policy;
 create table adm_op_alarm_policy  (
   `id`                      bigint(20)      not null auto_increment      comment '序号',
+  `area_code`               varchar(32)     not null                     comment '园区代码',
   `policy_code`             varchar(16)     not null                     comment '策略代码',
   `policy_name`             varchar(32)     not null                     comment '策略名称',
   `alarm_obj_type`          int             not null                     comment '告警对象类型',
@@ -884,7 +885,8 @@ drop table if exists adm_ems_device_rbook;
 create table adm_ems_device_rbook (
   `id`               bigint(20)      not null auto_increment      comment '序号',
   `record_code`      varchar(32)     not null                     comment '记录编号',
-  `obj_type`         int             not null                     comment '对象类型 1:设施 2:设备',
+  `area_code`        varchar(32)     not null                     comment '园区代码',
+  `obj_type`         int             not null                     comment '对象类型 1:区域 2:设施 3:设备',
   `obj_code`         varchar(64)     not null                     comment '对象代码',
   `obj_name`         varchar(64)     default null                 comment '对象名称',
   `record_time`      timestamp       not null                     comment '日期 yyyy-MM-dd HH:mm:ss',