parent
d7b20bc371
commit
d75aa67860
@ -0,0 +1,39 @@
|
||||
package com.ruoyi.business.domain.VO;
|
||||
|
||||
/**
|
||||
* @Description: 报警信息VO
|
||||
* @ClassName: AlarmTypeVo
|
||||
* @Author : xins
|
||||
* @Date :2023-09-15 13:10
|
||||
* @Version :1.0
|
||||
*/
|
||||
public class AlarmTypeVo {
|
||||
|
||||
private Long alarmTypeId;
|
||||
private String alarmTypeName;
|
||||
private Integer alarmCount;
|
||||
|
||||
public Long getAlarmTypeId() {
|
||||
return alarmTypeId;
|
||||
}
|
||||
|
||||
public void setAlarmTypeId(Long alarmTypeId) {
|
||||
this.alarmTypeId = alarmTypeId;
|
||||
}
|
||||
|
||||
public String getAlarmTypeName() {
|
||||
return alarmTypeName;
|
||||
}
|
||||
|
||||
public void setAlarmTypeName(String alarmTypeName) {
|
||||
this.alarmTypeName = alarmTypeName;
|
||||
}
|
||||
|
||||
public Integer getAlarmCount() {
|
||||
return alarmCount;
|
||||
}
|
||||
|
||||
public void setAlarmCount(Integer alarmCount) {
|
||||
this.alarmCount = alarmCount;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.business.domain.VO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 设备数据动态字段实体对象
|
||||
* @ClassName: DeviceDataColumnVo
|
||||
* @Author : xins
|
||||
* @Date :2023-09-16 16:20
|
||||
* @Version :1.0
|
||||
*/
|
||||
@Data
|
||||
public class DeviceDataColumnVo {
|
||||
|
||||
private String columnName;
|
||||
|
||||
private String columnKey;
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.ruoyi.business.domain.VO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.ruoyi.business.domain.HwMonitorUnit;
|
||||
|
||||
|
||||
/**
|
||||
* Treeselect树结构实体类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class TreeSelectVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeSelectVo> children;
|
||||
|
||||
public TreeSelectVo() {
|
||||
|
||||
}
|
||||
|
||||
public TreeSelectVo(HwMonitorUnit monitorUnit) {
|
||||
this.id = monitorUnit.getMonitorUnitId();
|
||||
this.label = monitorUnit.getMonitorUnitName();
|
||||
// this.children = monitorUnit.getChildren().stream().map(TreeSelectVo::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public List<TreeSelectVo> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<TreeSelectVo> children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
package com.ruoyi.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.HwAlarmInfo;
|
||||
import com.ruoyi.business.domain.VO.AlarmTypeVo;
|
||||
|
||||
/**
|
||||
* 报警信息Mapper接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2023-09-15
|
||||
*/
|
||||
public interface HwAlarmInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询报警信息
|
||||
*
|
||||
* @param alarmInfoId 报警信息主键
|
||||
* @return 报警信息
|
||||
*/
|
||||
public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId);
|
||||
|
||||
/**
|
||||
* 查询报警信息列表
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 报警信息集合
|
||||
*/
|
||||
public List<HwAlarmInfo> selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo);
|
||||
|
||||
/**
|
||||
* 新增报警信息
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo);
|
||||
|
||||
/**
|
||||
* 修改报警信息
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo);
|
||||
|
||||
/**
|
||||
* 删除报警信息
|
||||
*
|
||||
* @param alarmInfoId 报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId);
|
||||
|
||||
/**
|
||||
* 批量删除报警信息
|
||||
*
|
||||
* @param alarmInfoIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds);
|
||||
|
||||
|
||||
public List<AlarmTypeVo> selectAlarmsByAlarmType(Long sceneId);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.HwAlarmLevel;
|
||||
|
||||
/**
|
||||
* 报警级别Mapper接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2023-09-15
|
||||
*/
|
||||
public interface HwAlarmLevelMapper
|
||||
{
|
||||
/**
|
||||
* 查询报警级别
|
||||
*
|
||||
* @param alarmLevelId 报警级别主键
|
||||
* @return 报警级别
|
||||
*/
|
||||
public HwAlarmLevel selectHwAlarmLevelByAlarmLevelId(Long alarmLevelId);
|
||||
|
||||
/**
|
||||
* 查询报警级别列表
|
||||
*
|
||||
* @param hwAlarmLevel 报警级别
|
||||
* @return 报警级别集合
|
||||
*/
|
||||
public List<HwAlarmLevel> selectHwAlarmLevelList(HwAlarmLevel hwAlarmLevel);
|
||||
|
||||
/**
|
||||
* 新增报警级别
|
||||
*
|
||||
* @param hwAlarmLevel 报警级别
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertHwAlarmLevel(HwAlarmLevel hwAlarmLevel);
|
||||
|
||||
/**
|
||||
* 修改报警级别
|
||||
*
|
||||
* @param hwAlarmLevel 报警级别
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateHwAlarmLevel(HwAlarmLevel hwAlarmLevel);
|
||||
|
||||
/**
|
||||
* 删除报警级别
|
||||
*
|
||||
* @param alarmLevelId 报警级别主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmLevelByAlarmLevelId(Long alarmLevelId);
|
||||
|
||||
/**
|
||||
* 批量删除报警级别
|
||||
*
|
||||
* @param alarmLevelIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmLevelByAlarmLevelIds(Long[] alarmLevelIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.HwAlarmType;
|
||||
|
||||
/**
|
||||
* 报警类型Mapper接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2023-09-15
|
||||
*/
|
||||
public interface HwAlarmTypeMapper
|
||||
{
|
||||
/**
|
||||
* 查询报警类型
|
||||
*
|
||||
* @param alarmTypeId 报警类型主键
|
||||
* @return 报警类型
|
||||
*/
|
||||
public HwAlarmType selectHwAlarmTypeByAlarmTypeId(Long alarmTypeId);
|
||||
|
||||
/**
|
||||
* 查询报警类型列表
|
||||
*
|
||||
* @param hwAlarmType 报警类型
|
||||
* @return 报警类型集合
|
||||
*/
|
||||
public List<HwAlarmType> selectHwAlarmTypeList(HwAlarmType hwAlarmType);
|
||||
|
||||
/**
|
||||
* 新增报警类型
|
||||
*
|
||||
* @param hwAlarmType 报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertHwAlarmType(HwAlarmType hwAlarmType);
|
||||
|
||||
/**
|
||||
* 修改报警类型
|
||||
*
|
||||
* @param hwAlarmType 报警类型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateHwAlarmType(HwAlarmType hwAlarmType);
|
||||
|
||||
/**
|
||||
* 删除报警类型
|
||||
*
|
||||
* @param alarmTypeId 报警类型主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmTypeByAlarmTypeId(Long alarmTypeId);
|
||||
|
||||
/**
|
||||
* 批量删除报警类型
|
||||
*
|
||||
* @param alarmTypeIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmTypeByAlarmTypeIds(Long[] alarmTypeIds);
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.ruoyi.business.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.HwAlarmInfo;
|
||||
import com.ruoyi.business.domain.VO.AlarmTypeVo;
|
||||
|
||||
/**
|
||||
* 报警信息Service接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2023-09-15
|
||||
*/
|
||||
public interface IHwAlarmInfoService
|
||||
{
|
||||
/**
|
||||
* 查询报警信息
|
||||
*
|
||||
* @param alarmInfoId 报警信息主键
|
||||
* @return 报警信息
|
||||
*/
|
||||
public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId);
|
||||
|
||||
/**
|
||||
* 查询报警信息列表
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 报警信息集合
|
||||
*/
|
||||
public List<HwAlarmInfo> selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo);
|
||||
|
||||
/**
|
||||
* 新增报警信息
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo);
|
||||
|
||||
/**
|
||||
* 修改报警信息
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo);
|
||||
|
||||
/**
|
||||
* 批量删除报警信息
|
||||
*
|
||||
* @param alarmInfoIds 需要删除的报警信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds);
|
||||
|
||||
/**
|
||||
* 删除报警信息信息
|
||||
*
|
||||
* @param alarmInfoId 报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId);
|
||||
|
||||
/**
|
||||
* @param: sceneId
|
||||
* @description 根据报警类型获取报警数量
|
||||
* @author xins
|
||||
* @date 2023-09-15 13:20
|
||||
* @return List<AlarmTypeVo>
|
||||
*/
|
||||
public List<AlarmTypeVo> selectAlarmsByAlarmType(Long sceneId);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.ruoyi.business.service;
|
||||
|
||||
import com.ruoyi.business.domain.VO.DeviceHistoryDataVo;
|
||||
import com.ruoyi.business.domain.VO.DeviceLatestDataVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 监控平台数据处理接口
|
||||
* @ClassName: IHwMonitorPlatformService
|
||||
* @Author : xins
|
||||
* @Date :2023-09-16 14:49
|
||||
* @Version :1.0
|
||||
*/
|
||||
public interface IHwMonitorPlatformService {
|
||||
|
||||
/**
|
||||
* @param: deviceLatestDataVo
|
||||
* @description 根据设备模型获取最新数据
|
||||
* @author xins
|
||||
* @date 2023-09-16 14:49
|
||||
* @return List<Map<Object>>
|
||||
*/
|
||||
public List<Map<String, Object>> selectLatestDataByTags(DeviceLatestDataVo deviceLatestDataVo);
|
||||
|
||||
/**
|
||||
* @param: deviceHistoryDataVo
|
||||
* @description 获取设备历史数据
|
||||
* @author xins
|
||||
* @date 2023-09-16 15:14
|
||||
* @return List<Map<Object>>
|
||||
*/
|
||||
public List<Map<String, Object>> getHistoryData(DeviceHistoryDataVo deviceHistoryDataVo);
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.ruoyi.business.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.business.domain.HwAlarmType;
|
||||
import com.ruoyi.business.domain.VO.AlarmTypeVo;
|
||||
import com.ruoyi.business.mapper.HwAlarmTypeMapper;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.business.mapper.HwAlarmInfoMapper;
|
||||
import com.ruoyi.business.domain.HwAlarmInfo;
|
||||
import com.ruoyi.business.service.IHwAlarmInfoService;
|
||||
|
||||
/**
|
||||
* 报警信息Service业务层处理
|
||||
*
|
||||
* @author xins
|
||||
* @date 2023-09-15
|
||||
*/
|
||||
@Service
|
||||
public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService {
|
||||
@Autowired
|
||||
private HwAlarmInfoMapper hwAlarmInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private HwAlarmTypeMapper hwAlarmTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询报警信息
|
||||
*
|
||||
* @param alarmInfoId 报警信息主键
|
||||
* @return 报警信息
|
||||
*/
|
||||
@Override
|
||||
public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId) {
|
||||
return hwAlarmInfoMapper.selectHwAlarmInfoByAlarmInfoId(alarmInfoId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询报警信息列表
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 报警信息
|
||||
*/
|
||||
@Override
|
||||
public List<HwAlarmInfo> selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo) {
|
||||
return hwAlarmInfoMapper.selectHwAlarmInfoList(hwAlarmInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报警信息
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo) {
|
||||
hwAlarmInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return hwAlarmInfoMapper.insertHwAlarmInfo(hwAlarmInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报警信息
|
||||
*
|
||||
* @param hwAlarmInfo 报警信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo) {
|
||||
hwAlarmInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return hwAlarmInfoMapper.updateHwAlarmInfo(hwAlarmInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除报警信息
|
||||
*
|
||||
* @param alarmInfoIds 需要删除的报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds) {
|
||||
return hwAlarmInfoMapper.deleteHwAlarmInfoByAlarmInfoIds(alarmInfoIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报警信息信息
|
||||
*
|
||||
* @param alarmInfoId 报警信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId) {
|
||||
return hwAlarmInfoMapper.deleteHwAlarmInfoByAlarmInfoId(alarmInfoId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return List<AlarmTypeVo>
|
||||
* @param: sceneId
|
||||
* @description 根据报警类型获取报警数量
|
||||
* @author xins
|
||||
* @date 2023-09-15 13:20
|
||||
*/
|
||||
@Override
|
||||
public List<AlarmTypeVo> selectAlarmsByAlarmType(Long sceneId) {
|
||||
List<AlarmTypeVo> list = hwAlarmInfoMapper.selectAlarmsByAlarmType(sceneId);
|
||||
HwAlarmType queryAlarmType = new HwAlarmType();
|
||||
queryAlarmType.setSceneId(sceneId);
|
||||
List<HwAlarmType> alarmTypes = hwAlarmTypeMapper.selectHwAlarmTypeList(queryAlarmType);
|
||||
Map<Long, HwAlarmType> alarmTypeMap = alarmTypes.stream()
|
||||
.collect(Collectors.toMap(HwAlarmType::getAlarmTypeId, alarmType -> alarmType));
|
||||
list.stream().forEach(alarmType -> {
|
||||
alarmType.setAlarmTypeName(alarmTypeMap.get(alarmType.getAlarmTypeId()) == null ? ""
|
||||
: alarmTypeMap.get(alarmType.getAlarmTypeId()).getAlarmTypeName());
|
||||
alarmTypeMap.remove(alarmType.getAlarmTypeId());
|
||||
});
|
||||
|
||||
|
||||
Set<Long> alarmTypeIds = alarmTypeMap.keySet();
|
||||
for (Long alarmTypeId : alarmTypeIds) {
|
||||
HwAlarmType alarmType = alarmTypeMap.get(alarmTypeId);
|
||||
AlarmTypeVo alarmTypeVo = new AlarmTypeVo();
|
||||
alarmTypeVo.setAlarmTypeId(alarmType.getAlarmTypeId());
|
||||
alarmTypeVo.setAlarmTypeName(alarmType.getAlarmTypeName());
|
||||
alarmTypeVo.setAlarmCount(0);
|
||||
list.add(alarmTypeVo);
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.ruoyi.business.service.impl;
|
||||
|
||||
import com.ruoyi.business.domain.VO.DeviceDataColumnVo;
|
||||
import com.ruoyi.business.domain.VO.DeviceHistoryDataVo;
|
||||
import com.ruoyi.business.domain.VO.DeviceLatestDataVo;
|
||||
import com.ruoyi.business.service.IHwMonitorPlatformService;
|
||||
import com.ruoyi.common.core.constant.HwDictConstants;
|
||||
import com.ruoyi.common.core.constant.TdEngineConstants;
|
||||
import com.ruoyi.tdengine.api.RemoteTdEngineService;
|
||||
import com.ruoyi.tdengine.api.domain.TdHistorySelectDto;
|
||||
import com.ruoyi.tdengine.api.domain.TdSuperTableSelectVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 监控平台数据处理接口
|
||||
* @ClassName: HwMonitorPlatformServiceImpl
|
||||
* @Author : xins
|
||||
* @Date :2023-09-16 14:50
|
||||
* @Version :1.0
|
||||
*/
|
||||
@Service
|
||||
public class HwMonitorPlatformServiceImpl implements IHwMonitorPlatformService {
|
||||
@Resource
|
||||
private RemoteTdEngineService remoteTdEngineService;
|
||||
|
||||
/**
|
||||
* @return List<Map < Object>>
|
||||
* @param: deviceLatestDataVo
|
||||
* @description 根据设备模型获取最新数据
|
||||
* @author xins
|
||||
* @date 2023-09-16 14:49
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectLatestDataByTags(DeviceLatestDataVo deviceLatestDataVo) {
|
||||
TdSuperTableSelectVo tdSuperTableSelectVo = new TdSuperTableSelectVo();
|
||||
String databaseName = TdEngineConstants.getDatabaseName(deviceLatestDataVo.getSceneId());
|
||||
String superTableName = TdEngineConstants.getSupertTableName(deviceLatestDataVo.getDeviceModeId());
|
||||
tdSuperTableSelectVo.setDatabaseName(databaseName);
|
||||
tdSuperTableSelectVo.setSuperTableName(superTableName);
|
||||
tdSuperTableSelectVo.setGroupByTagsName(TdEngineConstants.ST_TAG_DEVICEID);
|
||||
if (deviceLatestDataVo.getStartTime() != 0 || deviceLatestDataVo.getEndTime() != 0) {
|
||||
tdSuperTableSelectVo.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
|
||||
}
|
||||
tdSuperTableSelectVo.setDeviceCode(deviceLatestDataVo.getDeviceCode());
|
||||
tdSuperTableSelectVo.setDeviceName(deviceLatestDataVo.getDeviceName());
|
||||
tdSuperTableSelectVo.setStartTime(deviceLatestDataVo.getStartTime());
|
||||
tdSuperTableSelectVo.setEndTime(deviceLatestDataVo.getEndTime());
|
||||
tdSuperTableSelectVo.setOffset(deviceLatestDataVo.getOffset());
|
||||
tdSuperTableSelectVo.setLimit(deviceLatestDataVo.getLimit());
|
||||
return this.remoteTdEngineService.getLatestDataByTags(tdSuperTableSelectVo).getData();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param: deviceHistoryDataVo
|
||||
* @description 获取设备历史数据
|
||||
* @author xins
|
||||
* @date 2023-09-16 15:14
|
||||
* @return List<Map<Object>>
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getHistoryData(DeviceHistoryDataVo deviceHistoryDataVo) {
|
||||
TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto();
|
||||
tdHistorySelectDto.setDatabaseName(TdEngineConstants.getDatabaseName(deviceHistoryDataVo.getSceneId()));
|
||||
tdHistorySelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(deviceHistoryDataVo.getDeviceId()));
|
||||
tdHistorySelectDto.setOrderByFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
|
||||
tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE);
|
||||
if (deviceHistoryDataVo.getStartTime() != 0 || deviceHistoryDataVo.getEndTime() != 0) {
|
||||
tdHistorySelectDto.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME);
|
||||
}
|
||||
tdHistorySelectDto.setStartTime(deviceHistoryDataVo.getStartTime());
|
||||
tdHistorySelectDto.setEndTime(deviceHistoryDataVo.getEndTime());
|
||||
tdHistorySelectDto.setOffset(deviceHistoryDataVo.getOffset());
|
||||
tdHistorySelectDto.setLimit(deviceHistoryDataVo.getLimit());
|
||||
|
||||
return this.remoteTdEngineService.getHistoryData(tdHistorySelectDto).getData();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.business.mapper.HwAlarmInfoMapper">
|
||||
|
||||
<resultMap type="HwAlarmInfo" id="HwAlarmInfoResult">
|
||||
<result property="alarmInfoId" column="alarm_info_id" />
|
||||
<result property="alarmInfoType" column="alarm_info_type" />
|
||||
<result property="alarmReleatedId" column="alarm_releated_id" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="monitorUnitId" column="monitor_unit_id" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="sceneId" column="scene_id" />
|
||||
<result property="alarmLevelId" column="alarm_level_id" />
|
||||
<result property="alarmTypeId" column="alarm_type_id" />
|
||||
<result property="modeFunctionId" column="mode_function_id" />
|
||||
<result property="functionName" column="function_name" />
|
||||
<result property="functionIdentifier" column="function_identifier" />
|
||||
<result property="functionValue" column="function_value" />
|
||||
<result property="triggerStatus" column="trigger_status" />
|
||||
<result property="handleStatus" column="handle_status" />
|
||||
<result property="alarmTime" column="alarm_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="alarmInfoField" column="alarm_info_field" />
|
||||
<result property="monitorUnitName" column="monitor_unit_name" />
|
||||
<result property="alarmLevelName" column="alarm_level_name" />
|
||||
<result property="alarmTypeName" column="alarm_type_name" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="AlarmTypeVo" id="AlarmTypeVoResult">
|
||||
<result property="alarmCount" column="alarm_count" />
|
||||
<result property="alarmTypeId" column="alarm_type_id" />
|
||||
<result property="alarmTypeName" column="alarm_type_name" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectHwAlarmInfoVo">
|
||||
select hai.alarm_info_id, hai.alarm_info_type, hai.alarm_releated_id, hai.device_id,
|
||||
hai.monitor_unit_id, hai.tenant_id, hai.scene_id, hai.alarm_level_id,
|
||||
hai.alarm_type_id, hai.mode_function_id, hai.function_name, hai.function_identifier,
|
||||
hai.function_value, hai.trigger_status, hai.handle_status, hai.alarm_time,
|
||||
hai.create_time, hai.update_by, hai.update_time, hai.alarm_info_field,
|
||||
hmu.monitor_unit_name,hal.alarm_level_name,hat.alarm_type_name
|
||||
from hw_alarm_info hai left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id
|
||||
left join hw_alarm_level hal on hai.alarm_level_id=hal.alarm_level_id
|
||||
left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id
|
||||
</sql>
|
||||
|
||||
<select id="selectHwAlarmInfoList" parameterType="HwAlarmInfo" resultMap="HwAlarmInfoResult">
|
||||
<include refid="selectHwAlarmInfoVo"/>
|
||||
<where>
|
||||
<if test="alarmInfoType != null and alarmInfoType != ''"> and alarm_info_type = #{alarmInfoType}</if>
|
||||
<if test="alarmReleatedId != null "> and alarm_releated_id = #{alarmReleatedId}</if>
|
||||
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="sceneId != null "> and hai.scene_id = #{sceneId}</if>
|
||||
<if test="alarmLevelId != null "> and alarm_level_id = #{alarmLevelId}</if>
|
||||
<if test="alarmTypeId != null "> and alarm_type_id = #{alarmTypeId}</if>
|
||||
<if test="modeFunctionId != null "> and mode_function_id = #{modeFunctionId}</if>
|
||||
<if test="functionName != null and functionName != ''"> and function_name like concat('%', #{functionName}, '%')</if>
|
||||
<if test="functionIdentifier != null and functionIdentifier != ''"> and function_identifier = #{functionIdentifier}</if>
|
||||
<if test="functionValue != null and functionValue != ''"> and function_value = #{functionValue}</if>
|
||||
<if test="triggerStatus != null and triggerStatus != ''"> and trigger_status = #{triggerStatus}</if>
|
||||
<if test="handleStatus != null and handleStatus != ''"> and handle_status = #{handleStatus}</if>
|
||||
<if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>
|
||||
<if test="alarmInfoField != null and alarmInfoField != ''"> and alarm_info_field = #{alarmInfoField}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectHwAlarmInfoByAlarmInfoId" parameterType="Long" resultMap="HwAlarmInfoResult">
|
||||
<include refid="selectHwAlarmInfoVo"/>
|
||||
where alarm_info_id = #{alarmInfoId}
|
||||
</select>
|
||||
|
||||
<insert id="insertHwAlarmInfo" parameterType="HwAlarmInfo" useGeneratedKeys="true" keyProperty="alarmInfoId">
|
||||
insert into hw_alarm_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmInfoType != null and alarmInfoType != ''">alarm_info_type,</if>
|
||||
<if test="alarmReleatedId != null">alarm_releated_id,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="monitorUnitId != null">monitor_unit_id,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="sceneId != null">scene_id,</if>
|
||||
<if test="alarmLevelId != null">alarm_level_id,</if>
|
||||
<if test="alarmTypeId != null">alarm_type_id,</if>
|
||||
<if test="modeFunctionId != null">mode_function_id,</if>
|
||||
<if test="functionName != null">function_name,</if>
|
||||
<if test="functionIdentifier != null">function_identifier,</if>
|
||||
<if test="functionValue != null">function_value,</if>
|
||||
<if test="triggerStatus != null">trigger_status,</if>
|
||||
<if test="handleStatus != null and handleStatus != ''">handle_status,</if>
|
||||
<if test="alarmTime != null">alarm_time,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="alarmInfoField != null">alarm_info_field,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmInfoType != null and alarmInfoType != ''">#{alarmInfoType},</if>
|
||||
<if test="alarmReleatedId != null">#{alarmReleatedId},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="monitorUnitId != null">#{monitorUnitId},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="sceneId != null">#{sceneId},</if>
|
||||
<if test="alarmLevelId != null">#{alarmLevelId},</if>
|
||||
<if test="alarmTypeId != null">#{alarmTypeId},</if>
|
||||
<if test="modeFunctionId != null">#{modeFunctionId},</if>
|
||||
<if test="functionName != null">#{functionName},</if>
|
||||
<if test="functionIdentifier != null">#{functionIdentifier},</if>
|
||||
<if test="functionValue != null">#{functionValue},</if>
|
||||
<if test="triggerStatus != null">#{triggerStatus},</if>
|
||||
<if test="handleStatus != null and handleStatus != ''">#{handleStatus},</if>
|
||||
<if test="alarmTime != null">#{alarmTime},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="alarmInfoField != null">#{alarmInfoField},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateHwAlarmInfo" parameterType="HwAlarmInfo">
|
||||
update hw_alarm_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="alarmInfoType != null and alarmInfoType != ''">alarm_info_type = #{alarmInfoType},</if>
|
||||
<if test="alarmReleatedId != null">alarm_releated_id = #{alarmReleatedId},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="monitorUnitId != null">monitor_unit_id = #{monitorUnitId},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="sceneId != null">scene_id = #{sceneId},</if>
|
||||
<if test="alarmLevelId != null">alarm_level_id = #{alarmLevelId},</if>
|
||||
<if test="alarmTypeId != null">alarm_type_id = #{alarmTypeId},</if>
|
||||
<if test="modeFunctionId != null">mode_function_id = #{modeFunctionId},</if>
|
||||
<if test="functionName != null">function_name = #{functionName},</if>
|
||||
<if test="functionIdentifier != null">function_identifier = #{functionIdentifier},</if>
|
||||
<if test="functionValue != null">function_value = #{functionValue},</if>
|
||||
<if test="triggerStatus != null">trigger_status = #{triggerStatus},</if>
|
||||
<if test="handleStatus != null and handleStatus != ''">handle_status = #{handleStatus},</if>
|
||||
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="alarmInfoField != null">alarm_info_field = #{alarmInfoField},</if>
|
||||
</trim>
|
||||
where alarm_info_id = #{alarmInfoId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteHwAlarmInfoByAlarmInfoId" parameterType="Long">
|
||||
delete from hw_alarm_info where alarm_info_id = #{alarmInfoId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHwAlarmInfoByAlarmInfoIds" parameterType="String">
|
||||
delete from hw_alarm_info where alarm_info_id in
|
||||
<foreach item="alarmInfoId" collection="array" open="(" separator="," close=")">
|
||||
#{alarmInfoId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectAlarmsByAlarmType" parameterType="Long" resultMap="AlarmTypeVoResult">
|
||||
SELECT count(*) as alarm_count,alarm_type_id from hw_alarm_info
|
||||
where scene_id = #{sceneId} group by alarm_type_id;
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.business.mapper.HwAlarmLevelMapper">
|
||||
|
||||
<resultMap type="HwAlarmLevel" id="HwAlarmLevelResult">
|
||||
<result property="alarmLevelId" column="alarm_level_id" />
|
||||
<result property="alarmLevelName" column="alarm_level_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="sceneId" column="scene_id" />
|
||||
<result property="languageCode" column="language_code" />
|
||||
<result property="commonFlag" column="common_flag" />
|
||||
<result property="levelNumber" column="level_number" />
|
||||
<result property="levelStatus" column="level_status" />
|
||||
<result property="defaultNotifyMode" column="default_notify_mode" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="alarmLevelField" column="alarm_level_field" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHwAlarmLevelVo">
|
||||
select alarm_level_id, alarm_level_name, tenant_id, scene_id, language_code, common_flag, level_number, level_status, default_notify_mode, remark, create_by, create_time, update_by, update_time, alarm_level_field from hw_alarm_level
|
||||
</sql>
|
||||
|
||||
<select id="selectHwAlarmLevelList" parameterType="HwAlarmLevel" resultMap="HwAlarmLevelResult">
|
||||
<include refid="selectHwAlarmLevelVo"/>
|
||||
<where>
|
||||
<if test="alarmLevelName != null and alarmLevelName != ''"> and alarm_level_name like concat('%', #{alarmLevelName}, '%')</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
|
||||
<if test="languageCode != null and languageCode != ''"> and language_code = #{languageCode}</if>
|
||||
<if test="commonFlag != null and commonFlag != ''"> and common_flag = #{commonFlag}</if>
|
||||
<if test="levelNumber != null "> and level_number = #{levelNumber}</if>
|
||||
<if test="levelStatus != null and levelStatus != ''"> and level_status = #{levelStatus}</if>
|
||||
<if test="defaultNotifyMode != null and defaultNotifyMode != ''"> and default_notify_mode = #{defaultNotifyMode}</if>
|
||||
<if test="alarmLevelField != null and alarmLevelField != ''"> and alarm_level_field = #{alarmLevelField}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectHwAlarmLevelByAlarmLevelId" parameterType="Long" resultMap="HwAlarmLevelResult">
|
||||
<include refid="selectHwAlarmLevelVo"/>
|
||||
where alarm_level_id = #{alarmLevelId}
|
||||
</select>
|
||||
|
||||
<insert id="insertHwAlarmLevel" parameterType="HwAlarmLevel" useGeneratedKeys="true" keyProperty="alarmLevelId">
|
||||
insert into hw_alarm_level
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmLevelName != null and alarmLevelName != ''">alarm_level_name,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="sceneId != null">scene_id,</if>
|
||||
<if test="languageCode != null">language_code,</if>
|
||||
<if test="commonFlag != null and commonFlag != ''">common_flag,</if>
|
||||
<if test="levelNumber != null">level_number,</if>
|
||||
<if test="levelStatus != null and levelStatus != ''">level_status,</if>
|
||||
<if test="defaultNotifyMode != null">default_notify_mode,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="alarmLevelField != null">alarm_level_field,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmLevelName != null and alarmLevelName != ''">#{alarmLevelName},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="sceneId != null">#{sceneId},</if>
|
||||
<if test="languageCode != null">#{languageCode},</if>
|
||||
<if test="commonFlag != null and commonFlag != ''">#{commonFlag},</if>
|
||||
<if test="levelNumber != null">#{levelNumber},</if>
|
||||
<if test="levelStatus != null and levelStatus != ''">#{levelStatus},</if>
|
||||
<if test="defaultNotifyMode != null">#{defaultNotifyMode},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="alarmLevelField != null">#{alarmLevelField},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateHwAlarmLevel" parameterType="HwAlarmLevel">
|
||||
update hw_alarm_level
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="alarmLevelName != null and alarmLevelName != ''">alarm_level_name = #{alarmLevelName},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="sceneId != null">scene_id = #{sceneId},</if>
|
||||
<if test="languageCode != null">language_code = #{languageCode},</if>
|
||||
<if test="commonFlag != null and commonFlag != ''">common_flag = #{commonFlag},</if>
|
||||
<if test="levelNumber != null">level_number = #{levelNumber},</if>
|
||||
<if test="levelStatus != null and levelStatus != ''">level_status = #{levelStatus},</if>
|
||||
<if test="defaultNotifyMode != null">default_notify_mode = #{defaultNotifyMode},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="alarmLevelField != null">alarm_level_field = #{alarmLevelField},</if>
|
||||
</trim>
|
||||
where alarm_level_id = #{alarmLevelId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteHwAlarmLevelByAlarmLevelId" parameterType="Long">
|
||||
delete from hw_alarm_level where alarm_level_id = #{alarmLevelId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHwAlarmLevelByAlarmLevelIds" parameterType="String">
|
||||
delete from hw_alarm_level where alarm_level_id in
|
||||
<foreach item="alarmLevelId" collection="array" open="(" separator="," close=")">
|
||||
#{alarmLevelId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.business.mapper.HwAlarmTypeMapper">
|
||||
|
||||
<resultMap type="HwAlarmType" id="HwAlarmTypeResult">
|
||||
<result property="alarmTypeId" column="alarm_type_id" />
|
||||
<result property="alarmTypeName" column="alarm_type_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="sceneId" column="scene_id" />
|
||||
<result property="languageCode" column="language_code" />
|
||||
<result property="commonFlag" column="common_flag" />
|
||||
<result property="handleMode" column="handle_mode" />
|
||||
<result property="typeStatus" column="type_status" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="alarmTypeField" column="alarm_type_field" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHwAlarmTypeVo">
|
||||
select alarm_type_id, alarm_type_name, tenant_id, scene_id, language_code, common_flag, handle_mode, type_status, remark, create_by, create_time, update_by, update_time, alarm_type_field from hw_alarm_type
|
||||
</sql>
|
||||
|
||||
<select id="selectHwAlarmTypeList" parameterType="HwAlarmType" resultMap="HwAlarmTypeResult">
|
||||
<include refid="selectHwAlarmTypeVo"/>
|
||||
<where>
|
||||
<if test="alarmTypeName != null and alarmTypeName != ''"> and alarm_type_name like concat('%', #{alarmTypeName}, '%')</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
|
||||
<if test="languageCode != null and languageCode != ''"> and language_code = #{languageCode}</if>
|
||||
<if test="commonFlag != null and commonFlag != ''"> and common_flag = #{commonFlag}</if>
|
||||
<if test="handleMode != null and handleMode != ''"> and handle_mode = #{handleMode}</if>
|
||||
<if test="typeStatus != null and typeStatus != ''"> and type_status = #{typeStatus}</if>
|
||||
<if test="alarmTypeField != null and alarmTypeField != ''"> and alarm_type_field = #{alarmTypeField}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectHwAlarmTypeByAlarmTypeId" parameterType="Long" resultMap="HwAlarmTypeResult">
|
||||
<include refid="selectHwAlarmTypeVo"/>
|
||||
where alarm_type_id = #{alarmTypeId}
|
||||
</select>
|
||||
|
||||
<insert id="insertHwAlarmType" parameterType="HwAlarmType" useGeneratedKeys="true" keyProperty="alarmTypeId">
|
||||
insert into hw_alarm_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmTypeName != null and alarmTypeName != ''">alarm_type_name,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="sceneId != null">scene_id,</if>
|
||||
<if test="languageCode != null">language_code,</if>
|
||||
<if test="commonFlag != null and commonFlag != ''">common_flag,</if>
|
||||
<if test="handleMode != null and handleMode != ''">handle_mode,</if>
|
||||
<if test="typeStatus != null and typeStatus != ''">type_status,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="alarmTypeField != null">alarm_type_field,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="alarmTypeName != null and alarmTypeName != ''">#{alarmTypeName},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="sceneId != null">#{sceneId},</if>
|
||||
<if test="languageCode != null">#{languageCode},</if>
|
||||
<if test="commonFlag != null and commonFlag != ''">#{commonFlag},</if>
|
||||
<if test="handleMode != null and handleMode != ''">#{handleMode},</if>
|
||||
<if test="typeStatus != null and typeStatus != ''">#{typeStatus},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="alarmTypeField != null">#{alarmTypeField},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateHwAlarmType" parameterType="HwAlarmType">
|
||||
update hw_alarm_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="alarmTypeName != null and alarmTypeName != ''">alarm_type_name = #{alarmTypeName},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="sceneId != null">scene_id = #{sceneId},</if>
|
||||
<if test="languageCode != null">language_code = #{languageCode},</if>
|
||||
<if test="commonFlag != null and commonFlag != ''">common_flag = #{commonFlag},</if>
|
||||
<if test="handleMode != null and handleMode != ''">handle_mode = #{handleMode},</if>
|
||||
<if test="typeStatus != null and typeStatus != ''">type_status = #{typeStatus},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="alarmTypeField != null">alarm_type_field = #{alarmTypeField},</if>
|
||||
</trim>
|
||||
where alarm_type_id = #{alarmTypeId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteHwAlarmTypeByAlarmTypeId" parameterType="Long">
|
||||
delete from hw_alarm_type where alarm_type_id = #{alarmTypeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHwAlarmTypeByAlarmTypeIds" parameterType="String">
|
||||
delete from hw_alarm_type where alarm_type_id in
|
||||
<foreach item="alarmTypeId" collection="array" open="(" separator="," close=")">
|
||||
#{alarmTypeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue