From 623f9c824cf928ed0b05da833b8af29ec38a4335 Mon Sep 17 00:00:00 2001 From: wenjy Date: Mon, 14 Feb 2022 10:08:12 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E4=BC=A0=E6=84=9F=E5=99=A8=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/BaseAlarmInfoController.java | 126 ++++++++++++++ .../base/BaseAlarmTypeController.java | 161 ++++++++++++++++++ .../src/main/resources/application-druid.yml | 14 +- .../templates/base/alarmInfo/add.html | 57 +++++++ .../templates/base/alarmInfo/alarmInfo.html | 135 +++++++++++++++ .../templates/base/alarmInfo/edit.html | 58 +++++++ .../templates/base/alarmType/add.html | 73 ++++++++ .../templates/base/alarmType/alarmType.html | 142 +++++++++++++++ .../templates/base/alarmType/edit.html | 74 ++++++++ .../templates/base/alarmType/tree.html | 49 ++++++ .../ruoyi/system/domain/BaseAlarmInfo.java | 112 ++++++++++++ .../ruoyi/system/domain/BaseAlarmType.java | 84 +++++++++ .../system/mapper/BaseAlarmInfoMapper.java | 61 +++++++ .../system/mapper/BaseAlarmTypeMapper.java | 61 +++++++ .../system/service/IBaseAlarmInfoService.java | 61 +++++++ .../system/service/IBaseAlarmTypeService.java | 69 ++++++++ .../impl/BaseAlarmInfoServiceImpl.java | 97 +++++++++++ .../impl/BaseAlarmTypeServiceImpl.java | 121 +++++++++++++ .../mapper/system/BaseAlarmInfoMapper.xml | 97 +++++++++++ .../mapper/system/BaseAlarmTypeMapper.xml | 96 +++++++++++ 20 files changed, 1742 insertions(+), 6 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmInfoController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java create mode 100644 ruoyi-admin/src/main/resources/templates/base/alarmInfo/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/base/alarmInfo/alarmInfo.html create mode 100644 ruoyi-admin/src/main/resources/templates/base/alarmInfo/edit.html create mode 100644 ruoyi-admin/src/main/resources/templates/base/alarmType/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/base/alarmType/alarmType.html create mode 100644 ruoyi-admin/src/main/resources/templates/base/alarmType/edit.html create mode 100644 ruoyi-admin/src/main/resources/templates/base/alarmType/tree.html create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmInfo.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmType.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmInfoMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmTypeMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmInfoService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmTypeService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmInfoServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmTypeServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/BaseAlarmInfoMapper.xml create mode 100644 ruoyi-system/src/main/resources/mapper/system/BaseAlarmTypeMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmInfoController.java new file mode 100644 index 0000000..e084f21 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmInfoController.java @@ -0,0 +1,126 @@ +package com.ruoyi.web.controller.base; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.BaseAlarmInfo; +import com.ruoyi.system.service.IBaseAlarmInfoService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 传感器报警信息Controller + * + * @author wenjy + * @date 2022-02-14 + */ +@Controller +@RequestMapping("/base/alarmInfo") +public class BaseAlarmInfoController extends BaseController +{ + private String prefix = "base/alarmInfo"; + + @Autowired + private IBaseAlarmInfoService baseAlarmInfoService; + + @RequiresPermissions("base:alarmInfo:view") + @GetMapping() + public String alarmInfo() + { + return prefix + "/alarmInfo"; + } + + /** + * 查询传感器报警信息列表 + */ + @RequiresPermissions("base:alarmInfo:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(BaseAlarmInfo baseAlarmInfo) + { + startPage(); + List list = baseAlarmInfoService.selectBaseAlarmInfoList(baseAlarmInfo); + return getDataTable(list); + } + + /** + * 导出传感器报警信息列表 + */ + @RequiresPermissions("base:alarmInfo:export") + @Log(title = "传感器报警信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(BaseAlarmInfo baseAlarmInfo) + { + List list = baseAlarmInfoService.selectBaseAlarmInfoList(baseAlarmInfo); + ExcelUtil util = new ExcelUtil(BaseAlarmInfo.class); + return util.exportExcel(list, "传感器报警信息数据"); + } + + /** + * 新增传感器报警信息 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存传感器报警信息 + */ + @RequiresPermissions("base:alarmInfo:add") + @Log(title = "传感器报警信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(BaseAlarmInfo baseAlarmInfo) + { + return toAjax(baseAlarmInfoService.insertBaseAlarmInfo(baseAlarmInfo)); + } + + /** + * 修改传感器报警信息 + */ + @GetMapping("/edit/{objId}") + public String edit(@PathVariable("objId") Long objId, ModelMap mmap) + { + BaseAlarmInfo baseAlarmInfo = baseAlarmInfoService.selectBaseAlarmInfoByObjId(objId); + mmap.put("baseAlarmInfo", baseAlarmInfo); + return prefix + "/edit"; + } + + /** + * 修改保存传感器报警信息 + */ + @RequiresPermissions("base:alarmInfo:edit") + @Log(title = "传感器报警信息", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(BaseAlarmInfo baseAlarmInfo) + { + return toAjax(baseAlarmInfoService.updateBaseAlarmInfo(baseAlarmInfo)); + } + + /** + * 删除传感器报警信息 + */ + @RequiresPermissions("base:alarmInfo:remove") + @Log(title = "传感器报警信息", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(baseAlarmInfoService.deleteBaseAlarmInfoByObjIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java new file mode 100644 index 0000000..65fdc98 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java @@ -0,0 +1,161 @@ +package com.ruoyi.web.controller.base; + +import java.util.Date; +import java.util.List; + +import com.ruoyi.common.utils.ShiroUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.BaseAlarmType; +import com.ruoyi.system.service.IBaseAlarmTypeService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.core.domain.Ztree; + +/** + * 传感器报警类型Controller + * + * @author wenjy + * @date 2022-02-14 + */ +@Controller +@RequestMapping("/base/alarmType") +public class BaseAlarmTypeController extends BaseController +{ + private String prefix = "base/alarmType"; + + @Autowired + private IBaseAlarmTypeService baseAlarmTypeService; + + @RequiresPermissions("base:alarmType:view") + @GetMapping() + public String alarmType() + { + return prefix + "/alarmType"; + } + + /** + * 查询传感器报警类型树列表 + */ + @RequiresPermissions("base:alarmType:list") + @PostMapping("/list") + @ResponseBody + public List list(BaseAlarmType baseAlarmType) + { + List list = baseAlarmTypeService.selectBaseAlarmTypeList(baseAlarmType); + return list; + } + + /** + * 导出传感器报警类型列表 + */ + @RequiresPermissions("base:alarmType:export") + @Log(title = "传感器报警类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(BaseAlarmType baseAlarmType) + { + List list = baseAlarmTypeService.selectBaseAlarmTypeList(baseAlarmType); + ExcelUtil util = new ExcelUtil(BaseAlarmType.class); + return util.exportExcel(list, "传感器报警类型数据"); + } + + /** + * 新增传感器报警类型 + */ + @GetMapping(value = { "/add/{objId}", "/add/" }) + public String add(@PathVariable(value = "objId", required = false) Long objId, ModelMap mmap) + { + if (StringUtils.isNotNull(objId)) + { + mmap.put("baseAlarmType", baseAlarmTypeService.selectBaseAlarmTypeByObjId(objId)); + } + return prefix + "/add"; + } + + /** + * 新增保存传感器报警类型 + */ + @RequiresPermissions("base:alarmType:add") + @Log(title = "传感器报警类型", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(BaseAlarmType baseAlarmType) + { + baseAlarmType.setCreateBy(ShiroUtils.getLoginName()); + baseAlarmType.setCreateTime(new Date()); + return toAjax(baseAlarmTypeService.insertBaseAlarmType(baseAlarmType)); + } + + /** + * 修改传感器报警类型 + */ + @GetMapping("/edit/{objId}") + public String edit(@PathVariable("objId") Long objId, ModelMap mmap) + { + BaseAlarmType baseAlarmType = baseAlarmTypeService.selectBaseAlarmTypeByObjId(objId); + mmap.put("baseAlarmType", baseAlarmType); + return prefix + "/edit"; + } + + /** + * 修改保存传感器报警类型 + */ + @RequiresPermissions("base:alarmType:edit") + @Log(title = "传感器报警类型", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(BaseAlarmType baseAlarmType) + { + baseAlarmType.setUpdateBy(ShiroUtils.getLoginName()); + baseAlarmType.setUpdateTime(new Date()); + return toAjax(baseAlarmTypeService.updateBaseAlarmType(baseAlarmType)); + } + + /** + * 删除 + */ + @RequiresPermissions("base:alarmType:remove") + @Log(title = "传感器报警类型", businessType = BusinessType.DELETE) + @GetMapping("/remove/{objId}") + @ResponseBody + public AjaxResult remove(@PathVariable("objId") Long objId) + { + return toAjax(baseAlarmTypeService.deleteBaseAlarmTypeByObjId(objId)); + } + + /** + * 选择传感器报警类型树 + */ + @GetMapping(value = { "/selectAlarmTypeTree/{objId}", "/selectAlarmTypeTree/" }) + public String selectAlarmTypeTree(@PathVariable(value = "objId", required = false) Long objId, ModelMap mmap) + { + if (StringUtils.isNotNull(objId)) + { + mmap.put("baseAlarmType", baseAlarmTypeService.selectBaseAlarmTypeByObjId(objId)); + } + return prefix + "/tree"; + } + + /** + * 加载传感器报警类型树列表 + */ + @GetMapping("/treeData") + @ResponseBody + public List treeData() + { + List ztrees = baseAlarmTypeService.selectBaseAlarmTypeTree(); + return ztrees; + } +} diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 8ecf966..abaf8f6 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,12 +6,12 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://121.36.58.109:3306/jrm-intelligent-iot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: root - password: Haiwei123456 -# url: jdbc:mysql://localhost:3306/jrm-intelligent-iot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:mysql://121.36.58.109:3306/jrm-intelligent-iot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # username: root -# password: root +# password: Haiwei123456 + url: jdbc:mysql://localhost:3306/jrm-intelligent-iot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: root # 从库数据源 slave: # 从数据源开关/默认关闭 @@ -57,4 +57,6 @@ spring: merge-sql: true wall: config: - multi-statement-allow: true \ No newline at end of file + multi-statement-allow: true + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmInfo/add.html b/ruoyi-admin/src/main/resources/templates/base/alarmInfo/add.html new file mode 100644 index 0000000..477bf18 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/alarmInfo/add.html @@ -0,0 +1,57 @@ + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmInfo/alarmInfo.html b/ruoyi-admin/src/main/resources/templates/base/alarmInfo/alarmInfo.html new file mode 100644 index 0000000..980d897 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/alarmInfo/alarmInfo.html @@ -0,0 +1,135 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • + +
  • + + +
  • + +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmInfo/edit.html b/ruoyi-admin/src/main/resources/templates/base/alarmInfo/edit.html new file mode 100644 index 0000000..c7ebfef --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/alarmInfo/edit.html @@ -0,0 +1,58 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmType/add.html b/ruoyi-admin/src/main/resources/templates/base/alarmType/add.html new file mode 100644 index 0000000..2042966 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/alarmType/add.html @@ -0,0 +1,73 @@ + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + + +
+
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmType/alarmType.html b/ruoyi-admin/src/main/resources/templates/base/alarmType/alarmType.html new file mode 100644 index 0000000..0cf1438 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/alarmType/alarmType.html @@ -0,0 +1,142 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • + +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmType/edit.html b/ruoyi-admin/src/main/resources/templates/base/alarmType/edit.html new file mode 100644 index 0000000..89e8b84 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/alarmType/edit.html @@ -0,0 +1,74 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + + +
+
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmType/tree.html b/ruoyi-admin/src/main/resources/templates/base/alarmType/tree.html new file mode 100644 index 0000000..0ac0a72 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/alarmType/tree.html @@ -0,0 +1,49 @@ + + + + + + + + + + +
+ + +
+ +
+ 展开 / + 折叠 +
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmInfo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmInfo.java new file mode 100644 index 0000000..5a7b174 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmInfo.java @@ -0,0 +1,112 @@ +package com.ruoyi.system.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 传感器报警信息对象 base_alarm_info + * + * @author wenjy + * @date 2022-02-14 + */ +public class BaseAlarmInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键标识 */ + private Long objId; + + /** 传感器编号 */ + @Excel(name = "传感器编号") + private String sensorId; + + /** 报警类型编号 */ + @Excel(name = "报警类型编号") + private String alarmtypeId; + + /** 阈值(最大) */ + @Excel(name = "阈值(最大)") + private BigDecimal maxValue; + + /** 阈值(最小) */ + @Excel(name = "阈值(最小)") + private String minValue; + + /** 是否启用 */ + @Excel(name = "是否启用") + private Long enableFlag; + + public void setObjId(Long objId) + { + this.objId = objId; + } + + public Long getObjId() + { + return objId; + } + public void setSensorId(String sensorId) + { + this.sensorId = sensorId; + } + + public String getSensorId() + { + return sensorId; + } + public void setAlarmtypeId(String alarmtypeId) + { + this.alarmtypeId = alarmtypeId; + } + + public String getAlarmtypeId() + { + return alarmtypeId; + } + public void setMaxValue(BigDecimal maxValue) + { + this.maxValue = maxValue; + } + + public BigDecimal getMaxValue() + { + return maxValue; + } + public void setMinValue(String minValue) + { + this.minValue = minValue; + } + + public String getMinValue() + { + return minValue; + } + public void setEnableFlag(Long enableFlag) + { + this.enableFlag = enableFlag; + } + + public Long getEnableFlag() + { + return enableFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("sensorId", getSensorId()) + .append("alarmtypeId", getAlarmtypeId()) + .append("maxValue", getMaxValue()) + .append("minValue", getMinValue()) + .append("enableFlag", getEnableFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmType.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmType.java new file mode 100644 index 0000000..a4ae0b5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseAlarmType.java @@ -0,0 +1,84 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.TreeEntity; + +/** + * 传感器报警类型对象 base_alarm_type + * + * @author wenjy + * @date 2022-02-14 + */ +public class BaseAlarmType extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键标识 */ + private Long objId; + + /** 报警类型编号 */ + @Excel(name = "报警类型编号") + private String alarmtypeId; + + /** 报警类型名称 */ + @Excel(name = "报警类型名称") + private String alarmtypeName; + + /** 是否启用 */ + @Excel(name = "是否启用") + private Long enableFlag; + + public void setObjId(Long objId) + { + this.objId = objId; + } + + public Long getObjId() + { + return objId; + } + public void setAlarmtypeId(String alarmtypeId) + { + this.alarmtypeId = alarmtypeId; + } + + public String getAlarmtypeId() + { + return alarmtypeId; + } + public void setAlarmtypeName(String alarmtypeName) + { + this.alarmtypeName = alarmtypeName; + } + + public String getAlarmtypeName() + { + return alarmtypeName; + } + public void setEnableFlag(Long enableFlag) + { + this.enableFlag = enableFlag; + } + + public Long getEnableFlag() + { + return enableFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("alarmtypeId", getAlarmtypeId()) + .append("alarmtypeName", getAlarmtypeName()) + .append("parentId", getParentId()) + .append("enableFlag", getEnableFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmInfoMapper.java new file mode 100644 index 0000000..cab31ea --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmInfoMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.BaseAlarmInfo; + +/** + * 传感器报警信息Mapper接口 + * + * @author wenjy + * @date 2022-02-14 + */ +public interface BaseAlarmInfoMapper +{ + /** + * 查询传感器报警信息 + * + * @param objId 传感器报警信息主键 + * @return 传感器报警信息 + */ + public BaseAlarmInfo selectBaseAlarmInfoByObjId(Long objId); + + /** + * 查询传感器报警信息列表 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 传感器报警信息集合 + */ + public List selectBaseAlarmInfoList(BaseAlarmInfo baseAlarmInfo); + + /** + * 新增传感器报警信息 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 结果 + */ + public int insertBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo); + + /** + * 修改传感器报警信息 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 结果 + */ + public int updateBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo); + + /** + * 删除传感器报警信息 + * + * @param objId 传感器报警信息主键 + * @return 结果 + */ + public int deleteBaseAlarmInfoByObjId(Long objId); + + /** + * 批量删除传感器报警信息 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseAlarmInfoByObjIds(String[] objIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmTypeMapper.java new file mode 100644 index 0000000..5965a44 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseAlarmTypeMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.BaseAlarmType; + +/** + * 传感器报警类型Mapper接口 + * + * @author wenjy + * @date 2022-02-14 + */ +public interface BaseAlarmTypeMapper +{ + /** + * 查询传感器报警类型 + * + * @param objId 传感器报警类型主键 + * @return 传感器报警类型 + */ + public BaseAlarmType selectBaseAlarmTypeByObjId(Long objId); + + /** + * 查询传感器报警类型列表 + * + * @param baseAlarmType 传感器报警类型 + * @return 传感器报警类型集合 + */ + public List selectBaseAlarmTypeList(BaseAlarmType baseAlarmType); + + /** + * 新增传感器报警类型 + * + * @param baseAlarmType 传感器报警类型 + * @return 结果 + */ + public int insertBaseAlarmType(BaseAlarmType baseAlarmType); + + /** + * 修改传感器报警类型 + * + * @param baseAlarmType 传感器报警类型 + * @return 结果 + */ + public int updateBaseAlarmType(BaseAlarmType baseAlarmType); + + /** + * 删除传感器报警类型 + * + * @param objId 传感器报警类型主键 + * @return 结果 + */ + public int deleteBaseAlarmTypeByObjId(Long objId); + + /** + * 批量删除传感器报警类型 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseAlarmTypeByObjIds(String[] objIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmInfoService.java new file mode 100644 index 0000000..07bc57d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmInfoService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.BaseAlarmInfo; + +/** + * 传感器报警信息Service接口 + * + * @author wenjy + * @date 2022-02-14 + */ +public interface IBaseAlarmInfoService +{ + /** + * 查询传感器报警信息 + * + * @param objId 传感器报警信息主键 + * @return 传感器报警信息 + */ + public BaseAlarmInfo selectBaseAlarmInfoByObjId(Long objId); + + /** + * 查询传感器报警信息列表 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 传感器报警信息集合 + */ + public List selectBaseAlarmInfoList(BaseAlarmInfo baseAlarmInfo); + + /** + * 新增传感器报警信息 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 结果 + */ + public int insertBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo); + + /** + * 修改传感器报警信息 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 结果 + */ + public int updateBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo); + + /** + * 批量删除传感器报警信息 + * + * @param objIds 需要删除的传感器报警信息主键集合 + * @return 结果 + */ + public int deleteBaseAlarmInfoByObjIds(String objIds); + + /** + * 删除传感器报警信息信息 + * + * @param objId 传感器报警信息主键 + * @return 结果 + */ + public int deleteBaseAlarmInfoByObjId(Long objId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmTypeService.java new file mode 100644 index 0000000..76bbc4f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseAlarmTypeService.java @@ -0,0 +1,69 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.BaseAlarmType; +import com.ruoyi.common.core.domain.Ztree; + +/** + * 传感器报警类型Service接口 + * + * @author wenjy + * @date 2022-02-14 + */ +public interface IBaseAlarmTypeService +{ + /** + * 查询传感器报警类型 + * + * @param objId 传感器报警类型主键 + * @return 传感器报警类型 + */ + public BaseAlarmType selectBaseAlarmTypeByObjId(Long objId); + + /** + * 查询传感器报警类型列表 + * + * @param baseAlarmType 传感器报警类型 + * @return 传感器报警类型集合 + */ + public List selectBaseAlarmTypeList(BaseAlarmType baseAlarmType); + + /** + * 新增传感器报警类型 + * + * @param baseAlarmType 传感器报警类型 + * @return 结果 + */ + public int insertBaseAlarmType(BaseAlarmType baseAlarmType); + + /** + * 修改传感器报警类型 + * + * @param baseAlarmType 传感器报警类型 + * @return 结果 + */ + public int updateBaseAlarmType(BaseAlarmType baseAlarmType); + + /** + * 批量删除传感器报警类型 + * + * @param objIds 需要删除的传感器报警类型主键集合 + * @return 结果 + */ + public int deleteBaseAlarmTypeByObjIds(String objIds); + + /** + * 删除传感器报警类型信息 + * + * @param objId 传感器报警类型主键 + * @return 结果 + */ + public int deleteBaseAlarmTypeByObjId(Long objId); + + /** + * 查询传感器报警类型树列表 + * + * @return 所有传感器报警类型信息 + */ + public List selectBaseAlarmTypeTree(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmInfoServiceImpl.java new file mode 100644 index 0000000..f734d1e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmInfoServiceImpl.java @@ -0,0 +1,97 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.BaseAlarmInfoMapper; +import com.ruoyi.system.domain.BaseAlarmInfo; +import com.ruoyi.system.service.IBaseAlarmInfoService; +import com.ruoyi.common.core.text.Convert; + +/** + * 传感器报警信息Service业务层处理 + * + * @author wenjy + * @date 2022-02-14 + */ +@Service +public class BaseAlarmInfoServiceImpl implements IBaseAlarmInfoService +{ + @Autowired + private BaseAlarmInfoMapper baseAlarmInfoMapper; + + /** + * 查询传感器报警信息 + * + * @param objId 传感器报警信息主键 + * @return 传感器报警信息 + */ + @Override + public BaseAlarmInfo selectBaseAlarmInfoByObjId(Long objId) + { + return baseAlarmInfoMapper.selectBaseAlarmInfoByObjId(objId); + } + + /** + * 查询传感器报警信息列表 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 传感器报警信息 + */ + @Override + public List selectBaseAlarmInfoList(BaseAlarmInfo baseAlarmInfo) + { + return baseAlarmInfoMapper.selectBaseAlarmInfoList(baseAlarmInfo); + } + + /** + * 新增传感器报警信息 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 结果 + */ + @Override + public int insertBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo) + { + baseAlarmInfo.setCreateTime(DateUtils.getNowDate()); + return baseAlarmInfoMapper.insertBaseAlarmInfo(baseAlarmInfo); + } + + /** + * 修改传感器报警信息 + * + * @param baseAlarmInfo 传感器报警信息 + * @return 结果 + */ + @Override + public int updateBaseAlarmInfo(BaseAlarmInfo baseAlarmInfo) + { + baseAlarmInfo.setUpdateTime(DateUtils.getNowDate()); + return baseAlarmInfoMapper.updateBaseAlarmInfo(baseAlarmInfo); + } + + /** + * 批量删除传感器报警信息 + * + * @param objIds 需要删除的传感器报警信息主键 + * @return 结果 + */ + @Override + public int deleteBaseAlarmInfoByObjIds(String objIds) + { + return baseAlarmInfoMapper.deleteBaseAlarmInfoByObjIds(Convert.toStrArray(objIds)); + } + + /** + * 删除传感器报警信息信息 + * + * @param objId 传感器报警信息主键 + * @return 结果 + */ + @Override + public int deleteBaseAlarmInfoByObjId(Long objId) + { + return baseAlarmInfoMapper.deleteBaseAlarmInfoByObjId(objId); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmTypeServiceImpl.java new file mode 100644 index 0000000..2bded4a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseAlarmTypeServiceImpl.java @@ -0,0 +1,121 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import java.util.ArrayList; +import com.ruoyi.common.core.domain.Ztree; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.BaseAlarmTypeMapper; +import com.ruoyi.system.domain.BaseAlarmType; +import com.ruoyi.system.service.IBaseAlarmTypeService; +import com.ruoyi.common.core.text.Convert; + +/** + * 传感器报警类型Service业务层处理 + * + * @author wenjy + * @date 2022-02-14 + */ +@Service +public class BaseAlarmTypeServiceImpl implements IBaseAlarmTypeService +{ + @Autowired + private BaseAlarmTypeMapper baseAlarmTypeMapper; + + /** + * 查询传感器报警类型 + * + * @param objId 传感器报警类型主键 + * @return 传感器报警类型 + */ + @Override + public BaseAlarmType selectBaseAlarmTypeByObjId(Long objId) + { + return baseAlarmTypeMapper.selectBaseAlarmTypeByObjId(objId); + } + + /** + * 查询传感器报警类型列表 + * + * @param baseAlarmType 传感器报警类型 + * @return 传感器报警类型 + */ + @Override + public List selectBaseAlarmTypeList(BaseAlarmType baseAlarmType) + { + return baseAlarmTypeMapper.selectBaseAlarmTypeList(baseAlarmType); + } + + /** + * 新增传感器报警类型 + * + * @param baseAlarmType 传感器报警类型 + * @return 结果 + */ + @Override + public int insertBaseAlarmType(BaseAlarmType baseAlarmType) + { + baseAlarmType.setCreateTime(DateUtils.getNowDate()); + return baseAlarmTypeMapper.insertBaseAlarmType(baseAlarmType); + } + + /** + * 修改传感器报警类型 + * + * @param baseAlarmType 传感器报警类型 + * @return 结果 + */ + @Override + public int updateBaseAlarmType(BaseAlarmType baseAlarmType) + { + baseAlarmType.setUpdateTime(DateUtils.getNowDate()); + return baseAlarmTypeMapper.updateBaseAlarmType(baseAlarmType); + } + + /** + * 批量删除传感器报警类型 + * + * @param objIds 需要删除的传感器报警类型主键 + * @return 结果 + */ + @Override + public int deleteBaseAlarmTypeByObjIds(String objIds) + { + return baseAlarmTypeMapper.deleteBaseAlarmTypeByObjIds(Convert.toStrArray(objIds)); + } + + /** + * 删除传感器报警类型信息 + * + * @param objId 传感器报警类型主键 + * @return 结果 + */ + @Override + public int deleteBaseAlarmTypeByObjId(Long objId) + { + return baseAlarmTypeMapper.deleteBaseAlarmTypeByObjId(objId); + } + + /** + * 查询传感器报警类型树列表 + * + * @return 所有传感器报警类型信息 + */ + @Override + public List selectBaseAlarmTypeTree() + { + List baseAlarmTypeList = baseAlarmTypeMapper.selectBaseAlarmTypeList(new BaseAlarmType()); + List ztrees = new ArrayList(); + for (BaseAlarmType baseAlarmType : baseAlarmTypeList) + { + Ztree ztree = new Ztree(); + ztree.setId(baseAlarmType.getAlarmtypeId()); + ztree.setpId(baseAlarmType.getParentId()); + ztree.setName(baseAlarmType.getAlarmtypeName()); + ztree.setTitle(baseAlarmType.getAlarmtypeName()); + ztrees.add(ztree); + } + return ztrees; + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/BaseAlarmInfoMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BaseAlarmInfoMapper.xml new file mode 100644 index 0000000..4fb7f44 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/BaseAlarmInfoMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + select ObjId, Sensor_Id, AlarmType_Id, Max_Value, Min_Value, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_alarm_info + + + + + + + + insert into base_alarm_info + + Sensor_Id, + AlarmType_Id, + Max_Value, + Min_Value, + Enable_Flag, + Create_By, + Create_Time, + Update_By, + Update_Time, + + + #{sensorId}, + #{alarmtypeId}, + #{maxValue}, + #{minValue}, + #{enableFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update base_alarm_info + + Sensor_Id = #{sensorId}, + AlarmType_Id = #{alarmtypeId}, + Max_Value = #{maxValue}, + Min_Value = #{minValue}, + Enable_Flag = #{enableFlag}, + Create_By = #{createBy}, + Create_Time = #{createTime}, + Update_By = #{updateBy}, + Update_Time = #{updateTime}, + + where ObjId = #{objId} + + + + delete from base_alarm_info where ObjId = #{objId} + + + + delete from base_alarm_info where ObjId in + + #{objId} + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/BaseAlarmTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BaseAlarmTypeMapper.xml new file mode 100644 index 0000000..8486936 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/BaseAlarmTypeMapper.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + select ObjId, alarmType_Id, alarmType_Name, parent_Id, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_alarm_type + + + + + + + + insert into base_alarm_type + + alarmType_Id, + alarmType_Name, + parent_Id, + Enable_Flag, + Create_By, + Create_Time, + Update_By, + Update_Time, + + + #{alarmtypeId}, + #{alarmtypeName}, + #{parentId}, + #{enableFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update base_alarm_type + + alarmType_Id = #{alarmtypeId}, + alarmType_Name = #{alarmtypeName}, + parent_Id = #{parentId}, + Enable_Flag = #{enableFlag}, + Create_By = #{createBy}, + Create_Time = #{createTime}, + Update_By = #{updateBy}, + Update_Time = #{updateTime}, + + where ObjId = #{objId} + + + + delete from base_alarm_type where ObjId = #{objId} + + + + delete from base_alarm_type where ObjId in + + #{objId} + + + + \ No newline at end of file