diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseDeviceParamController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseDeviceParamController.java new file mode 100644 index 0000000..1608ad9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseDeviceParamController.java @@ -0,0 +1,136 @@ +package com.ruoyi.web.controller.base; + +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +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.BaseDeviceParam; +import com.ruoyi.system.service.IBaseDeviceParamService; +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-03-24 + */ +@Controller +@RequestMapping("/base/deviceParam") +public class BaseDeviceParamController extends BaseController +{ + private String prefix = "base/deviceParam"; + + @Autowired + private IBaseDeviceParamService baseDeviceParamService; + + @RequiresPermissions("base:deviceParam:view") + @GetMapping() + public String deviceParam() + { + return prefix + "/deviceParam"; + } + + /** + * 查询设备参数列表 + */ + @RequiresPermissions("base:deviceParam:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(BaseDeviceParam baseDeviceParam) + { + startPage(); + List list = baseDeviceParamService.selectBaseDeviceParamList(baseDeviceParam); + return getDataTable(list); + } + + + @PostMapping("/getParams") + @ResponseBody + public String getDeviceParams(String deviceId) { + List baseDeviceParams = baseDeviceParamService.selectBaseDeviceParamList(new BaseDeviceParam(deviceId, 0L)); + return JSONArray.toJSONString(baseDeviceParams); + } + + /** + * 导出设备参数列表 + */ + @RequiresPermissions("base:deviceParam:export") + @Log(title = "设备参数", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(BaseDeviceParam baseDeviceParam) + { + List list = baseDeviceParamService.selectBaseDeviceParamList(baseDeviceParam); + ExcelUtil util = new ExcelUtil(BaseDeviceParam.class); + return util.exportExcel(list, "设备参数数据"); + } + + /** + * 新增设备参数 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存设备参数 + */ + @RequiresPermissions("base:deviceParam:add") + @Log(title = "设备参数", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(BaseDeviceParam baseDeviceParam) + { + return toAjax(baseDeviceParamService.insertBaseDeviceParam(baseDeviceParam)); + } + + /** + * 修改设备参数 + */ + @GetMapping("/edit/{ObjId}") + public String edit(@PathVariable("ObjId") Long ObjId, ModelMap mmap) + { + BaseDeviceParam baseDeviceParam = baseDeviceParamService.selectBaseDeviceParamByObjId(ObjId); + mmap.put("baseDeviceParam", baseDeviceParam); + return prefix + "/edit"; + } + + /** + * 修改保存设备参数 + */ + @RequiresPermissions("base:deviceParam:edit") + @Log(title = "设备参数", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(BaseDeviceParam baseDeviceParam) + { + return toAjax(baseDeviceParamService.updateBaseDeviceParam(baseDeviceParam)); + } + + /** + * 删除设备参数 + */ + @RequiresPermissions("base:deviceParam:remove") + @Log(title = "设备参数", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(baseDeviceParamService.deleteBaseDeviceParamByObjIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java index 1761c36..82049bc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitInfoController.java @@ -5,7 +5,12 @@ import java.util.List; import java.util.UUID; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.system.domain.BaseAlarmInfo; +import com.ruoyi.system.domain.BaseDeviceParam; +import com.ruoyi.system.domain.dto.BaseAlarmInfoDto; import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto; +import com.ruoyi.system.domain.dto.BaseSensorInfoDto; +import com.ruoyi.system.service.IBaseDeviceParamService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -28,172 +33,200 @@ import org.springframework.web.multipart.MultipartFile; /** * 监控单元信息Controller - * + * * @author wenjy * @date 2022-01-27 */ @Controller @RequestMapping("/base/monitorUnitInfo") -public class BaseMonitorunitInfoController extends BaseController -{ - private String prefix = "base/monitorUnitInfo"; - - @Autowired - private IBaseMonitorunitInfoService baseMonitorunitInfoService; - - @RequiresPermissions("base:monitorUnitInfo:view") - @GetMapping() - public String monitorUnitInfo() - { - return prefix + "/monitorUnitInfo"; +public class BaseMonitorunitInfoController extends BaseController { + private String prefix = "base/monitorUnitInfo"; + + @Autowired private IBaseMonitorunitInfoService baseMonitorunitInfoService; + + @Autowired private IBaseDeviceParamService baseDeviceParamService; + + @RequiresPermissions("base:monitorUnitInfo:view") + @GetMapping() + public String monitorUnitInfo() { + return prefix + "/monitorUnitInfo"; + } + + /** 查询监控单元信息树列表 */ + @RequiresPermissions("base:monitorUnitInfo:list") + @PostMapping("/list") + @ResponseBody + public List list(BaseMonitorunitInfo baseMonitorunitInfo) { + List list = + baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); + return list; + } + + /** + * 获取导入模板 + * + * @author WenJY + * @date 2022/2/7 9:57 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @RequiresPermissions("base:monitorUnitInfo:importTemplate") + @GetMapping("/importTemplate") + @ResponseBody + public AjaxResult importTemplate() { + ExcelUtil util = + new ExcelUtil(BaseMonitorunitInfo.class); + return util.importTemplateExcel("监控单元信息"); + } + + /** + * 导入监控单元信息 + * + * @author WenJY + * @date 2022/2/7 9:58 + * @param file + * @param updateSupport + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @RequiresPermissions("base:monitorUnitInfo:importData") + @PostMapping("/importData") + @ResponseBody + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = + new ExcelUtil(BaseMonitorunitInfo.class); + // 读取file文件将文件内容转为list集合 + List baseMonitorunitInfoList = util.importExcel(file.getInputStream()); + String message = baseMonitorunitInfoService.importMould(baseMonitorunitInfoList, updateSupport); + return AjaxResult.success(message); + } + + /** 导出监控单元信息列表 */ + @RequiresPermissions("base:monitorUnitInfo:export") + @Log(title = "监控单元信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(BaseMonitorunitInfo baseMonitorunitInfo) { + List list = + baseMonitorunitInfoService.selectBaseMonitorunitInfoList(baseMonitorunitInfo); + ExcelUtil util = + new ExcelUtil(BaseMonitorunitInfo.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( + "baseMonitorunitInfo", + baseMonitorunitInfoService.selectBaseMonitorunitInfoByObjId(ObjId)); } - - /** - * 查询监控单元信息树列表 - */ - @RequiresPermissions("base:monitorUnitInfo:list") - @PostMapping("/list") - @ResponseBody - public List list(BaseMonitorunitInfo baseMonitorunitInfo) - { - List list = baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); - return list; - } - - /** - * 获取导入模板 - * @author WenJY - * @date 2022/2/7 9:57 - * @return com.ruoyi.common.core.domain.AjaxResult - */ - @RequiresPermissions("base:monitorUnitInfo:importTemplate") - @GetMapping("/importTemplate") - @ResponseBody - public AjaxResult importTemplate() { - ExcelUtil util = new ExcelUtil(BaseMonitorunitInfo.class); - return util.importTemplateExcel("监控单元信息"); - } - - /** - * 导入监控单元信息 - * @author WenJY - * @date 2022/2/7 9:58 - * @param file - * @param updateSupport - * @return com.ruoyi.common.core.domain.AjaxResult - */ - @RequiresPermissions("base:monitorUnitInfo:importData") - @PostMapping("/importData") - @ResponseBody - public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { - ExcelUtil util = new ExcelUtil(BaseMonitorunitInfo.class); - //读取file文件将文件内容转为list集合 - List baseMonitorunitInfoList = util.importExcel(file.getInputStream()); - String message = baseMonitorunitInfoService.importMould(baseMonitorunitInfoList,updateSupport); - return AjaxResult.success(message); - } - - /** - * 导出监控单元信息列表 - */ - @RequiresPermissions("base:monitorUnitInfo:export") - @Log(title = "监控单元信息", businessType = BusinessType.EXPORT) - @PostMapping("/export") - @ResponseBody - public AjaxResult export(BaseMonitorunitInfo baseMonitorunitInfo) - { - List list = baseMonitorunitInfoService.selectBaseMonitorunitInfoList(baseMonitorunitInfo); - ExcelUtil util = new ExcelUtil(BaseMonitorunitInfo.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("baseMonitorunitInfo", baseMonitorunitInfoService.selectBaseMonitorunitInfoByObjId(ObjId)); - } - return prefix + "/add"; - } - - /** - * 新增保存监控单元信息 - */ - @RequiresPermissions("base:monitorUnitInfo:add") - @Log(title = "监控单元信息", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(BaseMonitorunitInfo baseMonitorunitInfo) - { - baseMonitorunitInfo.setMonitorunitId(UUID.randomUUID().toString()); - baseMonitorunitInfo.setCreateBy(ShiroUtils.getLoginName()); - baseMonitorunitInfo.setCreateTime(new Date()); - return toAjax(baseMonitorunitInfoService.insertBaseMonitorunitInfo(baseMonitorunitInfo)); - } - - /** - * 修改监控单元信息 - */ - @GetMapping("/edit/{ObjId}") - public String edit(@PathVariable("ObjId") Long ObjId, ModelMap mmap) - { - BaseMonitorunitInfo baseMonitorunitInfo = baseMonitorunitInfoService.selectBaseMonitorunitInfoByObjId(ObjId); - mmap.put("baseMonitorunitInfo", baseMonitorunitInfo); - return prefix + "/edit"; - } - - /** - * 修改保存监控单元信息 - */ - @RequiresPermissions("base:monitorUnitInfo:edit") - @Log(title = "监控单元信息", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(BaseMonitorunitInfo baseMonitorunitInfo) - { - baseMonitorunitInfo.setUpdateBy(ShiroUtils.getLoginName()); - baseMonitorunitInfo.setUpdateTime(new Date()); - return toAjax(baseMonitorunitInfoService.updateBaseMonitorunitInfo(baseMonitorunitInfo)); + return prefix + "/add"; + } + + /** 新增保存监控单元信息 */ + @RequiresPermissions("base:monitorUnitInfo:add") + @Log(title = "监控单元信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(BaseMonitorunitInfo baseMonitorunitInfo) { + baseMonitorunitInfo.setMonitorunitId(UUID.randomUUID().toString()); + baseMonitorunitInfo.setCreateBy(ShiroUtils.getLoginName()); + baseMonitorunitInfo.setCreateTime(new Date()); + return toAjax(baseMonitorunitInfoService.insertBaseMonitorunitInfo(baseMonitorunitInfo)); + } + + /** 修改监控单元信息 */ + @GetMapping("/edit/{ObjId}") + public String edit(@PathVariable("ObjId") Long ObjId, ModelMap mmap) { + BaseMonitorunitInfo baseMonitorunitInfo = + baseMonitorunitInfoService.selectBaseMonitorunitInfoByObjId(ObjId); + mmap.put("baseMonitorunitInfo", baseMonitorunitInfo); + return prefix + "/edit"; + } + + /** 修改保存监控单元信息 */ + @RequiresPermissions("base:monitorUnitInfo:edit") + @Log(title = "监控单元信息", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(BaseMonitorunitInfo baseMonitorunitInfo) { + baseMonitorunitInfo.setUpdateBy(ShiroUtils.getLoginName()); + baseMonitorunitInfo.setUpdateTime(new Date()); + return toAjax(baseMonitorunitInfoService.updateBaseMonitorunitInfo(baseMonitorunitInfo)); + } + + /** 设置设备参数 */ + @GetMapping("/set/{objId}") + public String set(@PathVariable("objId") Long objId, ModelMap mmap) { + BaseMonitorunitInfo baseMonitorunitInfo = + baseMonitorunitInfoService.selectBaseMonitorunitInfoByObjId(objId); + mmap.put("baseMonitorunitInfo", baseMonitorunitInfo); + mmap.put( + "baseDeviceParams", + baseDeviceParamService.selectBaseDeviceParamList( + new BaseDeviceParam(baseMonitorunitInfo.getMonitorunitId(), 0L))); + return prefix + "/setDeviceParam"; + } + + /** 保存传感器阈值 */ + @RequiresPermissions("base:monitorUnitInfo:set") + @PostMapping("/set") + @ResponseBody + public AjaxResult setSave(BaseMonitorunitInfoDto baseMonitorunitInfoDto) { + try { + + BaseDeviceParam[] deviceParams = baseMonitorunitInfoDto.getDeviceParams(); + List baseDeviceParams = + baseDeviceParamService.selectBaseDeviceParamList( + new BaseDeviceParam(baseMonitorunitInfoDto.getMonitorunitId(), 0L)); + if (baseDeviceParams.size() > 0) { + baseDeviceParams.forEach( + x -> { + baseDeviceParamService.deleteBaseDeviceParamByObjId(x.getObjId()); + }); + } + for (BaseDeviceParam deviceParam : deviceParams) { + deviceParam.setDeviceId(baseMonitorunitInfoDto.getMonitorunitId()); + deviceParam.setCreateBy(ShiroUtils.getLoginName()); + deviceParam.setCreateTime(new Date()); + deviceParam.setEnableFlag(baseMonitorunitInfoDto.getEnableFlag()); + baseDeviceParamService.insertBaseDeviceParam(deviceParam); + } + return AjaxResult.success(); + } catch (Exception ex) { + return AjaxResult.error(ex.getMessage()); } - - /** - * 删除 - */ - @RequiresPermissions("base:monitorUnitInfo:remove") - @Log(title = "监控单元信息", businessType = BusinessType.DELETE) - @GetMapping("/remove/{ObjId}") - @ResponseBody - public AjaxResult remove(@PathVariable("ObjId") Long ObjId) - { - return toAjax(baseMonitorunitInfoService.deleteBaseMonitorunitInfoByObjId(ObjId)); - } - - /** - * 选择监控单元信息树 - */ - @GetMapping(value = { "/selectMonitorUnitInfoTree/{ObjId}", "/selectMonitorUnitInfoTree/" }) - public String selectMonitorUnitInfoTree(@PathVariable(value = "ObjId", required = false) String ObjId, ModelMap mmap) - { - if (StringUtils.isNotNull(ObjId)) - { - /*mmap.put("baseMonitorunitInfo", baseMonitorunitInfoService.selectBaseMonitorunitInfoByObjId(ObjId));*/ - mmap.put("baseMonitorunitInfo",baseMonitorunitInfoService.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo(ObjId)).get(0)); - } - return prefix + "/tree"; - } - - /** - * 加载监控单元信息树列表 - */ - @GetMapping("/treeData") - @ResponseBody - public List treeData() - { - List ztrees = baseMonitorunitInfoService.selectBaseMonitorunitInfoTree(); - return ztrees; + } + + /** 删除 */ + @RequiresPermissions("base:monitorUnitInfo:remove") + @Log(title = "监控单元信息", businessType = BusinessType.DELETE) + @GetMapping("/remove/{ObjId}") + @ResponseBody + public AjaxResult remove(@PathVariable("ObjId") Long ObjId) { + return toAjax(baseMonitorunitInfoService.deleteBaseMonitorunitInfoByObjId(ObjId)); + } + + /** 选择监控单元信息树 */ + @GetMapping(value = {"/selectMonitorUnitInfoTree/{ObjId}", "/selectMonitorUnitInfoTree/"}) + public String selectMonitorUnitInfoTree( + @PathVariable(value = "ObjId", required = false) String ObjId, ModelMap mmap) { + if (StringUtils.isNotNull(ObjId)) { + /*mmap.put("baseMonitorunitInfo", baseMonitorunitInfoService.selectBaseMonitorunitInfoByObjId(ObjId));*/ + mmap.put( + "baseMonitorunitInfo", + baseMonitorunitInfoService + .selectBaseMonitorunitInfoList(new BaseMonitorunitInfo(ObjId)) + .get(0)); } + return prefix + "/tree"; + } + + /** 加载监控单元信息树列表 */ + @GetMapping("/treeData") + @ResponseBody + public List treeData() { + List ztrees = baseMonitorunitInfoService.selectBaseMonitorunitInfoTree(); + return ztrees; + } } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index ed3ae52..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: # 从数据源开关/默认关闭 diff --git a/ruoyi-admin/src/main/resources/templates/base/deviceParam/add.html b/ruoyi-admin/src/main/resources/templates/base/deviceParam/add.html new file mode 100644 index 0000000..0779535 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/deviceParam/add.html @@ -0,0 +1,51 @@ + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/deviceParam/deviceParam.html b/ruoyi-admin/src/main/resources/templates/base/deviceParam/deviceParam.html new file mode 100644 index 0000000..b11d525 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/deviceParam/deviceParam.html @@ -0,0 +1,133 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/deviceParam/edit.html b/ruoyi-admin/src/main/resources/templates/base/deviceParam/edit.html new file mode 100644 index 0000000..1dbf843 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/deviceParam/edit.html @@ -0,0 +1,52 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/monitorUnitInfo/monitorUnitInfo.html b/ruoyi-admin/src/main/resources/templates/base/monitorUnitInfo/monitorUnitInfo.html index a1eded8..b8c6f95 100644 --- a/ruoyi-admin/src/main/resources/templates/base/monitorUnitInfo/monitorUnitInfo.html +++ b/ruoyi-admin/src/main/resources/templates/base/monitorUnitInfo/monitorUnitInfo.html @@ -104,6 +104,7 @@ exportUrl: prefix + "/export", importUrl: prefix + "/importData", importTemplateUrl: prefix + "/importTemplate", + setParamUrl: prefix + "/set/{id}", modalName: "监控单元信息", columns: [{ field: 'selectItem', @@ -176,6 +177,7 @@ align: 'left', formatter: function (value, row, index) { var actions = []; + actions.push('设备参数 '); actions.push('编辑 '); actions.push('新增 '); actions.push('删除'); diff --git a/ruoyi-admin/src/main/resources/templates/base/monitorUnitInfo/setDeviceParam.html b/ruoyi-admin/src/main/resources/templates/base/monitorUnitInfo/setDeviceParam.html new file mode 100644 index 0000000..b8ea2e3 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/base/monitorUnitInfo/setDeviceParam.html @@ -0,0 +1,124 @@ + + + + + + + + + +
+
+ + +
+ +
+ +
+
+
+ +
+ + +
+
+ +

设备参数

+
+
+ + +
+
+
+
+
+ +
+
+ + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseDeviceParam.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseDeviceParam.java new file mode 100644 index 0000000..ad43893 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseDeviceParam.java @@ -0,0 +1,105 @@ +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.BaseEntity; + +/** + * 设备参数对象 base_device_param + * + * @author WenJY + * @date 2022-03-24 + */ +public class BaseDeviceParam extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + public BaseDeviceParam() { + } + + public BaseDeviceParam(String deviceId, Long enableFlag) { + this.deviceId = deviceId; + this.enableFlag = enableFlag; + } + + /** 主键标识 */ + private Long ObjId; + + /** 设备标识 */ + @Excel(name = "设备标识") + private String deviceId; + + /** 参数标题 */ + @Excel(name = "参数标题") + private String paramTitle; + + /** 参数值 */ + @Excel(name = "参数值") + private String paramValue; + + /** 是否启用 */ + @Excel(name = "是否启用") + private Long enableFlag; + + public void setObjId(Long ObjId) + { + this.ObjId = ObjId; + } + + public Long getObjId() + { + return ObjId; + } + public void setDeviceId(String deviceId) + { + this.deviceId = deviceId; + } + + public String getDeviceId() + { + return deviceId; + } + public void setParamTitle(String paramTitle) + { + this.paramTitle = paramTitle; + } + + public String getParamTitle() + { + return paramTitle; + } + public void setParamValue(String paramValue) + { + this.paramValue = paramValue; + } + + public String getParamValue() + { + return paramValue; + } + 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("deviceId", getDeviceId()) + .append("paramTitle", getParamTitle()) + .append("paramValue", getParamValue()) + .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/dto/BaseMonitorunitInfoDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseMonitorunitInfoDto.java index a0e4bcd..882e190 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseMonitorunitInfoDto.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BaseMonitorunitInfoDto.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain.dto; +import com.ruoyi.system.domain.BaseDeviceParam; import com.ruoyi.system.domain.BaseMonitorunitInfo; import lombok.Data; @@ -21,4 +22,6 @@ public class BaseMonitorunitInfoDto extends BaseMonitorunitInfo { private int value; private String unitUrl; + + private BaseDeviceParam[] deviceParams; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseDeviceParamMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseDeviceParamMapper.java new file mode 100644 index 0000000..9ae045f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BaseDeviceParamMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.BaseDeviceParam; + +/** + * 设备参数Mapper接口 + * + * @author WenJY + * @date 2022-03-24 + */ +public interface BaseDeviceParamMapper +{ + /** + * 查询设备参数 + * + * @param ObjId 设备参数主键 + * @return 设备参数 + */ + public BaseDeviceParam selectBaseDeviceParamByObjId(Long ObjId); + + /** + * 查询设备参数列表 + * + * @param baseDeviceParam 设备参数 + * @return 设备参数集合 + */ + public List selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam); + + /** + * 新增设备参数 + * + * @param baseDeviceParam 设备参数 + * @return 结果 + */ + public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam); + + /** + * 修改设备参数 + * + * @param baseDeviceParam 设备参数 + * @return 结果 + */ + public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam); + + /** + * 删除设备参数 + * + * @param ObjId 设备参数主键 + * @return 结果 + */ + public int deleteBaseDeviceParamByObjId(Long ObjId); + + /** + * 批量删除设备参数 + * + * @param ObjIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBaseDeviceParamByObjIds(String[] ObjIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseDeviceParamService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseDeviceParamService.java new file mode 100644 index 0000000..c977237 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBaseDeviceParamService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.BaseDeviceParam; + +/** + * 设备参数Service接口 + * + * @author WenJY + * @date 2022-03-24 + */ +public interface IBaseDeviceParamService +{ + /** + * 查询设备参数 + * + * @param ObjId 设备参数主键 + * @return 设备参数 + */ + public BaseDeviceParam selectBaseDeviceParamByObjId(Long ObjId); + + /** + * 查询设备参数列表 + * + * @param baseDeviceParam 设备参数 + * @return 设备参数集合 + */ + public List selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam); + + /** + * 新增设备参数 + * + * @param baseDeviceParam 设备参数 + * @return 结果 + */ + public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam); + + /** + * 修改设备参数 + * + * @param baseDeviceParam 设备参数 + * @return 结果 + */ + public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam); + + /** + * 批量删除设备参数 + * + * @param ObjIds 需要删除的设备参数主键集合 + * @return 结果 + */ + public int deleteBaseDeviceParamByObjIds(String ObjIds); + + /** + * 删除设备参数信息 + * + * @param ObjId 设备参数主键 + * @return 结果 + */ + public int deleteBaseDeviceParamByObjId(Long ObjId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseDeviceParamServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseDeviceParamServiceImpl.java new file mode 100644 index 0000000..bf78046 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseDeviceParamServiceImpl.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.BaseDeviceParamMapper; +import com.ruoyi.system.domain.BaseDeviceParam; +import com.ruoyi.system.service.IBaseDeviceParamService; +import com.ruoyi.common.core.text.Convert; + +/** + * 设备参数Service业务层处理 + * + * @author WenJY + * @date 2022-03-24 + */ +@Service +public class BaseDeviceParamServiceImpl implements IBaseDeviceParamService +{ + @Autowired + private BaseDeviceParamMapper baseDeviceParamMapper; + + /** + * 查询设备参数 + * + * @param ObjId 设备参数主键 + * @return 设备参数 + */ + @Override + public BaseDeviceParam selectBaseDeviceParamByObjId(Long ObjId) + { + return baseDeviceParamMapper.selectBaseDeviceParamByObjId(ObjId); + } + + /** + * 查询设备参数列表 + * + * @param baseDeviceParam 设备参数 + * @return 设备参数 + */ + @Override + public List selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam) + { + return baseDeviceParamMapper.selectBaseDeviceParamList(baseDeviceParam); + } + + /** + * 新增设备参数 + * + * @param baseDeviceParam 设备参数 + * @return 结果 + */ + @Override + public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam) + { + baseDeviceParam.setCreateTime(DateUtils.getNowDate()); + return baseDeviceParamMapper.insertBaseDeviceParam(baseDeviceParam); + } + + /** + * 修改设备参数 + * + * @param baseDeviceParam 设备参数 + * @return 结果 + */ + @Override + public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam) + { + baseDeviceParam.setUpdateTime(DateUtils.getNowDate()); + return baseDeviceParamMapper.updateBaseDeviceParam(baseDeviceParam); + } + + /** + * 批量删除设备参数 + * + * @param ObjIds 需要删除的设备参数主键 + * @return 结果 + */ + @Override + public int deleteBaseDeviceParamByObjIds(String ObjIds) + { + return baseDeviceParamMapper.deleteBaseDeviceParamByObjIds(Convert.toStrArray(ObjIds)); + } + + /** + * 删除设备参数信息 + * + * @param ObjId 设备参数主键 + * @return 结果 + */ + @Override + public int deleteBaseDeviceParamByObjId(Long ObjId) + { + return baseDeviceParamMapper.deleteBaseDeviceParamByObjId(ObjId); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/BaseDeviceParamMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BaseDeviceParamMapper.xml new file mode 100644 index 0000000..4cd1471 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/BaseDeviceParamMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + select ObjId, Device_Id, Param_Title, Param_Value, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_device_param + + + + + + + + insert into base_device_param + + Device_Id, + Param_Title, + Param_Value, + Enable_Flag, + Create_By, + Create_Time, + Update_By, + Update_Time, + + + #{deviceId}, + #{paramTitle}, + #{paramValue}, + #{enableFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update base_device_param + + Device_Id = #{deviceId}, + Param_Title = #{paramTitle}, + Param_Value = #{paramValue}, + Enable_Flag = #{enableFlag}, + Create_By = #{createBy}, + Create_Time = #{createTime}, + Update_By = #{updateBy}, + Update_Time = #{updateTime}, + + where ObjId = #{ObjId} + + + + delete from base_device_param where ObjId = #{ObjId} + + + + delete from base_device_param where ObjId in + + #{ObjId} + + + + \ No newline at end of file