From 9e3c755ed2d7f8034b7174e7275860727d6e8769 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Wed, 13 Sep 2023 16:27:21 +0800 Subject: [PATCH] =?UTF-8?q?1.1.3=20=E7=9B=91=E6=8E=A7=E5=8D=95=E5=85=83Con?= =?UTF-8?q?troller=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/httpRequests/http-requests-log.http | 397 +++--------------- .../HwMonitorPlatformController.java | 217 +++++++++- .../controller/HwMonitorUnitController.java | 158 +------ .../controller/HwSceneController.java | 35 +- .../controller/HwTenantController.java | 21 +- .../business/domain/VO/DeviceModeVo.java | 24 +- .../ruoyi/business/mapper/HwSceneMapper.java | 6 + .../ruoyi/business/mapper/HwTenantMapper.java | 18 +- .../service/IHwMonitorUnitService.java | 4 +- .../business/service/IHwSceneModeService.java | 16 +- .../business/service/IHwSceneService.java | 8 +- .../service/impl/HwDeviceServiceImpl.java | 2 +- .../impl/HwMonitorUnitServiceImpl.java | 28 +- .../service/impl/HwSceneServiceImpl.java | 67 +++ .../mapper/business/HwSceneMapper.xml | 63 ++- .../mapper/business/HwTenantMapper.xml | 21 +- 16 files changed, 534 insertions(+), 551 deletions(-) diff --git a/.idea/httpRequests/http-requests-log.http b/.idea/httpRequests/http-requests-log.http index ec4c717..ab74258 100644 --- a/.idea/httpRequests/http-requests-log.http +++ b/.idea/httpRequests/http-requests-log.http @@ -1,3 +1,70 @@ +GET http://localhost:9601/monitorPlatform/monitorPercentage + +<> 2023-09-13T042534.200.json + +### + +GET http://localhost:9601/monitorPlatform/monitorPercentage + +<> 2023-09-13T041522.200.json + +### + +GET http://localhost:9601/monitorPlatform/monitorUnitPercentage + +<> 2023-09-13T041504.200.json + +### + +GET http://localhost:9601/monitorPlatform/monitorUnitPercentage + +<> 2023-09-13T035712.200.json + +### + +POST http://localhost:9601/monitorPlatform/selectDeviceByDeviceModeByMonitorUnitId +{21321321}: + +<> 2023-09-13T035612.400.html + +### + +GET http://localhost:9601/monitorPlatform/monitorUnitPercentage + +<> 2023-09-13T035551.200.json + +### + +GET http://localhost:9601/monitorPlatform/monitorUnitPercentage + +<> 2023-09-13T035541.200.json + +### + +POST http://localhost:9601/monitorPlatform/treeList + +<> 2023-09-13T035533.200.json + +### + +GET http://localhost:9601/tenant/list + +<> 2023-09-11T045735.200.json + +### + +GET http://localhost:9601/monitorUnit/alarmStats + +<> 2023-09-11T045659.200.json + +### + +POST http://localhost:9601/monitorUnit/SelectSecne + +<> 2023-09-11T045623.200.json + +### + POST http://localhost/monitorUnit/getDeviceOperations } @@ -994,333 +1061,3 @@ Accept-Encoding: br,deflate,gzip,x-gzip ### -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_4", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 0 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693589999996 - } - ] -} - -<> 2023-09-05T142413.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_4", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 1 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693589999906 - } - ] -} - -<> 2023-09-05T142405.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_4", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 1 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693389999906 - } - ] -} - -<> 2023-09-05T142353.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_3", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 1 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693579949106 - } - ] -} - -<> 2023-09-05T142336.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_3", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 0 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693379949106 - } - ] -} - -<> 2023-09-05T142320.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_3", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 0 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693279949106 - } - ] -} - -<> 2023-09-05T142305.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_2", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 0 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693376368166 - } - ] -} - -<> 2023-09-05T142258.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_2", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 1 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693276368166 - } - ] -} - -<> 2023-09-05T142242.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_2", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 1 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693176368166 - } - ] -} - -<> 2023-09-05T142237.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_2", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 1 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693176268166 - } - ] -} - -<> 2023-09-05T142233.200.json - -### - -POST http://localhost:9602/tdengine/insertTable -Content-Type: application/json -Content-Length: 293 -Connection: Keep-Alive -User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.8) -Accept-Encoding: br,deflate,gzip,x-gzip - -{ - "databaseName": "db_scene_1", - "tableName": "t_ds_2", - "schemaFields": [ - { - "fieldName": "onlineStatus", - "fieldValue": 0 - }, - { - "fieldName": "deviceType", - "fieldValue": 1 - }, - { - "fieldName": "ts", - "fieldValue": 1693176168166 - } - ] -} - -<> 2023-09-05T142218.200.json - -### - diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java index ab5d1be..497a52d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java @@ -1,9 +1,224 @@ package com.ruoyi.business.controller; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.domain.VO.*; +import com.ruoyi.business.mapper.HwSceneMapper; +import com.ruoyi.business.service.IHwDeviceService; +import com.ruoyi.business.service.IHwElectronicFenceService; +import com.ruoyi.business.service.IHwSceneService; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.business.domain.HwMonitorUnit; +import com.ruoyi.business.service.IHwMonitorUnitService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +import static com.ruoyi.common.core.utils.PageUtils.startPage; @RestController @RequestMapping("/monitorPlatform") -public class HwMonitorPlatformController { +public class HwMonitorPlatformController extends BaseController { + + @Autowired + private IHwMonitorUnitService hwMonitorUnitService; + @Autowired + private IHwDeviceService hwDeviceService; + @Autowired + private IHwSceneService hwSceneService; + @Autowired + private IHwElectronicFenceService hwElectronicFenceService; + + + /** + * 树状获取监控单元列表 + * @param hwMonitorUnits 监控单元对象 + * @return list + * @throws + * */ + @PostMapping("/treeList") + public TableDataInfo treeList(List hwMonitorUnits){ + List list = hwMonitorUnitService.selectTreeList(hwMonitorUnits); + return getDataTable(list); + + } +// /** +// * +// * 选择场景 +// * @param sceneModeId 场景id +// * @return +// */ +// +// @PostMapping("/selectHwSceneBySceneModeId") +// public TableDataInfo selectHwSceneBySceneModeId(Long sceneModeId){ +// List hwScenes = hwSceneService.selectHwSceneBySceneModeId(sceneModeId); +// return getDataTable(hwScenes); +// } + /** + * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) + * */ + @GetMapping("/monitorUnitPercentage") + public TableDataInfo monitorUnitPercentage(){ + List maps = hwDeviceService.selectDeviceModeNameVo(); + return getDataTable(maps); + } + // + /** + * 获取有开关属性的设备 + * @param monitorUnitId 监控单元id + * */ + @PostMapping("/selectDeviceByDeviceModeByMonitorUnitId") + public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){ + startPage(); + Map> maps = hwDeviceService.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId); + return maps; + } + /** + * 获取直采变量的设备 + * @param monitorUnitId 监控单元id + */ + @PostMapping("/selectDeviceModeFunctionByFunctionType") + public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId){ + startPage(); + Map> maps = hwDeviceService.selectDeviceModeFunctionByFunctionType(monitorUnitId); + return maps; + } + // + /** + * 设备历史数据 + * @param deviceId 设备id + * */ + @PostMapping("/getHistoryData") + public TableDataInfo getHistoryData(Long deviceId){ + startPage(); + List> historyData = hwDeviceService.getHistoryData(deviceId); + return getDataTable(historyData); + } + /** + * 查询区域数量站场景区总数百分比 + * */ + @GetMapping("/monitorPercentage") + public TableDataInfo monitorPercentage(){ + List maps = hwMonitorUnitService.selectMonitorPercentage(); + return getDataTable(maps); + } + /** + *  展示总的设备数量和总的监控单元数量 + * */ + @GetMapping("/allNums") + public AllNumsVo allNums(){ + AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(); + + return allNumsVos; + } + /** + *  按场景展示总的设备数量和总的监控单元数量 + * */ + @GetMapping("/sceneAllNums") + public TableDataInfo sceneAllNums(){ + List allNumsVos = hwMonitorUnitService.selectSenceAllNums(); + + return getDataTable(allNumsVos); + } + /** + * 分页获取最子集监控单元列表 + * */ + @PostMapping("/limitSubMonitorUnit") + public TableDataInfo limitSubMonitorUnit(){ + startPage(); + List hwMonitorUnits = hwMonitorUnitService.selectLimitSubMonitorUnit(); + return getDataTable(hwMonitorUnits); + } + /** + * 监控单元报警统计 + */ + @GetMapping("/alarmStats") + public TableDataInfo alarmStats(){ + List alarmStatsVos = hwMonitorUnitService.selectAlarmStats(); + return getDataTable(alarmStatsVos); + } + /** + * 获取最子级监控单元数量、设备数量和在线设备数量 + * @param sceneId 场景id + * */ + @PostMapping("/SubDevice") + public SubDeviceSumVo subDevice(Long sceneId){ + SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId); + + return subDeviceSumVos; + } + /** + * 按电子围栏定位显示其下设备数量,以及报警的设备数量。 + * @param sceneId + * */ + @PostMapping("/ElectronicNumVo") + public TableDataInfo ElectronicNumVo(Long sceneId){ + List eleMonitorDeviceSumVos = hwElectronicFenceService.selectEleTypeNums(sceneId); + return getDataTable(eleMonitorDeviceSumVos); + } + /** + * 获取监控单元详细信息 + * @param monitorUnitId + * */ + @PostMapping("/selectMonitorUnitSub") + //ok + public HwMonitorUnit selectMonitorUnitSub(Long monitorUnitId){ + HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); + + return hwMonitorUnits; + } + /** + * 2. 设备实时在运数量曲线图 + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @param sceneId 场景id + * */ + @PostMapping("/getDeviceOperations") + public Integer selectTdengine(String beginTime,String endTime,Long sceneId){ + int ints = hwMonitorUnitService.selectTdengine(beginTime,endTime,sceneId); + return ints; + } + /** + * 设备汇总 + * */ + @PostMapping("/selectLatestDataByTags") + public TableDataInfo selectLatestDataByTags(Long monitorUnitId){ + List> list= hwMonitorUnitService.selectLatestDataByTags(monitorUnitId); + return getDataTable(list); + } + /** + * 场景选择 + * ,id=0 可以返回所有,其他根据id过滤,默认标识 + * + * */ + @PostMapping("/SelectSecne") + public TableDataInfo SelectSecneByUser(){ + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long tenantId = sysUser.getTenantId(); + List hwScenes = hwSceneService.selectHwSceneByTenantId(tenantId); + hwScenes.get(0).setDefaultFlag("1"); + return getDataTable(hwScenes); + } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java index 27505b5..bcca3ba 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java @@ -13,6 +13,9 @@ import com.ruoyi.business.service.IHwDeviceService; import com.ruoyi.business.service.IHwElectronicFenceService; import com.ruoyi.business.service.IHwSceneService; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -64,163 +67,8 @@ public class HwMonitorUnitController extends BaseController List list = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit); return getDataTable(list); } - /** - * 树状获取监控单元列表 - * @param hwMonitorUnits 监控单元对象 - * @return list - * @throws - * */ - @PostMapping("/treeList") - public TableDataInfo treeList(List hwMonitorUnits){ - List list = hwMonitorUnitService.selectTreeList(hwMonitorUnits); - return getDataTable(list); - } -// /** -// * -// * 选择场景 -// * @param sceneModeId 场景id -// * @return -// */ -// -// @PostMapping("/selectHwSceneBySceneModeId") -// public TableDataInfo selectHwSceneBySceneModeId(Long sceneModeId){ -// List hwScenes = hwSceneService.selectHwSceneBySceneModeId(sceneModeId); -// return getDataTable(hwScenes); -// } - /** - * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) - * */ - @GetMapping("/monitorUnitPercentage") - public TableDataInfo monitorUnitPercentage(){ - List maps = hwDeviceService.selectDeviceModeNameVo(); - return getDataTable(maps); - } - // - /** - * 获取有开关属性的设备 - * @param monitorUnitId 监控单元id - * */ - @PostMapping("/selectDeviceByDeviceModeByMonitorUnitId") - public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){ - startPage(); - Map> maps = hwDeviceService.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId); - return maps; - } - /** - * 获取直采变量的设备 - * @param monitorUnitId 监控单元id - */ - @PostMapping("/selectDeviceModeFunctionByFunctionType") - public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId){ - startPage(); - Map> maps = hwDeviceService.selectDeviceModeFunctionByFunctionType(monitorUnitId); - return maps; - } - // - /** - * 设备历史数据 - * @param deviceId 设备id - * */ - @PostMapping("/getHistoryData") - public TableDataInfo getHistoryData(Long deviceId){ - startPage(); - List> historyData = hwDeviceService.getHistoryData(deviceId); - return getDataTable(historyData); - } - /** - * 查询区域数量站场景区总数百分比 - * */ - @GetMapping("/monitorPercentage") - public TableDataInfo monitorPercentage(){ - List maps = hwMonitorUnitService.selectMonitorPercentage(); - return getDataTable(maps); -} - /** - *  展示总的设备数量和总的监控单元数量 - * */ - @GetMapping("/allNums") - public AllNumsVo allNums(){ - AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(); - - return allNumsVos; - } - /** - *  按场景展示总的设备数量和总的监控单元数量 - * */ - @GetMapping("/sceneAllNums") - public TableDataInfo sceneAllNums(){ - List allNumsVos = hwMonitorUnitService.selectSenceAllNums(); - - return getDataTable(allNumsVos); - } - /** - * 分页获取最子集监控单元列表 - * */ - @PostMapping("/limitSubMonitorUnit") - public TableDataInfo limitSubMonitorUnit(){ - startPage(); - List hwMonitorUnits = hwMonitorUnitService.selectLimitSubMonitorUnit(); - return getDataTable(hwMonitorUnits); - } - /** - * 监控单元报警统计 - */ - @GetMapping("/alarmStats") - public TableDataInfo alarmStats(){ - List alarmStatsVos = hwMonitorUnitService.selectAlarmStats(); - return getDataTable(alarmStatsVos); - } - /** - * 获取最子级监控单元数量、设备数量和在线设备数量 - * @param sceneId 场景id - * */ - @PostMapping("/SubDevice") - public SubDeviceSumVo subDevice(Long sceneId){ - SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId); - - return subDeviceSumVos; - } - /** - * 按电子围栏定位显示其下设备数量,以及报警的设备数量。 - * @param sceneId - * */ - @PostMapping("/ElectronicNumVo") - public TableDataInfo ElectronicNumVo(Long sceneId){ - List eleMonitorDeviceSumVos = hwElectronicFenceService.selectEleTypeNums(sceneId); - return getDataTable(eleMonitorDeviceSumVos); - } - /** - * 获取监控单元详细信息 - * @param monitorUnitId - * */ - @PostMapping("/selectMonitorUnitSub") - //ok - public HwMonitorUnit selectMonitorUnitSub(Long monitorUnitId){ - HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); - - return hwMonitorUnits; - } - /** - * 2. 设备实时在运数量曲线图 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @param sceneId 场景id - * */ - @PostMapping("/getDeviceOperations") - public Integer selectTdengine(String beginTime,String endTime,Long sceneId){ - int ints = hwMonitorUnitService.selectTdengine(beginTime,endTime,sceneId); - return ints; - } - /** - * 通过tde获取各设备最新的一条信息 - * */ -// @PostMapping("/selectLatestDataByTags") -// public TableDataInfo selectLatestDataByTags(Long monitorUnitId){ -// List> list= hwMonitorUnitService.selectLatestDataByTags(monitorUnitId); -// return getDataTable(list); -// } /** * 导出监控单元列表 */ diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java index a2a88bb..80e8d0a 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java @@ -1,13 +1,21 @@ package com.ruoyi.business.controller; +import java.math.BigDecimal; import java.util.List; import java.io.IOException; import java.util.Locale; +import java.util.UUID; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.business.domain.HwSceneMode; +import com.ruoyi.business.domain.VO.HwSceneVo; +import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.i18n.utils.MessageUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; +import org.apache.commons.lang3.RandomStringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.validation.annotation.Validated; @@ -51,10 +59,10 @@ public class HwSceneController extends BaseController */ @RequiresPermissions("business:scene:list") @GetMapping("/list") - public TableDataInfo list(HwScene hwScene) + public TableDataInfo list(HwSceneVo hwScene) { startPage(); - List list = hwSceneService.selectHwSceneList(hwScene); + List list = hwSceneService.selectHwSceneList2(hwScene); return getDataTable(list); } @@ -88,8 +96,10 @@ public class HwSceneController extends BaseController @RequiresPermissions("business:scene:add") @Log(title = "场景信息", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody @Validated HwScene hwScene) + public AjaxResult add(@RequestBody HwScene hwScene) { + +// System.out.println(hwScene); return toAjax(hwSceneService.insertHwScene(hwScene)); } @@ -101,6 +111,9 @@ public class HwSceneController extends BaseController @PutMapping public AjaxResult edit(@RequestBody HwScene hwScene) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + hwScene.setUpdateBy(sysUser.getNickName()); return toAjax(hwSceneService.updateHwScene(hwScene)); } @@ -114,4 +127,20 @@ public class HwSceneController extends BaseController { return toAjax(hwSceneService.deleteHwSceneBySceneIds(sceneIds)); } + @GetMapping("/isAdmin") + public Boolean isAdmin(){ + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); +// System.out.println(sysUser.getUserName()); + if (sysUser.getUserName().equals("admin")){ +// System.out.println("true"); + return true; + }else { + return false; + } + } + + } + + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java index 2a5c99e..c375d39 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwTenantController.java @@ -1,8 +1,13 @@ package com.ruoyi.business.controller; +import java.util.ArrayList; import java.util.List; import java.io.IOException; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -24,7 +29,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo; /** * 租户信息Controller - * + * * @author xins * @date 2023-09-04 */ @@ -42,8 +47,11 @@ public class HwTenantController extends BaseController @GetMapping("/list") public TableDataInfo list(HwTenant hwTenant) { + List list = new ArrayList(); startPage(); - List list = hwTenantService.selectHwTenantList(hwTenant); + //todo 放到add中 + + list = hwTenantService.selectHwTenantList(hwTenant); return getDataTable(list); } @@ -78,6 +86,10 @@ public class HwTenantController extends BaseController @PostMapping public AjaxResult add(@RequestBody HwTenant hwTenant) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + hwTenant.setIsRegister("0"); + hwTenant.setCreateBy(sysUser.getNickName()); return toAjax(hwTenantService.insertHwTenant(hwTenant)); } @@ -88,7 +100,10 @@ public class HwTenantController extends BaseController @Log(title = "租户信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwTenant hwTenant) - { + {LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + + hwTenant.setUpdateBy(sysUser.getNickName()); return toAjax(hwTenantService.updateHwTenant(hwTenant)); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java index a1886ac..597d10b 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java @@ -8,7 +8,8 @@ package com.ruoyi.business.domain.VO; */ public class DeviceModeVo { - public String monitorUnitTypeName; +// public String monitorUnitTypeName; + public String deviceModeName; public Integer sum; @@ -20,16 +21,12 @@ public class DeviceModeVo { return percentage; } - public void setPercentage(Double percentage) { - this.percentage = percentage; - } - - public String getMonitorUnitTypeName() { - return monitorUnitTypeName; + public String getDeviceModeName() { + return deviceModeName; } - public void setMonitorUnitTypeName(String monitorUnitTypeName) { - this.monitorUnitTypeName = monitorUnitTypeName; + public void setDeviceModeName(String deviceModeName) { + this.deviceModeName = deviceModeName; } public Integer getSum() { @@ -48,12 +45,17 @@ public class DeviceModeVo { this.err = err; } + public void setPercentage(Double percentage) { + this.percentage = percentage; + } + @Override public String toString() { - return "HwMonitorUnitTypeVo{" + - "monitorUnitTypeName='" + monitorUnitTypeName + '\'' + + return "DeviceModeVo{" + + ", deviceModeName='" + deviceModeName + '\'' + ", sum=" + sum + ", err=" + err + + ", percentage=" + percentage + '}'; } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java index 3cb3497..917cc85 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.business.mapper; import java.util.List; import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.domain.VO.HwSceneVo; /** * 场景信息Mapper接口 @@ -19,6 +20,8 @@ public interface HwSceneMapper */ public HwScene selectHwSceneBySceneId(Long sceneId); public List selectHwSceneBySceneModeId(Long sceneModeId); + public List selectHwSceneByTenantId0(Long tenantId); + public List selectHwSceneByTenantIdNot0(Long tenantId); /** @@ -28,6 +31,9 @@ public interface HwSceneMapper * @return 场景信息集合 */ public List selectHwSceneList(HwScene hwScene); + List selectHwSceneVoList(HwSceneVo hwScene); + void updateDefaultFlag(Long tenantId); + /** * 新增场景信息 diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwTenantMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwTenantMapper.java index fe96e2f..1d8c3db 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwTenantMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwTenantMapper.java @@ -5,23 +5,25 @@ import com.ruoyi.business.domain.HwTenant; /** * 租户信息Mapper接口 - * + * * @author xins * @date 2023-09-04 */ -public interface HwTenantMapper +public interface HwTenantMapper { /** * 查询租户信息 - * + * * @param tenantId 租户信息主键 * @return 租户信息 */ public HwTenant selectHwTenantByTenantId(Long tenantId); + + /** * 查询租户信息列表 - * + * * @param hwTenant 租户信息 * @return 租户信息集合 */ @@ -29,7 +31,7 @@ public interface HwTenantMapper /** * 新增租户信息 - * + * * @param hwTenant 租户信息 * @return 结果 */ @@ -37,7 +39,7 @@ public interface HwTenantMapper /** * 修改租户信息 - * + * * @param hwTenant 租户信息 * @return 结果 */ @@ -45,7 +47,7 @@ public interface HwTenantMapper /** * 删除租户信息 - * + * * @param tenantId 租户信息主键 * @return 结果 */ @@ -53,7 +55,7 @@ public interface HwTenantMapper /** * 批量删除租户信息 - * + * * @param tenantIds 需要删除的数据主键集合 * @return 结果 */ diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java index eb21539..8ce773d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java @@ -73,10 +73,10 @@ public interface IHwMonitorUnitService * @return*/ public int selectTdengine(String beginTime,String endTime,Long sceneId); /** - * 通过tde获取最新的一条信息 + * 设备汇总 * * @return*/ -// public List> selectLatestDataByTags(Long monitorUnitId); + public List> selectLatestDataByTags(Long monitorUnitId); /** diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneModeService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneModeService.java index 2563f57..09dc109 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneModeService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneModeService.java @@ -5,15 +5,15 @@ import com.ruoyi.business.domain.HwSceneMode; /** * 场景类型Service接口 - * + * * @author YINQ * @date 2023-08-31 */ -public interface IHwSceneModeService +public interface IHwSceneModeService { /** * 查询场景类型 - * + * * @param sceneModeId 场景类型主键 * @return 场景类型 */ @@ -21,7 +21,7 @@ public interface IHwSceneModeService /** * 查询场景类型列表 - * + * * @param hwSceneMode 场景类型 * @return 场景类型集合 */ @@ -29,7 +29,7 @@ public interface IHwSceneModeService /** * 新增场景类型 - * + * * @param hwSceneMode 场景类型 * @return 结果 */ @@ -37,7 +37,7 @@ public interface IHwSceneModeService /** * 修改场景类型 - * + * * @param hwSceneMode 场景类型 * @return 结果 */ @@ -45,7 +45,7 @@ public interface IHwSceneModeService /** * 批量删除场景类型 - * + * * @param sceneModeIds 需要删除的场景类型主键集合 * @return 结果 */ @@ -53,7 +53,7 @@ public interface IHwSceneModeService /** * 删除场景类型信息 - * + * * @param sceneModeId 场景类型主键 * @return 结果 */ diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java index c3eb04a..f65da07 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java @@ -2,6 +2,7 @@ package com.ruoyi.business.service; import java.util.List; import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.domain.VO.HwSceneVo; /** * 场景信息Service接口 @@ -19,8 +20,11 @@ public interface IHwSceneService */ public HwScene selectHwSceneBySceneId(Long sceneId); - //选择场景 + public List selectHwSceneBySceneModeId(Long sceneModeId); + + //场景选择 + List selectHwSceneByTenantId(Long tenantId); /** * 查询场景信息列表 * @@ -28,6 +32,8 @@ public interface IHwSceneService * @return 场景信息集合 */ public List selectHwSceneList(HwScene hwScene); + public List selectHwSceneList2(HwSceneVo hwScene); + /** * 新增场景信息 diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java index d349de9..d92516c 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java @@ -81,7 +81,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService } } DeviceModeVo hwMonitorUnitTypeVo = new DeviceModeVo(); - hwMonitorUnitTypeVo.setMonitorUnitTypeName("其他"); + hwMonitorUnitTypeVo.setDeviceModeName("其他"); hwMonitorUnitTypeVo.setSum(value); Integer sums = 0; for (int i = 0; i < list.size();i++){ diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java index dbdda67..e851f7f 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java @@ -229,20 +229,20 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService //网关子设备数+非网关设备数(getDeviceType()!=1) } -// @Override -// public List> selectLatestDataByTags(Long monitorUnitId) { -// List> latestData = new ArrayList>; -// List hwDevices = hwDeviceMapper.selectDeviceByMonitorId(monitorUnitId); -// TdSelectDto tdSelectDto = new TdSelectDto(); -// for (int i = 0; i < hwDevices.size(); i++){ -// tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); -// tdSelectDto.settableName(TdEngineConstants.getDeviceDataTableName(hwDevices.get(i).getDeviceId()); -// tdSelectDto.settagsName(monitorUnitId); -// tdSelectDto.set -// latestData = (List>) remoteTdEgineService.getLatestData(tdSelectDto); -// } -// return latestData; -// } + @Override + public List> selectLatestDataByTags(Long monitorUnitId) { + List> latestData = new ArrayList>(); + List hwDevices = hwDeviceMapper.selectDeviceByMonitorId(monitorUnitId); + TdSelectDto tdSelectDto = new TdSelectDto(); + for (int i = 0; i < hwDevices.size(); i++){ + tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); + tdSelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(hwDevices.get(i).getDeviceId())); + tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); + + latestData = (List>) remoteTdEgineService.getLatestDataByTags(tdSelectDto); + } + return latestData; + } //todo SysDeptServiceImpl类中的递归方法recursionFn(以实现) @Override diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java index 30bbceb..28881c2 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java @@ -1,7 +1,18 @@ package com.ruoyi.business.service.impl; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; + +import com.ruoyi.business.domain.HwSceneMode; +import com.ruoyi.business.domain.VO.HwSceneVo; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.redis.service.RedisService; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.model.LoginUser; +import org.apache.commons.lang3.RandomStringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.business.mapper.HwSceneMapper; @@ -19,6 +30,9 @@ public class HwSceneServiceImpl implements IHwSceneService { @Autowired private HwSceneMapper hwSceneMapper; + @Autowired + private RedisService redisService; + /** * 查询场景信息 @@ -39,6 +53,15 @@ public class HwSceneServiceImpl implements IHwSceneService return hwScenes; } + @Override + public List selectHwSceneByTenantId(Long tenantId) { + if (tenantId == 0){ + return hwSceneMapper.selectHwSceneByTenantId0(tenantId); + } + else + return hwSceneMapper.selectHwSceneByTenantIdNot0(tenantId); + + } /** @@ -53,6 +76,12 @@ public class HwSceneServiceImpl implements IHwSceneService return hwSceneMapper.selectHwSceneList(hwScene); } + @Override + public List selectHwSceneList2(HwSceneVo hwScene) { + return hwSceneMapper.selectHwSceneVoList(hwScene); + } + + /** * 新增场景信息 * @@ -62,7 +91,32 @@ public class HwSceneServiceImpl implements IHwSceneService @Override public int insertHwScene(HwScene hwScene) { + if(hwScene.getDefaultFlag() == "1"){ + hwSceneMapper.updateDefaultFlag(hwScene.getTenantId()); + } + hwScene.setDefaultFlag("1"); + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + hwScene.setSceneStatus("1"); + Long lon = new Long(10); + hwScene.setSceneId(lon); + hwScene.setCreateBy(sysUser.getNickName()); + + if (hwScene.getPreserveTime()==null){ + hwScene.setPreserveTime(new BigDecimal(90)); + } + if (hwScene.getTestPreserveTime()==null){ + hwScene.setTestPreserveTime(new BigDecimal(30)); + } + String randomKey = RandomStringUtils.random(12, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); + String randomSecret = RandomStringUtils.random(16,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); + hwScene.setModeKey(randomKey); + hwScene.setModeSecret(randomSecret); hwScene.setCreateTime(DateUtils.getNowDate()); + List list = new ArrayList(); + list.add(hwScene); + redisService.setCacheList(hwScene.getSceneId()+"",list); + return hwSceneMapper.insertHwScene(hwScene); } @@ -75,7 +129,14 @@ public class HwSceneServiceImpl implements IHwSceneService @Override public int updateHwScene(HwScene hwScene) { + if(hwScene.getDefaultFlag() == "1"){ + hwSceneMapper.updateDefaultFlag(hwScene.getTenantId()); + } + hwScene.setDefaultFlag("1"); hwScene.setUpdateTime(DateUtils.getNowDate()); + List list = new ArrayList(); + list.add(hwScene); + redisService.setCacheList(hwScene.getSceneId()+"",list); return hwSceneMapper.updateHwScene(hwScene); } @@ -88,6 +149,11 @@ public class HwSceneServiceImpl implements IHwSceneService @Override public int deleteHwSceneBySceneIds(Long[] sceneIds) { + List list = new ArrayList<>(); + for (int i = 0; i < sceneIds.length;i++){ + list.add(sceneIds[i]); + } + redisService.deleteObject(sceneIds+""); return hwSceneMapper.deleteHwSceneBySceneIds(sceneIds); } @@ -100,6 +166,7 @@ public class HwSceneServiceImpl implements IHwSceneService @Override public int deleteHwSceneBySceneId(Long sceneId) { + redisService.deleteObject(sceneId+""); return hwSceneMapper.deleteHwSceneBySceneId(sceneId); } } diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml index 458ddd8..d01a5f2 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml @@ -26,11 +26,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + + + + + + + + + + + + select scene_id, scene_name, tenant_id, scene_mode_id, scene_pic, default_flag, scene_status, auth_mode, mode_account, mode_key, mode_secret, preserve_time, test_preserve_time, remark, create_by, create_time, update_by, update_time, scene_environment, scene_field from hw_scene + - + + insert into hw_scene @@ -103,7 +152,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{sceneField}, - + + update hw_scene + set default_flag = '0' + where tenant_id = #{tenantId} + update hw_scene @@ -131,11 +184,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from hw_scene where scene_id = #{sceneId} + update hw_scene set scene_status = '9' where scene_id = #{sceneId} - delete from hw_scene where scene_id in + update hw_scene set scene_status = '9' where scene_id = in #{sceneId} diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml index 3c3f0a3..5015283 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwTenantMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -31,12 +31,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - + insert into hw_tenant @@ -119,13 +119,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from hw_tenant where tenant_id = #{tenantId} - +UPDATE hw_tenant t1,sys_user t2 + set t1.tenant_status = '9', t2.del_flag = '2' + where t1.tenant_id = t2.tenant_id and t1.tenant_id=#{tenantId} - delete from hw_tenant where tenant_id in + UPDATE hw_tenant t1,sys_user t2 + set t1.tenant_status = '9', t2.del_flag = '2' + where t1.tenant_id = t2.tenant_id and t1.tenant_id in #{tenantId} - \ No newline at end of file +