监控单元模块 1.1.3

dev
zhouhongyu 1 year ago
parent 931934613a
commit 08ba6abe3b

@ -1,3 +1,21 @@
POST http://localhost/monitorUnit/getDeviceOperations
}
###
POST http://localhost:9601/monitorUnit/export
<> 2023-09-05T031749.200.json
###
GET http://localhost:9601/monitorUnit/ElectronicNumVo
<> 2023-09-05T031734.200.json
###
POST http://localhost:9602/tdengine/getOnlineDevicesGroupByDay
Content-Type: application/json
Content-Length: 71
@ -1306,93 +1324,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_1",
"schemaFields": [
{
"fieldName": "onlineStatus",
"fieldValue": 0
},
{
"fieldName": "deviceType",
"fieldValue": 1
},
{
"fieldName": "ts",
"fieldValue": 1693696189106
}
]
}
<> 2023-09-05T142206.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_1",
"schemaFields": [
{
"fieldName": "onlineStatus",
"fieldValue": 0
},
{
"fieldName": "deviceType",
"fieldValue": 1
},
{
"fieldName": "ts",
"fieldValue": 1693296189106
}
]
}
<> 2023-09-05T142158.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_1",
"schemaFields": [
{
"fieldName": "onlineStatus",
"fieldValue": 1
},
{
"fieldName": "deviceType",
"fieldValue": 1
},
{
"fieldName": "ts",
"fieldValue": 1693296188106
}
]
}
<> 2023-09-05T142143.200.json
###

@ -94,6 +94,16 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>hw-api-tdengine</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@ -113,4 +123,4 @@
</plugins>
</build>
</project>
</project>

@ -1,8 +1,11 @@
package com.ruoyi.business.controller;
import java.util.List;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.business.domain.VO.DeviceModeVo;
import com.ruoyi.business.domain.VO.HwMonitorUnitVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -24,7 +27,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
*
* @author xins
* @date 2023-08-24
*/
@ -47,6 +50,9 @@ public class HwDeviceController extends BaseController
return getDataTable(list);
}
/**
*
*/

@ -1,8 +1,17 @@
package com.ruoyi.business.controller;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
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.IHwSceneService;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -24,7 +33,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
*
* @author YINQ
* @date 2023-08-31
*/
@ -34,6 +43,12 @@ public class HwMonitorUnitController extends BaseController
{
@Autowired
private IHwMonitorUnitService hwMonitorUnitService;
@Autowired
private IHwDeviceService hwDeviceService;
@Autowired
private IHwSceneService hwSceneService;
/**
*
@ -46,7 +61,136 @@ public class HwMonitorUnitController extends BaseController
List<HwMonitorUnit> list = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit);
return getDataTable(list);
}
/**
*
* */
@GetMapping("/treeList")
public TableDataInfo treeList(List<HwMonitorUnit> hwMonitorUnits){
List<HwMonitorUnit> list = hwMonitorUnitService.selectTreeList(hwMonitorUnits);
return getDataTable(list);
}
//选择场景
@GetMapping("/selectHwSceneBySceneModeId")
public TableDataInfo selectHwSceneBySceneModeId(Long sceneModeId){
List<HwScene> hwScenes = hwSceneService.selectHwSceneBySceneModeId(sceneModeId);
return getDataTable(hwScenes);
}
/**
* 3.
* */
@GetMapping("/monitorUnitPercentage")
public TableDataInfo monitorUnitPercentage(){
List<DeviceModeVo> maps = hwDeviceService.selectDeviceModeNameVo();
return getDataTable(maps);
}
//获取有开关属性的设备
@PostMapping("/selectDeviceByDeviceModeByMonitorUnitId")
public Map<String, Map<String, Object>> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){
startPage();
Map<String, Map<String, Object>> maps = hwDeviceService.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId);
return maps;
}
//获取直采变量的设备
@PostMapping("/selectDeviceModeFunctionByFunctionType")
public Map<String, Map<String, Object>> selectDeviceModeFunctionByFunctionType(Long monitorUnitId){
startPage();
Map<String, Map<String, Object>> maps = hwDeviceService.selectDeviceModeFunctionByFunctionType(monitorUnitId);
return maps;
}
//设备历史数据
@PostMapping("/getHistoryData")
public TableDataInfo getHistoryData(Long deviceId){
startPage();
List<Map<String, Object>> historyData = hwDeviceService.getHistoryData(deviceId);
return getDataTable(historyData);
}
/**
*
* */
@GetMapping("/monitorPercentage")
public TableDataInfo monitorPercentage(){
List<HwMonitorUnitVo> maps = hwMonitorUnitService.selectMonitorPercentage();
return getDataTable(maps);
}
/**
*
* */
@GetMapping("/allNums")
public AllNumsVo allNums(){
AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums();
return allNumsVos;
}
/**
*
* */
@GetMapping("/sceneAllNums")
public TableDataInfo sceneAllNums(){
List<AllNumsVo> allNumsVos = hwMonitorUnitService.selectSenceAllNums();
return getDataTable(allNumsVos);
}
/**
*
* */
@PostMapping("/limitSubMonitorUnit")
public TableDataInfo limitSubMonitorUnit(){
startPage();
List<HwMonitorUnit> hwMonitorUnits = hwMonitorUnitService.selectLimitSubMonitorUnit();
return getDataTable(hwMonitorUnits);
}
/**
*
*/
@GetMapping("/alarmStats")
public TableDataInfo alarmStats(){
List<AlarmStatsVo> alarmStatsVos = hwMonitorUnitService.selectAlarmStats();
return getDataTable(alarmStatsVos);
}
/**
* 线
* */
@GetMapping("/SubDevice")
public SubDeviceSumVo subDevice(Long sceneId){
SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId);
return subDeviceSumVos;
}
/**
*
* */
@PostMapping("/ElectronicNumVo")
public AjaxResult ElectronicNumVo(Long sceneId){
Integer integer = hwMonitorUnitService.selectElectronicNum(sceneId);
return success(integer);
}
/**
*
* */
@GetMapping("/selectMonitorUnitSub")
//ok
public HwMonitorUnit selectMonitorUnitSub(Long monitorUnitId){
HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId);
return hwMonitorUnits;
}
/**
* 2. 线
* */
@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<Map<String, Object>> list= hwMonitorUnitService.selectLatestDataByTags(monitorUnitId);
// return getDataTable(list);
// }
/**
*
*/
@ -70,6 +214,7 @@ public class HwMonitorUnitController extends BaseController
return success(hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId));
}
/**
*
*/
@ -102,4 +247,9 @@ public class HwMonitorUnitController extends BaseController
{
return toAjax(hwMonitorUnitService.deleteHwMonitorUnitByMonitorUnitIds(monitorUnitIds));
}
}

@ -1,8 +1,8 @@
package com.ruoyi.business.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -24,7 +24,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
*
* @author YINQ
* @date 2023-08-31
*/
@ -47,6 +47,7 @@ public class HwMonitorUnitTypeController extends BaseController
return getDataTable(list);
}
/**
*
*/

@ -24,7 +24,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
*
* @author xins
* @date 2023-08-23
*/
@ -58,6 +58,7 @@ public class HwSceneController extends BaseController
return getDataTable(list);
}
/**
*
*/

