监控单元模块 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>

@ -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;
@ -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;
@ -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;
@ -47,6 +47,7 @@ public class HwMonitorUnitTypeController extends BaseController
return getDataTable(list);
}
/**
*
*/

@ -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;
@ -58,6 +61,15 @@ 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)
{

@ -2,6 +2,8 @@ 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
@ -18,7 +20,12 @@ public interface HwDeviceMapper
* @return
*/
public HwDevice selectHwDeviceByDeviceId(Long deviceId);
List<HwDevice> selectDeviceByMonitorId(Long monitorUnitId);
/**
* 3.
* */
public List<DeviceModeVo> selectDeviceModeNameVo();
/**
*
*
@ -27,6 +34,12 @@ public interface HwDeviceMapper
*/
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);
/**
*
*

@ -19,6 +19,10 @@ public interface HwElectronicFenceMapper
*/
public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId);
/**
*
* */
public List<HwElectronicFence> selectElectronicByScene(Long sceneId);
/**
*
*

@ -1,7 +1,11 @@
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
@ -18,6 +22,45 @@ public interface HwMonitorUnitMapper
* @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);
/**
*
@ -26,7 +69,18 @@ public interface HwMonitorUnitMapper
* @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);
/**
*
*

@ -2,6 +2,7 @@ package com.ruoyi.business.mapper;
import java.util.List;
import com.ruoyi.business.domain.HwMonitorUnitType;
import com.ruoyi.business.domain.VO.DeviceModeVo;
/**
* Mapper
@ -27,6 +28,9 @@ public interface HwMonitorUnitTypeMapper
*/
public List<HwMonitorUnitType> selectHwMonitorUnitTypeList(HwMonitorUnitType hwMonitorUnitType);
/**
*
*

@ -18,6 +18,8 @@ public interface HwSceneMapper
* @return
*/
public HwScene selectHwSceneBySceneId(Long sceneId);
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId);
/**
*

@ -1,7 +1,12 @@
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
@ -19,6 +24,15 @@ public interface IHwDeviceService
*/
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);
/**
*
*

@ -18,7 +18,10 @@ public interface IHwElectronicFenceService
* @return
*/
public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId);
/**
*
* */
public List<HwElectronicFence> selectElectronicByScene(Long sceneId);
/**
*
*

@ -1,7 +1,11 @@
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
@ -18,7 +22,27 @@ public interface IHwMonitorUnitService
* @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();
/**
*
*
@ -27,6 +51,34 @@ public interface IHwMonitorUnitService
*/
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);
/**
*
*

@ -19,6 +19,7 @@ public interface IHwMonitorUnitTypeService
*/
public HwMonitorUnitType selectHwMonitorUnitTypeByMonitorUnitTypeId(Long monitorUnitTypeId);
/**
*
*
@ -27,6 +28,9 @@ public interface IHwMonitorUnitTypeService
*/
public List<HwMonitorUnitType> selectHwMonitorUnitTypeList(HwMonitorUnitType hwMonitorUnitType);
/**
*
*

@ -19,6 +19,8 @@ public interface IHwSceneService
*/
public HwScene selectHwSceneBySceneId(Long sceneId);
//选择场景
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId);
/**
*
*

@ -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;
@ -19,6 +29,8 @@ public class HwDeviceServiceImpl implements IHwDeviceService
{
@Autowired
private HwDeviceMapper hwDeviceMapper;
@Autowired
private RemoteTdEngineService remoteTdEgineService;
/**
*
@ -56,6 +68,82 @@ 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;
}
/**
*

@ -32,6 +32,11 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService
return hwElectronicFenceMapper.selectHwElectronicFenceByElectronicFenceId(electronicFenceId);
}
@Override
public List<HwElectronicFence> selectElectronicByScene(Long sceneId) {
return hwElectronicFenceMapper.selectElectronicByScene(sceneId);
}
/**
*
*

@ -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;
@ -19,6 +38,14 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
{
@Autowired
private HwMonitorUnitMapper hwMonitorUnitMapper;
@Autowired
private HwElectronicFenceMapper hwElectronicFenceMapper;
@Autowired
private RemoteTdEngineService remoteTdEgineService;
@Autowired
private HwDeviceMapper hwDeviceMapper;
/**
*
@ -31,6 +58,93 @@ 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();
}
/**
*
@ -44,6 +158,138 @@ 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;
}
/**
*
*
@ -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;
@ -44,6 +46,7 @@ public class HwMonitorUnitTypeServiceImpl implements IHwMonitorUnitTypeService
return hwMonitorUnitTypeMapper.selectHwMonitorUnitTypeList(hwMonitorUnitType);
}
/**
*
*

@ -32,6 +32,15 @@ public class HwSceneServiceImpl implements IHwSceneService
return hwSceneMapper.selectHwSceneBySceneId(sceneId);
}
@Override
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId) {
List<HwScene> hwScenes = hwSceneMapper.selectHwSceneBySceneModeId(sceneModeId);
return hwScenes;
}
/**
*
*

@ -34,10 +34,44 @@ 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>

@ -29,6 +29,13 @@ 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"/>

@ -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,11 +21,58 @@ 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>
@ -47,7 +93,94 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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=",">

@ -25,6 +25,10 @@ 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>
@ -39,10 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</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

@ -55,7 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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=",">

Loading…
Cancel
Save