diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmModuleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmModuleController.java index 08fa3e3..510141c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmModuleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmModuleController.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.UUID; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.system.domain.dto.BaseAlarmModuleDto; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -54,7 +55,7 @@ public class BaseAlarmModuleController extends BaseController public TableDataInfo list(BaseAlarmModule baseAlarmModule) { startPage(); - List list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule); + List list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule); return getDataTable(list); } @@ -67,8 +68,8 @@ public class BaseAlarmModuleController extends BaseController @ResponseBody public AjaxResult export(BaseAlarmModule baseAlarmModule) { - List list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule); - ExcelUtil util = new ExcelUtil(BaseAlarmModule.class); + List list = baseAlarmModuleService.selectBaseAlarmModuleList(baseAlarmModule); + ExcelUtil util = new ExcelUtil(BaseAlarmModuleDto.class); return util.exportExcel(list, "报警信息单元数据"); } diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmModule/add.html b/ruoyi-admin/src/main/resources/templates/base/alarmModule/add.html index f81b0cf..024b55f 100644 --- a/ruoyi-admin/src/main/resources/templates/base/alarmModule/add.html +++ b/ruoyi-admin/src/main/resources/templates/base/alarmModule/add.html @@ -7,17 +7,36 @@
+
-
+ +
+ +
+
+ + +
+
+
+
+ +
+ +
@@ -55,6 +74,38 @@ minView: "month", autoclose: true }); + + /* 选择监控单元树 */ + function selectMonitorTree() { + var deptId = $.common.isEmpty($("#treeId").val()) ? "" : $("#treeId").val(); + var url = ctx + "base/monitorUnitInfo/selectMonitorUnitInfoTree/" + deptId; + var options = { + title: '选择部门', + width: "380", + url: url, + callBack: doSubmit + }; + $.modal.openOptions(options); + } + + function doSubmit(index, layero){ + var tree = layero.find("iframe")[0].contentWindow.$._tree; + var body = $.modal.getChildFrame(index); + $("#treeId").val(body.find('#treeId').val()); + $("#treeName").val(body.find('#treeName').val()); + $.modal.close(index); + } + + $(()=>{ + var cp_keynum = "alarmModule_MonitorUnit"; + var str = localStorage.getItem(cp_keynum); + var num = JSON.parse(str); + if(num != null) { + $("#treeId").val(num.cp_num_value.substring(0, num.cp_num_value.indexOf('/'))); + + $("#treeName").val(num.cp_num_value.substring(num.cp_num_value.indexOf('/')+1,num.cp_num_value.length )); + } + }) \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmModule/alarmModule.html b/ruoyi-admin/src/main/resources/templates/base/alarmModule/alarmModule.html index 75feb70..ab77f6d 100644 --- a/ruoyi-admin/src/main/resources/templates/base/alarmModule/alarmModule.html +++ b/ruoyi-admin/src/main/resources/templates/base/alarmModule/alarmModule.html @@ -2,8 +2,34 @@ + + +
+
+
+
+ 监控单元 +
+
+ + + + +
+
+
+
+
+
+
+ +
@@ -53,14 +79,41 @@
+
+ + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmModule/edit.html b/ruoyi-admin/src/main/resources/templates/base/alarmModule/edit.html index 67deca1..e4f1b75 100644 --- a/ruoyi-admin/src/main/resources/templates/base/alarmModule/edit.html +++ b/ruoyi-admin/src/main/resources/templates/base/alarmModule/edit.html @@ -9,6 +9,7 @@ +
@@ -16,10 +17,22 @@
-
+
- +
+ + +
+
+
+
+ +
+
@@ -57,6 +70,27 @@ minView: "month", autoclose: true }); + + /* 选择监控单元树 */ + function selectMonitorTree() { + var deptId = $.common.isEmpty($("#treeId").val()) ? "" : $("#treeId").val(); + var url = ctx + "base/monitorUnitInfo/selectMonitorUnitInfoTree/" + deptId; + var options = { + title: '选择部门', + width: "380", + url: url, + callBack: doSubmit + }; + $.modal.openOptions(options); + } + + function doSubmit(index, layero){ + var tree = layero.find("iframe")[0].contentWindow.$._tree; + var body = $.modal.getChildFrame(index); + $("#treeId").val(body.find('#treeId').val()); + $("#treeName").val(body.find('#treeName').val()); + $.modal.close(index); + } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmModule.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmModule.java index 0100ba9..3502d32 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmModule.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmModule.java @@ -18,7 +18,7 @@ public class BaseAlarmModule extends BaseEntity private static final long serialVersionUID = 1L; /** 主键标识 */ - private String objId; + private Long objId; /** 单元编号 */ @Excel(name = "单元编号") @@ -57,16 +57,15 @@ public class BaseAlarmModule extends BaseEntity @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") private Date updatedTime; - public void setObjId(String objId) - { - this.objId = objId; + public Long getObjId() { + return objId; } - public String getObjId() - { - return objId; + public void setObjId(Long objId) { + this.objId = objId; } - public void setAlarmmoduleId(String alarmmoduleId) + + public void setAlarmmoduleId(String alarmmoduleId) { this.alarmmoduleId = alarmmoduleId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseAlarmModuleDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseAlarmModuleDto.java new file mode 100644 index 0000000..6aee50a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseAlarmModuleDto.java @@ -0,0 +1,16 @@ +package com.ruoyi.system.domain.dto; + +import com.ruoyi.system.domain.BaseAlarmModule; +import lombok.Data; + +/** + * @author WenJY + * @date 2022年03月26日 17:19 + */ +@Data +public class BaseAlarmModuleDto extends BaseAlarmModule { + + private String monitorunitName; + + private String alarmTypeName; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmModuleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmModuleMapper.java index 396ccfd..cf0a396 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmModuleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmModuleMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.system.mapper; import java.util.List; import com.ruoyi.system.domain.BaseAlarmModule; +import com.ruoyi.system.domain.dto.BaseAlarmModuleDto; /** * 报警信息单元Mapper接口 @@ -25,7 +26,7 @@ public interface BaseAlarmModuleMapper * @param baseAlarmModule 报警信息单元 * @return 报警信息单元集合 */ - public List selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule); + public List selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule); /** * 新增报警信息单元 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmModuleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmModuleService.java index b9b1edd..5d3bfc2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmModuleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmModuleService.java @@ -2,6 +2,7 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.BaseAlarmModule; +import com.ruoyi.system.domain.dto.BaseAlarmModuleDto; /** * 报警信息单元Service接口 @@ -25,7 +26,7 @@ public interface IBaseAlarmModuleService * @param baseAlarmModule 报警信息单元 * @return 报警信息单元集合 */ - public List selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule); + public List selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule); /** * 新增报警信息单元 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmModuleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmModuleServiceImpl.java index e6d74da..862d5ac 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmModuleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmModuleServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.system.service.impl; import java.util.List; + +import com.ruoyi.system.domain.dto.BaseAlarmModuleDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.BaseAlarmModuleMapper; @@ -39,7 +41,7 @@ public class BaseAlarmModuleServiceImpl implements IBaseAlarmModuleService * @return 报警信息单元 */ @Override - public List selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule) + public List selectBaseAlarmModuleList(BaseAlarmModule baseAlarmModule) { return baseAlarmModuleMapper.selectBaseAlarmModuleList(baseAlarmModule); } diff --git a/ruoyi-system/src/main/resources/mapper/system/BaseAlarmModuleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BaseAlarmModuleMapper.xml index b1d3795..b69f42e 100644 --- a/ruoyi-system/src/main/resources/mapper/system/BaseAlarmModuleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/BaseAlarmModuleMapper.xml @@ -1,42 +1,74 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - select ObjId, AlarmModule_Id, AlarmModule_Text, MonitorUnit_Id,AlarmType_Id, Enable_Flag, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME from base_alarm_module + -- select ObjId, AlarmModule_Id, AlarmModule_Text, MonitorUnit_Id,AlarmType_Id, Enable_Flag, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME from base_alarm_module + select t1.ObjId, + t1.AlarmModule_Id, + t1.AlarmModule_Text, + t1.MonitorUnit_Id, + t2.MonitorUnit_Name, + t1.AlarmType_Id, + t3.AlarmType_Name, + t1.Enable_Flag, + t1.CREATED_BY, + t1.CREATED_TIME, + t1.UPDATED_BY, + t1.UPDATED_TIME + from base_alarm_module t1 + left join base_monitorunit_info t2 on t1.MonitorUnit_Id = t2.MonitorUnit_Id + left join base_alarm_type t3 on t1.AlarmType_Id = t3.alarmType_Id + - - - and AlarmModule_Id = #{alarmmoduleId} - and AlarmModule_Text = #{alarmmoduleText} - and MonitorUnit_Id = #{monitorunitId} - and AlarmType_Id = #{alarmTypeId} - and Enable_Flag = #{enableFlag} + + and t1.AlarmModule_Id = #{alarmmoduleId} + and t1.AlarmModule_Text = #{alarmmoduleText} + and t1.MonitorUnit_Id = #{monitorunitId} + and t1.AlarmType_Id = #{alarmTypeId} + and t1.Enable_Flag = #{enableFlag} - - - where ObjId = #{objId} + where t1.ObjId = #{objId} - + insert into base_alarm_module @@ -50,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" CREATED_TIME, UPDATED_BY, UPDATED_TIME, - + #{objId}, #{alarmmoduleId}, @@ -62,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createdTime}, #{updatedBy}, #{updatedTime}, - + @@ -82,11 +114,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from base_alarm_module where ObjId = #{objId} + delete + from base_alarm_module + where ObjId = #{objId} - delete from base_alarm_module where ObjId in + delete from base_alarm_module where ObjId in #{objId}