@ -1,6 +1,9 @@
package com.ruoyi.business.domain;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
@ -8,7 +11,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* hw_monitor_unit
*
*
* @author YINQ
* @date 2023-08-31
*/
@ -58,103 +61,112 @@ public class HwMonitorUnit extends BaseEntity
/** 预留字段 */
@Excel(name = "预留字段")
private String monitorUnitField;
private List<HwMonitorUnit> child = new ArrayList<HwMonitorUnit>();
public List<HwMonitorUnit> getChild() {
return child;
}
public void setChild(List<HwMonitorUnit> child) {
this.child = child;
}
public void setMonitorUnitId(Long monitorUnitId)
public void setMonitorUnitId(Long monitorUnitId)
{
this.monitorUnitId = monitorUnitId;
}
public Long getMonitorUnitId()
public Long getMonitorUnitId()
{
return monitorUnitId;
}
public void setMonitorUnitName(String monitorUnitName)
public void setMonitorUnitName(String monitorUnitName)
{
this.monitorUnitName = monitorUnitName;
}
public String getMonitorUnitName()
public String getMonitorUnitName()
{
return monitorUnitName;
}
public void setSceneId(Long sceneId)
public void setSceneId(Long sceneId)
{
this.sceneId = sceneId;
}
public Long getSceneId()
public Long getSceneId()
{
return sceneId;
}
public void setParentId(Long parentId)
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Long getParentId()
public Long getParentId()
{
return parentId;
}
public void setMonitorUnitTypeId(Long monitorUnitTypeId)
public void setMonitorUnitTypeId(Long monitorUnitTypeId)
{
this.monitorUnitTypeId = monitorUnitTypeId;
}
public Long getMonitorUnitTypeId()
public Long getMonitorUnitTypeId()
{
return monitorUnitTypeId;
}
public void setAreaId(Long areaId)
public void setAreaId(Long areaId)
{
this.areaId = areaId;
}
public Long getAreaId()
public Long getAreaId()
{
return areaId;
}
public void setMonitorAddress(String monitorAddress)
public void setMonitorAddress(String monitorAddress)
{
this.monitorAddress = monitorAddress;
}
public String getMonitorAddress()
public String getMonitorAddress()
{
return monitorAddress;
}
public void setMonitorPic(String monitorPic)
public void setMonitorPic(String monitorPic)
{
this.monitorPic = monitorPic;
}
public String getMonitorPic()
public String getMonitorPic()
{
return monitorPic;
}
public void setPreserveTime(BigDecimal preserveTime)
public void setPreserveTime(BigDecimal preserveTime)
{
this.preserveTime = preserveTime;
}
public BigDecimal getPreserveTime()
public BigDecimal getPreserveTime()
{
return preserveTime;
}
public void setMonitorUnitStatus(Long monitorUnitStatus)
public void setMonitorUnitStatus(Long monitorUnitStatus)
{
this.monitorUnitStatus = monitorUnitStatus;
}
public Long getMonitorUnitStatus()
public Long getMonitorUnitStatus()
{
return monitorUnitStatus;
}
public void setMonitorUnitField(String monitorUnitField)
public void setMonitorUnitField(String monitorUnitField)
{
this.monitorUnitField = monitorUnitField;
}
public String getMonitorUnitField()
public String getMonitorUnitField()
{
return monitorUnitField;
}

@ -2,34 +2,47 @@ package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.HwDevice;
import com.ruoyi.business.domain.VO.DeviceModeVo;
import com.ruoyi.business.domain.VO.HwMonitorUnitVo;
/**
* Mapper
*
*
* @author xins
* @date 2023-08-24
*/
public interface HwDeviceMapper
public interface HwDeviceMapper
{
/**
*
*
*
* @param deviceId
* @return
*/
public HwDevice selectHwDeviceByDeviceId(Long deviceId);
List<HwDevice> selectDeviceByMonitorId(Long monitorUnitId);
/**
* 3.
* */
public List<DeviceModeVo> selectDeviceModeNameVo();
/**
*
*
*
* @param hwDevice
* @return
*/
public List<HwDevice> selectHwDeviceList(HwDevice hwDevice);
public List<HwDevice> selectDeviceByDeviceModeBySceneId(Long sceneId);
public List<HwDevice> selectDeviceByDeviceModeByMonitorUnitId(Long monitor_unit_id);
String selectDeviceByDeviceModeByDeviceModeFunction(Long deviceId);
String selectDeviceModeFunctionByFunctionType(Long deviceId);
List<HwDevice> selectDeviceNum(Long sceneId);
/**
*
*
*
* @param hwDevice
* @return
*/
@ -37,7 +50,7 @@ public interface HwDeviceMapper
/**
*
*
*
* @param hwDevice
* @return
*/
@ -45,7 +58,7 @@ public interface HwDeviceMapper
/**
*
*
*
* @param deviceId
* @return
*/
@ -53,7 +66,7 @@ public interface HwDeviceMapper
/**
*
*
*
* @param deviceIds
* @return
*/

@ -5,23 +5,27 @@ import com.ruoyi.business.domain.HwElectronicFence;
/**
* Mapper
*
*
* @author xins
* @date 2023-09-04
*/
public interface HwElectronicFenceMapper
public interface HwElectronicFenceMapper
{
/**
*
*
*
* @param electronicFenceId
* @return
*/
public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId);
/**
*
* */
public List<HwElectronicFence> selectElectronicByScene(Long sceneId);
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -29,7 +33,7 @@ public interface HwElectronicFenceMapper
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -37,7 +41,7 @@ public interface HwElectronicFenceMapper
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -45,7 +49,7 @@ public interface HwElectronicFenceMapper
/**
*
*
*
* @param electronicFenceId
* @return
*/
@ -53,7 +57,7 @@ public interface HwElectronicFenceMapper
/**
*
*
*
* @param electronicFenceIds
* @return
*/

@ -1,35 +1,89 @@
package com.ruoyi.business.mapper;
import java.util.List;
import com.alibaba.druid.support.http.MonitorClientContextListener;
import com.ruoyi.business.domain.HwMonitorUnit;
import com.ruoyi.business.domain.HwScene;
import com.ruoyi.business.domain.VO.*;
/**
* Mapper
*
*
* @author YINQ
* @date 2023-08-31
*/
public interface HwMonitorUnitMapper
public interface HwMonitorUnitMapper
{
/**
*
*
*
* @param monitorUnitId
* @return
*/
public HwMonitorUnit selectHwMonitorUnitByMonitorUnitId(Long monitorUnitId);
/**
* ()
* */
public List<HwMonitorUnitVo> selectMonitorPercentage();
/**
*
* */
public List<AllNumsVo> selectAllNums();
public List<AllNumsVo> selectsum();
//查询id与name的结果集
List<HwMonitorUnitVo> selectSceneNameById();
String selectSubSetNums();
/**
*
* */
public List<HwMonitorUnit> selectLimitSubMonitorUnit();
Integer selectReleatedDeviceIdNums(Long deviceCode);
Integer selectDeviceNums();
Integer selectSubDeviceSum(Long sceneId);
/**
*
* */
public List<AlarmStatsVo> selectAlarmStats();
/**
* 线
* */
public List<SubDeviceSumVo> selectSubDeviceSum();
/**
*
* */
public List<ElectronicNumVo> selectElectronicNum(Long sceneId);
//查询场景下电子围栏
public List<Long> selectEleInScene(Long sceneId);
public String selectEleType2(Long electronicFenceId);
public String selectEleType3(Long sceneId);
public Integer selectDeviceType2Nums(Long sceneId);
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
public List<HwMonitorUnit> selectHwMonitorUnitList(HwMonitorUnit hwMonitorUnit);
/**
*
* */
//查询子集
public List<HwMonitorUnit> selectHwMonitorUnitByParent(Long monitorUnitId);
//查询最小单元的详细信息
public List<HwMonitorUnit> selectHwmonitorUnitSub(Long monitorUnitId);
//查询是否为最小单元
public String selectHwMonitorUnitIsParent(Long monitorUnitId);
public List<MonitorUnitNumVo> selectHaveEleDevice(Long sceneId);
public List<MonitorUnitNumVo> selectMonitorUnitHaveEle(Long sceneId);
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
@ -37,7 +91,7 @@ public interface HwMonitorUnitMapper
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
@ -45,7 +99,7 @@ public interface HwMonitorUnitMapper
/**
*
*
*
* @param monitorUnitId
* @return
*/
@ -53,7 +107,7 @@ public interface HwMonitorUnitMapper
/**
*
*
*
* @param monitorUnitIds
* @return
*/

@ -2,18 +2,19 @@ package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.HwMonitorUnitType;
import com.ruoyi.business.domain.VO.DeviceModeVo;
/**
* Mapper
*
*
* @author YINQ
* @date 2023-08-31
*/
public interface HwMonitorUnitTypeMapper
public interface HwMonitorUnitTypeMapper
{
/**
*
*
*
* @param monitorUnitTypeId
* @return
*/
@ -21,15 +22,18 @@ public interface HwMonitorUnitTypeMapper
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
public List<HwMonitorUnitType> selectHwMonitorUnitTypeList(HwMonitorUnitType hwMonitorUnitType);
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
@ -37,7 +41,7 @@ public interface HwMonitorUnitTypeMapper
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
@ -45,7 +49,7 @@ public interface HwMonitorUnitTypeMapper
/**
*
*
*
* @param monitorUnitTypeId
* @return
*/
@ -53,7 +57,7 @@ public interface HwMonitorUnitTypeMapper
/**
*
*
*
* @param monitorUnitTypeIds
* @return
*/

@ -5,23 +5,25 @@ import com.ruoyi.business.domain.HwScene;
/**
* Mapper
*
*
* @author xins
* @date 2023-08-23
*/
public interface HwSceneMapper
public interface HwSceneMapper
{
/**
*
*
*
* @param sceneId
* @return
*/
public HwScene selectHwSceneBySceneId(Long sceneId);
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId);
/**
*
*
*
* @param hwScene
* @return
*/
@ -29,7 +31,7 @@ public interface HwSceneMapper
/**
*
*
*
* @param hwScene
* @return
*/
@ -37,7 +39,7 @@ public interface HwSceneMapper
/**
*
*
*
* @param hwScene
* @return
*/
@ -45,7 +47,7 @@ public interface HwSceneMapper
/**
*
*
*
* @param sceneId
* @return
*/
@ -53,7 +55,7 @@ public interface HwSceneMapper
/**
*
*
*
* @param sceneIds
* @return
*/

@ -1,27 +1,41 @@
package com.ruoyi.business.service;
import java.util.List;
import java.util.Map;
import com.ruoyi.business.domain.HwDevice;
import com.ruoyi.business.domain.VO.DeviceModeVo;
import com.ruoyi.business.domain.VO.HwMonitorUnitVo;
/**
* Service
*
*
* @author xins
* @date 2023-08-24
*/
public interface IHwDeviceService
public interface IHwDeviceService
{
/**
*
*
*
* @param deviceId
* @return
*/
public HwDevice selectHwDeviceByDeviceId(Long deviceId);
/**
* 3.
* */
public List<DeviceModeVo> selectDeviceModeNameVo();
public Map<String, Map<String, Object>> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId);
public Map<String, Map<String, Object>> selectDeviceModeFunctionByFunctionType(Long monitorUnitId);
public List<Map<String, Object>> getHistoryData(Long deviceId);
/**
*
*
*
* @param hwDevice
* @return
*/
@ -29,7 +43,7 @@ public interface IHwDeviceService
/**
*
*
*
* @param hwDevice
* @return
*/
@ -37,7 +51,7 @@ public interface IHwDeviceService
/**
*
*
*
* @param hwDevice
* @return
*/
@ -45,7 +59,7 @@ public interface IHwDeviceService
/**
*
*
*
* @param deviceIds
* @return
*/
@ -53,7 +67,7 @@ public interface IHwDeviceService
/**
*
*
*
* @param deviceId
* @return
*/

@ -5,23 +5,26 @@ import com.ruoyi.business.domain.HwElectronicFence;
/**
* Service
*
*
* @author xins
* @date 2023-09-04
*/
public interface IHwElectronicFenceService
public interface IHwElectronicFenceService
{
/**
*
*
*
* @param electronicFenceId
* @return
*/
public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId);
/**
*
* */
public List<HwElectronicFence> selectElectronicByScene(Long sceneId);
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -29,7 +32,7 @@ public interface IHwElectronicFenceService
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -37,7 +40,7 @@ public interface IHwElectronicFenceService
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -45,7 +48,7 @@ public interface IHwElectronicFenceService
/**
*
*
*
* @param electronicFenceIds
* @return
*/
@ -53,7 +56,7 @@ public interface IHwElectronicFenceService
/**
*
*
*
* @param electronicFenceId
* @return
*/

@ -1,35 +1,87 @@
package com.ruoyi.business.service;
import java.util.List;
import java.util.Map;
import com.ruoyi.business.domain.HwMonitorUnit;
import com.ruoyi.business.domain.VO.*;
/**
* Service
*
*
* @author YINQ
* @date 2023-08-31
*/
public interface IHwMonitorUnitService
public interface IHwMonitorUnitService
{
/**
*
*
*
* @param monitorUnitId
* @return
*/
public HwMonitorUnit selectHwMonitorUnitByMonitorUnitId(Long monitorUnitId);
/**
*
* */
public List<HwMonitorUnitVo> selectMonitorPercentage();
/**
*
* */
public AllNumsVo selectAllNums();
public List<AllNumsVo> selectSenceAllNums();
/**
*
* */
public List<HwMonitorUnit> selectLimitSubMonitorUnit();
/**
*
* */
public List<AlarmStatsVo> selectAlarmStats();
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
public List<HwMonitorUnit> selectHwMonitorUnitList(HwMonitorUnit hwMonitorUnit);
/**
* 线
* */
public SubDeviceSumVo selectSubDeviceSum(Long sceneId);
/**
*
* */
public Integer selectElectronicNum(Long sceneId);
/**
*
* */
public List<HwMonitorUnit> selectTreeList(List<HwMonitorUnit> hwMonitorUnits);
/**
*
* */
public HwMonitorUnit selectHwmonitorUnitSub(Long monitorUnitId);
/**
* tdengine
*
* @return*/
public int selectTdengine(String beginTime,String endTime,Long sceneId);
/**
* tde
*
* @return*/
// public List<Map<String, Object>> selectLatestDataByTags(Long monitorUnitId);
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
@ -37,7 +89,7 @@ public interface IHwMonitorUnitService
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
@ -45,7 +97,7 @@ public interface IHwMonitorUnitService
/**
*
*
*
* @param monitorUnitIds
* @return
*/
@ -53,7 +105,7 @@ public interface IHwMonitorUnitService
/**
*
*
*
* @param monitorUnitId
* @return
*/

@ -5,31 +5,35 @@ import com.ruoyi.business.domain.HwMonitorUnitType;
/**
* Service
*
*
* @author YINQ
* @date 2023-08-31
*/
public interface IHwMonitorUnitTypeService
public interface IHwMonitorUnitTypeService
{
/**
*
*
*
* @param monitorUnitTypeId
* @return
*/
public HwMonitorUnitType selectHwMonitorUnitTypeByMonitorUnitTypeId(Long monitorUnitTypeId);
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
public List<HwMonitorUnitType> selectHwMonitorUnitTypeList(HwMonitorUnitType hwMonitorUnitType);
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
@ -37,7 +41,7 @@ public interface IHwMonitorUnitTypeService
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
@ -45,7 +49,7 @@ public interface IHwMonitorUnitTypeService
/**
*
*
*
* @param monitorUnitTypeIds
* @return
*/
@ -53,7 +57,7 @@ public interface IHwMonitorUnitTypeService
/**
*
*
*
* @param monitorUnitTypeId
* @return
*/

@ -5,23 +5,25 @@ import com.ruoyi.business.domain.HwScene;
/**
* Service
*
*
* @author xins
* @date 2023-08-23
*/
public interface IHwSceneService
public interface IHwSceneService
{
/**
*
*
*
* @param sceneId
* @return
*/
public HwScene selectHwSceneBySceneId(Long sceneId);
//选择场景
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId);
/**
*
*
*
* @param hwScene
* @return
*/
@ -29,7 +31,7 @@ public interface IHwSceneService
/**
*
*
*
* @param hwScene
* @return
*/
@ -37,7 +39,7 @@ public interface IHwSceneService
/**
*
*
*
* @param hwScene
* @return
*/
@ -45,7 +47,7 @@ public interface IHwSceneService
/**
*
*
*
* @param sceneIds
* @return
*/
@ -53,7 +55,7 @@ public interface IHwSceneService
/**
*
*
*
* @param sceneId
* @return
*/

@ -1,7 +1,17 @@
package com.ruoyi.business.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ruoyi.business.domain.VO.DeviceModeVo;
import com.ruoyi.common.core.constant.TdEngineConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.tdengine.api.RemoteTdEngineService;
import com.ruoyi.tdengine.api.domain.TdHistorySelectDto;
import com.ruoyi.tdengine.api.domain.TdSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.HwDeviceMapper;
@ -10,19 +20,21 @@ import com.ruoyi.business.service.IHwDeviceService;
/**
* Service
*
*
* @author xins
* @date 2023-08-24
*/
@Service
public class HwDeviceServiceImpl implements IHwDeviceService
public class HwDeviceServiceImpl implements IHwDeviceService
{
@Autowired
private HwDeviceMapper hwDeviceMapper;
@Autowired
private RemoteTdEngineService remoteTdEgineService;
/**
*
*
*
* @param deviceId
* @return
*/
@ -34,7 +46,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService
/**
*
*
*
* @param hwDevice
* @return
*/
@ -46,7 +58,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService
/**
*
*
*
* @param hwDevice
* @return
*/
@ -56,10 +68,86 @@ public class HwDeviceServiceImpl implements IHwDeviceService
hwDevice.setCreateTime(DateUtils.getNowDate());
return hwDeviceMapper.insertHwDevice(hwDevice);
}
/**
* 3.
* */
@Override
public List<DeviceModeVo> selectDeviceModeNameVo() {
List<DeviceModeVo> list = hwDeviceMapper.selectDeviceModeNameVo();
Integer value = 0;
if (list.size() > 10) {
for (int i = 9; i < list.size(); i++) {
value = value + list.get(i).sum;
}
}
DeviceModeVo hwMonitorUnitTypeVo = new DeviceModeVo();
hwMonitorUnitTypeVo.setMonitorUnitTypeName("其他");
hwMonitorUnitTypeVo.setSum(value);
Integer sums = 0;
for (int i = 0; i < list.size();i++){
sums = sums+list.get(i).sum;
}
for (int i=0;i<list.size();i++){
list.get(i).setPercentage((double) (list.get(i).getSum()/sums));
}
if (list.size() > 10) {
list.add(10, hwMonitorUnitTypeVo);
return list.subList(0, 10);
} else {
return list;
}
}
//获取有开关属性的设备
@Override
public Map<String, Map<String, Object>> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){
List<HwDevice> hwDevices = hwDeviceMapper.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId);//todo 根据监控单元(已解决)
TdSelectDto tdSelectDto = new TdSelectDto();
Map<String, Map<String, Object>> latestDataByTags = new HashMap<String, Map<String,Object>>();
for (int i = 0; i < hwDevices.size(); i++){
String s = hwDeviceMapper.selectDeviceByDeviceModeByDeviceModeFunction(hwDevices.get(i).getDeviceId());
if (s!=null&&s!=""){
tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME);
tdSelectDto.setSuperTableName(TdEngineConstants.DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME);
tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode());
latestDataByTags = (Map<String, Map<String, Object>>) remoteTdEgineService.getLatestDataByTags(tdSelectDto);
}
//todo 根据获取的device通过devicemodeid获取devicemode再根据devicemodeid获取devicemodefunction已解决
// todo 然后根据devicemodefunction中的datatype为8的是bool的(以解决)
}
return latestDataByTags;
}
//查询直采变量属性的设备
@Override
public Map<String, Map<String, Object>> selectDeviceModeFunctionByFunctionType(Long monitorUnitId) {
List<HwDevice> hwDevices = hwDeviceMapper.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId);//todo 根据监控单元(已解决)
TdSelectDto tdSelectDto = new TdSelectDto();
Map<String, Map<String, Object>> latestDataByTags = new HashMap<String, Map<String,Object>>();
for (int i = 0; i < hwDevices.size(); i++){
String s = hwDeviceMapper.selectDeviceModeFunctionByFunctionType(hwDevices.get(i).getDeviceId());
if (s!=null&&s!=""){
tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME);
tdSelectDto.setSuperTableName(TdEngineConstants.DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME);
tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode());
latestDataByTags = (Map<String, Map<String, Object>>) remoteTdEgineService.getLatestDataByTags(tdSelectDto);
}}
return latestDataByTags;
}
@Override
public List<Map<String, Object>> getHistoryData(Long deviceId) {
TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto();
tdHistorySelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME);
tdHistorySelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(deviceId));
tdHistorySelectDto.setOrderByFieldName(tdHistorySelectDto.getFirstFieldName());
tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE);
List<Map<String, Object>> historyData = (List<Map<String, Object>>) remoteTdEgineService.getHistoryData(tdHistorySelectDto);
return historyData;
}
/**
*
*
*
* @param hwDevice
* @return
*/
@ -72,7 +160,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService
/**
*
*
*
* @param deviceIds
* @return
*/
@ -84,7 +172,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService
/**
*
*
*
* @param deviceId
* @return
*/

@ -10,19 +10,19 @@ import com.ruoyi.business.service.IHwElectronicFenceService;
/**
* Service
*
*
* @author xins
* @date 2023-09-04
*/
@Service
public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
{
@Autowired
private HwElectronicFenceMapper hwElectronicFenceMapper;
/**
*
*
*
* @param electronicFenceId
* @return
*/
@ -32,9 +32,14 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
return hwElectronicFenceMapper.selectHwElectronicFenceByElectronicFenceId(electronicFenceId);
}
@Override
public List<HwElectronicFence> selectElectronicByScene(Long sceneId) {
return hwElectronicFenceMapper.selectElectronicByScene(sceneId);
}
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -46,7 +51,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -59,7 +64,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
/**
*
*
*
* @param hwElectronicFence
* @return
*/
@ -72,7 +77,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
/**
*
*
*
* @param electronicFenceIds
* @return
*/
@ -84,7 +89,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
/**
*
*
*
* @param electronicFenceId
* @return
*/

@ -1,7 +1,26 @@
package com.ruoyi.business.service.impl;
import java.util.List;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import com.github.pagehelper.PageHelper;
import com.ruoyi.business.domain.HwDevice;
import com.ruoyi.business.domain.HwElectronicFence;
import com.ruoyi.business.domain.VO.*;
import com.ruoyi.business.mapper.HwDeviceMapper;
import com.ruoyi.business.mapper.HwElectronicFenceMapper;
import com.ruoyi.common.core.constant.TdEngineConstants;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.tdengine.api.RemoteTdEngineService;
import com.ruoyi.tdengine.api.domain.DeviceStatus;
import com.ruoyi.tdengine.api.domain.TdSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.HwMonitorUnitMapper;
@ -10,19 +29,27 @@ import com.ruoyi.business.service.IHwMonitorUnitService;
/**
* Service
*
*
* @author YINQ
* @date 2023-08-31
*/
@Service
public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
{
@Autowired
private HwMonitorUnitMapper hwMonitorUnitMapper;
@Autowired
private HwElectronicFenceMapper hwElectronicFenceMapper;
@Autowired
private RemoteTdEngineService remoteTdEgineService;
@Autowired
private HwDeviceMapper hwDeviceMapper;
/**
*
*
*
* @param monitorUnitId
* @return
*/
@ -31,10 +58,97 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
{
return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId);
}
/**
*
* */
@Override
public List<HwMonitorUnitVo> selectMonitorPercentage() {
List<HwMonitorUnitVo> list = hwMonitorUnitMapper.selectMonitorPercentage();
List<HwMonitorUnitVo> hwScenes = hwMonitorUnitMapper.selectSceneNameById();
int count = hwScenes.size();
if (list.size()<=hwScenes.size()) {
count = list.size();
}
for (int i = 0; i < count; i++) {
for (int j = 0;j<count;j++){
if (list.get(i).getSceneId().equals(hwScenes.get(i).getSceneId())){
list.get(i).setSceneName(hwScenes.get(i).getSceneName());
}
}
}
Integer value = 0;
//
Integer sums = 0;
if (list.size()>5){
for (int i = 4; i < list.size(); i++){
value = value+list.get(i).sum;
}
}
for (int i = 0; i < list.size();i++){
sums = sums+list.get(i).sum;
}
for (int i=0;i<list.size();i++){
list.get(i).setPercentage((double) (list.get(i).getSum()/sums));
}
HwMonitorUnitVo hwMonitorUnitVo = new HwMonitorUnitVo();
hwMonitorUnitVo.setSceneName("其他");
hwMonitorUnitVo.setSum(value);
if (list.size()>5){
list.add(5,hwMonitorUnitVo);
return list.subList(0,5);
}
else {
return list;
}
}
//获取总的设备数量与监控单元数量
@Override
public AllNumsVo selectAllNums() {
//监控单元
String monitor = hwMonitorUnitMapper.selectSubSetNums();
Integer integer = hwMonitorUnitMapper.selectDeviceNums();
AllNumsVo vo = new AllNumsVo();
vo.setSubSum(Integer.valueOf(monitor));
vo.setSum(integer);
return vo;
}
@Override
public List<AllNumsVo> selectSenceAllNums() {
List<AllNumsVo> allNumsVos = hwMonitorUnitMapper.selectAllNums();
List<AllNumsVo> allNums = hwMonitorUnitMapper.selectsum();
for (int i=0;i< allNums.size();i++){
for (int j=0;j< allNums.size();j++){
if (allNums.get(i).getSceneId().equals(allNumsVos.get(i).getSceneId())){
allNums.get(i).setSubSum(allNumsVos.get(i).getSubSum());
}
}
}
return allNums;
}
@Override
public List<HwMonitorUnit> selectLimitSubMonitorUnit() {
List<HwMonitorUnit> hwMonitorUnits = hwMonitorUnitMapper.selectLimitSubMonitorUnit();
return hwMonitorUnits;
}
@Override
public List<AlarmStatsVo> selectAlarmStats() {
return hwMonitorUnitMapper.selectAlarmStats();
}
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
@ -44,9 +158,141 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
return hwMonitorUnitMapper.selectHwMonitorUnitList(hwMonitorUnit);
}
@Override
public SubDeviceSumVo selectSubDeviceSum(Long sceneId) {
int SubSum = hwMonitorUnitMapper.selectSubDeviceSum(sceneId);
List<HwDevice> hwDevices = hwDeviceMapper.selectDeviceNum(sceneId);
int onlineDevice = 0;
for (int i = 0;i<hwDevices.size();i++){
if (hwDevices.get(i).getActiveStatus().equals("1")&&hwDevices.get(i).getDeviceStatus().equals("1")){
onlineDevice = onlineDevice+1;
}
}
SubDeviceSumVo subDeviceSumVo = new SubDeviceSumVo();
subDeviceSumVo.setSubSum(String.valueOf(SubSum));
subDeviceSumVo.setDeviceNum(String.valueOf(hwDevices.size()));
subDeviceSumVo.setOnlineDeviceNum(String.valueOf(onlineDevice));
return subDeviceSumVo;
}
//todo 电子围栏
@Override
public Integer selectElectronicNum(Long sceneId) {
List<Long> longs = hwMonitorUnitMapper.selectEleInScene(sceneId);
return null;
}
@Override
public HwMonitorUnit selectHwmonitorUnitSub(Long monitorUnitId) {
return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId);
}
@Override
// 加一个begintime参数endtime参数 stream时间戳 从开始时间0点开始结束时间23.59.59结束
public int selectTdengine(String beginTime,String endTime,Long sceneId) {
DeviceStatus queryDeviceStatus = new DeviceStatus();
Map<String, Object> params = queryDeviceStatus.getParams();
DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA);
LocalDate parse = LocalDate.parse(beginTime, ofPattern);
long begintime = parse.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli();
DateTimeFormatter ofPattern1 = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA);
LocalDate parse1 = LocalDate.parse(endTime, ofPattern);
long endtime = LocalDateTime.of(parse1, LocalTime.MAX).toInstant(ZoneOffset.of("+8")).toEpochMilli();
params.put("beginTime",begintime);
params.put("endTime", endtime);
queryDeviceStatus.setParams(params);
if (sceneId != null) {
queryDeviceStatus.setSceneId(sceneId);
}
int value = 0;
int sum = 0;
//todo 使用id(以解决)
//map key时间戳value List<DeviceStatus> 对象
List<DeviceStatus> list = (List<DeviceStatus>) remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus);
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getDeviceType()==1) {
sum =sum+ hwMonitorUnitMapper.selectReleatedDeviceIdNums(list.get(i).getDeviceId());
}
else {
value++;
}
value = value+sum;
}
return value;
//设备类型==网关 根据releated_device_id = 网关设备设备id查询个数
//网关子设备数+非网关设备数getDeviceType()=1
}
// @Override
// public List<Map<String, Object>> selectLatestDataByTags(Long monitorUnitId) {
// List<Map<String, Object>> latestData = new ArrayList<Map<String, Object>>;
// List<HwDevice> 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<Map<String, Object>>) remoteTdEgineService.getLatestData(tdSelectDto);
// }
// return latestData;
// }
//todo SysDeptServiceImpl类中的递归方法recursionFn(以实现)
@Override
public List<HwMonitorUnit> selectTreeList(List<HwMonitorUnit> hwMonitorUnits) {
List<HwMonitorUnit> returnList = new ArrayList<>();
List<Long> tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList());
for (HwMonitorUnit hwMonitorUnit:hwMonitorUnits){
if (!tempList.contains(hwMonitorUnit.getParentId()))
recursionFn(hwMonitorUnits,hwMonitorUnit);
returnList.add(hwMonitorUnit);
}
return returnList;
}
private void recursionFn(List<HwMonitorUnit> list, HwMonitorUnit t)
{
// 得到子节点列表
List<HwMonitorUnit> childList = getChildList(list, t);
t.setChild(childList);
for (HwMonitorUnit tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
private List<HwMonitorUnit> getChildList(List<HwMonitorUnit> list, HwMonitorUnit t)
{
List<HwMonitorUnit> tlist = new ArrayList<HwMonitorUnit>();
Iterator<HwMonitorUnit> it = list.iterator();
while (it.hasNext())
{
HwMonitorUnit n = (HwMonitorUnit) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getMonitorUnitId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
private boolean hasChild(List<HwMonitorUnit> list, HwMonitorUnit t)
{
return getChildList(list, t).size() > 0 ? true : false;
}
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
@ -59,7 +305,7 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
/**
*
*
*
* @param hwMonitorUnit
* @return
*/
@ -72,7 +318,7 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
/**
*
*
*
* @param monitorUnitIds
* @return
*/
@ -84,7 +330,7 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
/**
*
*
*
* @param monitorUnitId
* @return
*/
@ -94,3 +340,23 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
return hwMonitorUnitMapper.deleteHwMonitorUnitByMonitorUnitId(monitorUnitId);
}
}
//remoteTdEngineSevice.getOnlineDevicesGroupByDay方法获取
// 参数实例:
// // params.put("beginTime", beginTime);
//// params.put("endTime", endTime);
//// queryDeviceStatus.setParams(params);
//// if (sceneId != null) {
//// queryDeviceStatus.setSceneId(sceneId);
//// }
//
// 这是IDEA参数传的参数Content-Type: application/json
// {
// "params": { "beginTime":1666666666666,"endTime":1766666666666 }
//
// }
//
// 如果在IDEA测试可以{
// "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1",
// "beginTime":1666666666666,"endTime":1766666666666 }
// }

@ -1,6 +1,8 @@
package com.ruoyi.business.service.impl;
import java.util.List;
import com.ruoyi.business.domain.VO.HwMonitorUnitVo;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -10,19 +12,19 @@ import com.ruoyi.business.service.IHwMonitorUnitTypeService;
/**
* Service
*
*
* @author YINQ
* @date 2023-08-31
*/
@Service
public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
{
@Autowired
private HwMonitorUnitTypeMapper hwMonitorUnitTypeMapper;
/**
*
*
*
* @param monitorUnitTypeId
* @return
*/
@ -34,7 +36,7 @@ public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
@ -44,9 +46,10 @@ public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
return hwMonitorUnitTypeMapper.selectHwMonitorUnitTypeList(hwMonitorUnitType);
}
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
@ -59,7 +62,7 @@ public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
/**
*
*
*
* @param hwMonitorUnitType
* @return
*/
@ -72,7 +75,7 @@ public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
/**
*
*
*
* @param monitorUnitTypeIds
* @return
*/
@ -84,7 +87,7 @@ public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
/**
*
*
*
* @param monitorUnitTypeId
* @return
*/

@ -10,19 +10,19 @@ import com.ruoyi.business.service.IHwSceneService;
/**
* Service
*
*
* @author xins
* @date 2023-08-23
*/
@Service
public class HwSceneServiceImpl implements IHwSceneService
public class HwSceneServiceImpl implements IHwSceneService
{
@Autowired
private HwSceneMapper hwSceneMapper;
/**
*
*
*
* @param sceneId
* @return
*/
@ -32,9 +32,18 @@ public class HwSceneServiceImpl implements IHwSceneService
return hwSceneMapper.selectHwSceneBySceneId(sceneId);
}
@Override
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId) {
List<HwScene> hwScenes = hwSceneMapper.selectHwSceneBySceneModeId(sceneModeId);
return hwScenes;
}
/**
*
*
*
* @param hwScene
* @return
*/
@ -46,7 +55,7 @@ public class HwSceneServiceImpl implements IHwSceneService
/**
*
*
*
* @param hwScene
* @return
*/
@ -59,7 +68,7 @@ public class HwSceneServiceImpl implements IHwSceneService
/**
*
*
*
* @param hwScene
* @return
*/
@ -72,7 +81,7 @@ public class HwSceneServiceImpl implements IHwSceneService
/**
*
*
*
* @param sceneIds
* @return
*/
@ -84,7 +93,7 @@ public class HwSceneServiceImpl implements IHwSceneService
/**
*
*
*
* @param sceneId
* @return
*/

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.HwDeviceMapper">
<resultMap type="HwDevice" id="HwDeviceResult">
<result property="deviceId" column="device_id" />
<result property="deviceCode" column="device_code" />
@ -34,13 +34,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceField" column="device_field" />
</resultMap>
<resultMap id="DeviceModeVoResult" type="com.ruoyi.business.domain.VO.DeviceModeVo" >
<result property="deviceModeName" column="device_mode_name"/>
<result property="sum" column="sum"/>
<result property="err" column="err"/>
</resultMap>
<sql id="selectHwDeviceVo">
select device_id, device_code, device_name, scene_id, monitor_unit_id, device_type, networking_mode, access_protocol, data_format, releated_device_id, device_mode_id, access_gw_protocol, active_status, device_status, active_time, device_pic, ip_address, area_id, device_location, current_module_version, current_singlechip_version, remark, create_by, create_time, update_by, update_time, device_field from hw_device
</sql>
<select id="selectDeviceModeNameVo" resultMap="DeviceModeVoResult">
SELECT b.device_mode_name ,a.sum FROM hw_device_mode b
LEFT JOIN (SELECT device_mode_id,count(*) as sum FROM hw_device GROUP BY device_mode_id order by sum desc
) a on a.device_mode_id = b.device_mode_id
</select>
<select id="selectDeviceByDeviceModeByDeviceModeFunction" parameterType="Long" resultType="String">
select count(*) from hw_device_mode_function where device_mode_id =
(SELECT device_mode_id from hw_device where device_id = #{deviceId}) and function_type = '1'
</select>
<select id="selectDeviceModeFunctionByFunctionType" parameterType="Long" resultType="String">
</select>
<select id="selectDeviceNum" parameterType="Long" resultMap="HwDeviceResult" >
<include refid="selectHwDeviceVo"/>
where scene_id = #{sceneId}
</select>
<select id="selectDeviceByMonitorId" parameterType="Long" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
from hw_device where monitor_unit_id = #{monitorUnitId}
</select>
<select id="selectDeviceByDeviceModeBySceneId" parameterType="Long" resultMap="HwDeviceResult">
select * from hw_device where device_mode_id = (
SELECT device_mode_id from hw_device_mode where scene_id = #{sceneId} )
</select>
<select id="selectDeviceByDeviceModeByMonitorUnitId" parameterType="Long" resultMap="HwDeviceResult">
select * from hw_device where device_mode_id = (
SELECT device_mode_id from hw_device_mode where monitor_unit_id = #{monitorUnitId} )
</select>
<select id="selectHwDeviceList" parameterType="HwDevice" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
<where>
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
@ -64,12 +98,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deviceField != null and deviceField != ''"> and device_field = #{deviceField}</if>
</where>
</select>
<select id="selectHwDeviceByDeviceId" parameterType="Long" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
where device_id = #{deviceId}
</select>
<insert id="insertHwDevice" parameterType="HwDevice" useGeneratedKeys="true" keyProperty="deviceId">
insert into hw_device
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -168,9 +202,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteHwDeviceByDeviceIds" parameterType="String">
delete from hw_device where device_id in
delete from hw_device where device_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
#{deviceId}
</foreach>
</delete>
</mapper>
</mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.HwElectronicFenceMapper">
<resultMap type="HwElectronicFence" id="HwElectronicFenceResult">
<result property="electronicFenceId" column="electronic_fence_id" />
<result property="electronicFenceName" column="electronic_fence_name" />
@ -29,10 +29,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectHwElectronicFenceVo">
select electronic_fence_id, electronic_fence_name, scene_id, fence_type, effective_time_flag, time_zone, effective_time, trigger_status, area_shape_flag, area_range, fence_push_flag, fence_push_content, fence_recover_content, remark, create_by, create_time, update_by, update_time, fence_field from hw_electronic_fence
</sql>
<!-- 根据场景查询电子围栏信息-->
<select id="selectElectronicByScene" resultMap="HwElectronicFenceResult">
<include refid="selectHwElectronicFenceVo"/>
<where>
<if test="sceneId !=null and sceneId !=''">and scene_id = #{sceneId}</if>
</where>
</select>
<select id="selectHwElectronicFenceList" parameterType="HwElectronicFence" resultMap="HwElectronicFenceResult">
<include refid="selectHwElectronicFenceVo"/>
<where>
<where>
<if test="electronicFenceName != null and electronicFenceName != ''"> and electronic_fence_name like concat('%', #{electronicFenceName}, '%')</if>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
<if test="fenceType != null and fenceType != ''"> and fence_type = #{fenceType}</if>
@ -48,12 +55,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fenceField != null and fenceField != ''"> and fence_field = #{fenceField}</if>
</where>
</select>
<select id="selectHwElectronicFenceByElectronicFenceId" parameterType="Long" resultMap="HwElectronicFenceResult">
<include refid="selectHwElectronicFenceVo"/>
where electronic_fence_id = #{electronicFenceId}
</select>
<insert id="insertHwElectronicFence" parameterType="HwElectronicFence" useGeneratedKeys="true" keyProperty="electronicFenceId">
insert into hw_electronic_fence
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -128,9 +135,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteHwElectronicFenceByElectronicFenceIds" parameterType="String">
delete from hw_electronic_fence where electronic_fence_id in
delete from hw_electronic_fence where electronic_fence_id in
<foreach item="electronicFenceId" collection="array" open="(" separator="," close=")">
#{electronicFenceId}
</foreach>
</delete>
</mapper>
</mapper>

@ -3,7 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.HwMonitorUnitMapper">
<resultMap type="HwMonitorUnit" id="HwMonitorUnitResult">
<result property="monitorUnitId" column="monitor_unit_id" />
<result property="monitorUnitName" column="monitor_unit_name" />
@ -22,14 +21,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="monitorUnitField" column="monitor_unit_field" />
</resultMap>
<resultMap type="HwMonitorUnitVo" id="HwMonitorUnitVoResult" >
<result property="sceneName" column="scene_name"/>
<result property="sceneId" column="scene_id"/>
<result property="sum" column="sum"/>
<result property="err" column="err"/>
</resultMap>
<resultMap type="AllNumsVo" id="AllNumsVoResult">
<result property="sceneId" column="scene_id"/>
<result property="subSum" column="sub_sum"/>
<result property="sum" column="sum"/>
</resultMap>
<resultMap type="AlarmStatsVo" id="AlarmStatsResult" >
<result property="monitorUnitId" column="monitor_unit_id"/>
<result property="monitorUnitName" column="monitor_unit_name"/>
<result property="sum" column="sum"/>
</resultMap>
<resultMap type="SubDeviceSumVo" id="SubDeviceSumVoResult">
<result property="SubSum" column="sub_sum"/>
<result property="DeviceNum" column="device_num"/>
<result property="OnlineDeviceNum" column="online_device_num"/>
</resultMap>
<resultMap type="com.ruoyi.business.domain.VO.ElectronicNumVo" id="ElectronicNumVoResult">
<result property="electronicFenceId" column="electronic_fence_id"/>
<result property="electronicFenceName" column="electronic_fence_name"/>
<result property="areaShapeFlag" column="area_shape_flag"/>
<result property="areaRange" column="area_range"/>
<result property="fenceType" column="fence_type"/>
<result property="num" column="num"/>
<result property="alarmNum" column="alarm_num"/>
</resultMap>
<resultMap id="MonitorUnitNumVoResult" type="MonitorUnitNumVo">
<result property="monitorUnitId" column="monitor_unit_id"/>
<result property="num" column="num"/>
</resultMap>
<sql id="selectHwMonitorUnitVo">
select monitor_unit_id, monitor_unit_name, scene_id, parent_id, monitor_unit_type_id, area_id, monitor_address, monitor_pic, preserve_time, remark, monitor_unit_status, create_by, create_time, update_by, update_time, monitor_unit_field from hw_monitor_unit
</sql>
<select id="selectHaveEleDevice" parameterType="Long" resultMap="MonitorUnitNumVoResult">
SELECT monitor_unit_id,count(*) as num from hw_device where monitor_unit_id
= (select monitor_unit_id from hw_monitor_unit where monitor_unit_id =
(select target_id from hw_fence_target where target_type = '2'and
electronic_fence_id = (select electronic_fence_id from hw_electronic_fence
where scene_id = #{sceneId}) )) GROUP BY monitor_unit_id
</select>
<select id="selectMonitorUnitHaveEle" parameterType="Long" resultMap="MonitorUnitNumVoResult">
select monitor_unit_id,count(*) as num from hw_device where
monitor_unit_id = (select target_id from hw_fence_target where
target_type = '2'and electronic_fence_id =
(select electronic_fence_id from hw_electronic_fence where scene_id = #{sceneId}) )
GROUP BY monitor_unit_id
</select>
<select id="selectHwMonitorUnitList" parameterType="HwMonitorUnit" resultMap="HwMonitorUnitResult">
<include refid="selectHwMonitorUnitVo"/>
<where>
<where>
<if test="monitorUnitName != null and monitorUnitName != ''"> and monitor_unit_name like concat('%', #{monitorUnitName}, '%')</if>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
@ -42,12 +88,99 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="monitorUnitField != null and monitorUnitField != ''"> and monitor_unit_field = #{monitorUnitField}</if>
</where>
</select>
<select id="selectHwMonitorUnitByMonitorUnitId" parameterType="Long" resultMap="HwMonitorUnitResult">
<include refid="selectHwMonitorUnitVo"/>
where monitor_unit_id = #{monitorUnitId}
</select>
<!--查询最子集监控单元以场景进行分组-->
<select id="selectAllNums" resultMap="AllNumsVoResult">
select scene_id,count(*) as sub_sum from
(select monitor_unit_id,scene_id from hw_monitor_unit
where monitor_unit_id not in (select parent_id from hw_monitor_unit))as temp
GROUP BY scene_id
</select>
<select id="selectSubSetNums" resultType="String">
select count(*)from hw_monitor_unit
where monitor_unit_id not in (select parent_id from hw_monitor_unit)
</select>
<select id="selectDeviceNums" resultType="String">
select count(*) as sum from hw_device
where device_status = '1'
</select>
<!-- 通过场景分组,查询设备数量 todo 已解决 -->
<select id="selectsum" resultMap="AllNumsVoResult">
select scene_id,count(*) as sum from hw_device
where device_status = '1'GROUP BY scene_id
</select>
<!-- 通过id查询子集并返回-->
<select id="selectHwMonitorUnitByParent" parameterType="Long" resultMap="HwMonitorUnitResult">
<include refid="selectHwMonitorUnitVo"/>
where parent_id = #{monitorUnitId}
</select>
<select id="selectReleatedDeviceIdNums" parameterType="Long" resultType="Integer">
select count(*) from hw_device where device_id = #{deviceId}
</select>
<!-- 查询该监控单元是否为最小单元-->
<select id="selectHwMonitorUnitIsParent" parameterType="Long" resultType="String">
SELECT count(*) from hw_monitor_unit where parent_id = #{monitorUnitId} GROUP BY parent_id
</select>
<!-- todo 查询最小单元详细信息根据主键 byid 已解决-->
<select id="selectHwmonitorUnitSub" resultType="Long" resultMap="HwMonitorUnitResult">
<include refid="selectHwMonitorUnitVo"/>
where monitor_unit_id = #{monitorUnitId}
</select>
<!--查询id与name的结果集通过id与selectMonitorPercentage相连-->
<select id="selectSceneNameById" resultMap="HwMonitorUnitVoResult">
select scene_id,scene_name from hw_scene
</select>
<!-- 分页查询在impl实现分页-->
<select id="selectLimitSubMonitorUnit" resultMap="HwMonitorUnitResult">
select * from hw_monitor_unit where monitor_unit_id
not in (select parent_id from hw_monitor_unit)
</select>
<!-- 查询最子集监控单元使用sceneid进行分组-->
<select id="selectMonitorPercentage" resultMap="HwMonitorUnitVoResult">
select scene_id,count(*) as sum from (select monitor_unit_id,scene_id
from hw_monitor_unit where monitor_unit_id not in
(select parent_id from hw_monitor_unit))as temp
GROUP BY scene_id order by sum desc
</select>
<!-- 先通过报警信息表查询报警的监控单元id与数量在查询监控单元的名字-->
<select id="selectAlarmStats" resultMap="AlarmStatsResult">
select b.monitor_unit_id,b.monitor_unit_name,sum from
(select monitor_unit_id,count(*)as sum from hw_alarm_info GROUP BY monitor_unit_id
)as a left join hw_monitor_unit b on a.monitor_unit_id = b.monitor_unit_id order BY sum
</select>
<!-- sub_sum 最子集监控单元数量device_num 设备数量 online_device_num在线设备数量 todo 传一个sceneid 监控单元和设备数量拆开查询 设备拿全部在后端判断 orderby 主键 -->
<select id="selectSubDeviceSum" parameterType="Long" resultType="Integer">
select count(*) from (select monitor_unit_id,scene_id
from hw_monitor_unit where monitor_unit_id not in
(select parent_id from hw_monitor_unit))as temp where scene_id = #{sceneId}
</select>
<!-- 先查询监控单元/设备的总量与报警未处理数量再通过场景id与电子围栏相连接-->
<select id="selectElectronicNum" resultMap="ElectronicNumVoResult">
select a.electronic_fence_id,a.electronic_fence_name,a.area_shape_flag,a.area_range,a.fence_type,b.num,b.alarm_num
from hw_electronic_fence as a left join ( select scene_id,count(*)as num,count(case when handle_status = '0' then 1 end ) as alarm_num from hw_alarm_info GROUP BY scene_id) as b on a.scene_id = b.scene_id
</select>
<select id="selectEleInScene" parameterType="Long" resultType="List">
select electronic_fence_id from hw_electronic_fence where scene_id = #{sceneId}
</select>
<select id="selectEleType2" parameterType="Long" resultType="String">
select count(*) from hw_device where monitor_unit_id = (select target_id from hw_fence_target where target_type='2' and electronic_fence_id = #{electronicFenceId})
</select>
<select id="selectEleType3" parameterType="Long" resultType="String">
select count(*) from hw_device where scene_id = #{sceneId}
</select>
<select id="selectDeviceType2Nums" parameterType="Long" resultType="Integer">
select count(*) from hw_device
where scene_id = #{sceneId}and device_type = '2' GROUP BY device_id
</select>
<insert id="insertHwMonitorUnit" parameterType="HwMonitorUnit" useGeneratedKeys="true" keyProperty="monitorUnitId">
insert into hw_monitor_unit
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -113,9 +246,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteHwMonitorUnitByMonitorUnitIds" parameterType="String">
delete from hw_monitor_unit where monitor_unit_id in
delete from hw_monitor_unit where monitor_unit_id in
<foreach item="monitorUnitId" collection="array" open="(" separator="," close=")">
#{monitorUnitId}
</foreach>
</delete>
</mapper>
</mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.HwMonitorUnitTypeMapper">
<resultMap type="HwMonitorUnitType" id="HwMonitorUnitTypeResult">
<result property="monitorUnitTypeId" column="monitor_unit_type_id" />
<result property="monitorUnitTypeName" column="monitor_unit_type_name" />
@ -25,9 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select monitor_unit_type_id, monitor_unit_type_name, vitual_flag, monitor_unit_type_status, language_code, common_flag, scene_id, remark, create_by, create_time, update_by, update_time, unit_type_icon, unit_type_field from hw_monitor_unit_type
</sql>
<select id="selectHwMonitorUnitTypeByMonitorUnitTypeId" parameterType="Long" resultMap="HwMonitorUnitTypeResult">
<include refid="selectHwMonitorUnitTypeVo"/>
where monitor_unit_type_id = #{monitorUnitTypeId}
</select>
<select id="selectHwMonitorUnitTypeList" parameterType="HwMonitorUnitType" resultMap="HwMonitorUnitTypeResult">
<include refid="selectHwMonitorUnitTypeVo"/>
<where>
<where>
<if test="monitorUnitTypeName != null and monitorUnitTypeName != ''"> and monitor_unit_type_name like concat('%', #{monitorUnitTypeName}, '%')</if>
<if test="vitualFlag != null and vitualFlag != ''"> and vitual_flag = #{vitualFlag}</if>
<if test="monitorUnitTypeStatus != null and monitorUnitTypeStatus != ''"> and monitor_unit_type_status = #{monitorUnitTypeStatus}</if>
@ -38,12 +42,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unitTypeField != null and unitTypeField != ''"> and unit_type_field = #{unitTypeField}</if>
</where>
</select>
<select id="selectHwMonitorUnitTypeByMonitorUnitTypeId" parameterType="Long" resultMap="HwMonitorUnitTypeResult">
<include refid="selectHwMonitorUnitTypeVo"/>
where monitor_unit_type_id = #{monitorUnitTypeId}
</select>
<insert id="insertHwMonitorUnitType" parameterType="HwMonitorUnitType" useGeneratedKeys="true" keyProperty="monitorUnitTypeId">
insert into hw_monitor_unit_type
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -103,9 +106,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteHwMonitorUnitTypeByMonitorUnitTypeIds" parameterType="String">
delete from hw_monitor_unit_type where monitor_unit_type_id in
delete from hw_monitor_unit_type where monitor_unit_type_id in
<foreach item="monitorUnitTypeId" collection="array" open="(" separator="," close=")">
#{monitorUnitTypeId}
</foreach>
</delete>
</mapper>
</mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.HwSceneMapper">
<resultMap type="HwScene" id="HwSceneResult">
<result property="sceneId" column="scene_id" />
<result property="sceneName" column="scene_name" />
@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwSceneList" parameterType="HwScene" resultMap="HwSceneResult">
<include refid="selectHwSceneVo"/>
<where>
<where>
<if test="sceneName != null and sceneName != ''"> and scene_name like concat('%', #{sceneName}, '%')</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="sceneModeId != null "> and scene_mode_id = #{sceneModeId}</if>
@ -50,12 +50,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sceneField != null and sceneField != ''"> and scene_field = #{sceneField}</if>
</where>
</select>
<select id="selectHwSceneBySceneId" parameterType="Long" resultMap="HwSceneResult">
<include refid="selectHwSceneVo"/>
where scene_id = #{sceneId}
</select>
<select id="selectHwSceneBySceneModeId" parameterType="Long" resultMap="HwSceneResult">
select * from hw_scene_mode where scene_mode_id = #{SceneModeId}
</select>
<insert id="insertHwScene" parameterType="HwScene" useGeneratedKeys="true" keyProperty="sceneId">
insert into hw_scene
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -133,9 +135,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteHwSceneBySceneIds" parameterType="String">
delete from hw_scene where scene_id in
delete from hw_scene where scene_id in
<foreach item="sceneId" collection="array" open="(" separator="," close=")">
#{sceneId}
</foreach>
</delete>
</mapper>
</mapper>

Loading…
Cancel
Save