dev #2
@ -67,6 +67,11 @@ public class RedisKeyConstants
|
||||
*/
|
||||
public static final String POINT_MATCH = "POINT_MATCH_";
|
||||
|
||||
/**
|
||||
* 点位枚举匹配数据 redis key
|
||||
*/
|
||||
public static final String POINT_ENUM_MATCH = "POINT_ENUM_MATCH_";
|
||||
|
||||
/**
|
||||
* topic对应站点ID redis key
|
||||
*/
|
||||
|
||||
@ -0,0 +1,147 @@
|
||||
package com.xzzn.ems.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
import com.xzzn.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 点位枚举匹配对象 ems_point_enum_match
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
public class EmsPointEnumMatch extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键自增长 */
|
||||
private Long id;
|
||||
|
||||
/** 点位匹配字段 */
|
||||
@Excel(name = "点位匹配字段")
|
||||
private String matchField;
|
||||
|
||||
/** 站点id */
|
||||
@Excel(name = "站点id")
|
||||
private String siteId;
|
||||
|
||||
/** 设备类别,例如“STACK/CLUSTER/PCS等” */
|
||||
@Excel(name = "设备类别,例如“STACK/CLUSTER/PCS等”")
|
||||
private String deviceCategory;
|
||||
|
||||
/** 系统枚举代码 */
|
||||
@Excel(name = "系统枚举代码")
|
||||
private String enumCode;
|
||||
|
||||
/** 系统枚举名称 */
|
||||
@Excel(name = "系统枚举名称")
|
||||
private String enumName;
|
||||
|
||||
/** 系统枚举描述 */
|
||||
@Excel(name = "系统枚举描述")
|
||||
private String enumDesc;
|
||||
|
||||
/** 数据枚举代码 */
|
||||
@Excel(name = "数据枚举代码")
|
||||
private String dataEnumCode;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setMatchField(String matchField)
|
||||
{
|
||||
this.matchField = matchField;
|
||||
}
|
||||
|
||||
public String getMatchField()
|
||||
{
|
||||
return matchField;
|
||||
}
|
||||
|
||||
public void setSiteId(String siteId)
|
||||
{
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public String getSiteId()
|
||||
{
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setDeviceCategory(String deviceCategory)
|
||||
{
|
||||
this.deviceCategory = deviceCategory;
|
||||
}
|
||||
|
||||
public String getDeviceCategory()
|
||||
{
|
||||
return deviceCategory;
|
||||
}
|
||||
|
||||
public void setEnumCode(String enumCode)
|
||||
{
|
||||
this.enumCode = enumCode;
|
||||
}
|
||||
|
||||
public String getEnumCode()
|
||||
{
|
||||
return enumCode;
|
||||
}
|
||||
|
||||
public void setEnumName(String enumName)
|
||||
{
|
||||
this.enumName = enumName;
|
||||
}
|
||||
|
||||
public String getEnumName()
|
||||
{
|
||||
return enumName;
|
||||
}
|
||||
|
||||
public void setEnumDesc(String enumDesc)
|
||||
{
|
||||
this.enumDesc = enumDesc;
|
||||
}
|
||||
|
||||
public String getEnumDesc()
|
||||
{
|
||||
return enumDesc;
|
||||
}
|
||||
|
||||
public void setDataEnumCode(String dataEnumCode)
|
||||
{
|
||||
this.dataEnumCode = dataEnumCode;
|
||||
}
|
||||
|
||||
public String getDataEnumCode()
|
||||
{
|
||||
return dataEnumCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("matchField", getMatchField())
|
||||
.append("siteId", getSiteId())
|
||||
.append("deviceCategory", getDeviceCategory())
|
||||
.append("enumCode", getEnumCode())
|
||||
.append("enumName", getEnumName())
|
||||
.append("enumDesc", getEnumDesc())
|
||||
.append("dataEnumCode", getDataEnumCode())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -18,6 +18,10 @@ public class DevicePointMatchExportVo implements Serializable {
|
||||
@Excel(name = "点位匹配字段名称")
|
||||
private String pointName;
|
||||
|
||||
/** 数据枚举映射-导出枚举名称 */
|
||||
@Excel(name = "数据枚举映射")
|
||||
private String matchFieldEnum;
|
||||
|
||||
/** 数据点位 */
|
||||
@Excel(name = "数据点位")
|
||||
private String dataPoint;
|
||||
@ -30,6 +34,10 @@ public class DevicePointMatchExportVo implements Serializable {
|
||||
@Excel(name = "数据单位")
|
||||
private String dataUnit;
|
||||
|
||||
/** 数据枚举 */
|
||||
@Excel(name = "数据枚举")
|
||||
private String dataEnum;
|
||||
|
||||
/** 是否告警点位 */
|
||||
@Excel(name = "是否告警点位", readConverterExp = "0=否,1=是")
|
||||
private String isAlarm;
|
||||
@ -54,6 +62,14 @@ public class DevicePointMatchExportVo implements Serializable {
|
||||
this.matchField = matchField;
|
||||
}
|
||||
|
||||
public String getMatchFieldEnum() {
|
||||
return matchFieldEnum;
|
||||
}
|
||||
|
||||
public void setMatchFieldEnum(String matchFieldEnum) {
|
||||
this.matchFieldEnum = matchFieldEnum;
|
||||
}
|
||||
|
||||
public String getDataPoint() {
|
||||
return dataPoint;
|
||||
}
|
||||
@ -78,6 +94,14 @@ public class DevicePointMatchExportVo implements Serializable {
|
||||
this.dataUnit = dataUnit;
|
||||
}
|
||||
|
||||
public String getDataEnum() {
|
||||
return dataEnum;
|
||||
}
|
||||
|
||||
public void setDataEnum(String dataEnum) {
|
||||
this.dataEnum = dataEnum;
|
||||
}
|
||||
|
||||
public String getIsAlarm() {
|
||||
return isAlarm;
|
||||
}
|
||||
|
||||
@ -18,6 +18,10 @@ public class DevicePointMatchVo implements Serializable {
|
||||
@Excel(name = "点位匹配字段名称")
|
||||
private String pointName;
|
||||
|
||||
/** 数据枚举映射 */
|
||||
@Excel(name = "数据枚举映射")
|
||||
private String matchFieldEnum;
|
||||
|
||||
/** 数据点位 */
|
||||
@Excel(name = "数据点位")
|
||||
private String dataPoint;
|
||||
@ -30,6 +34,10 @@ public class DevicePointMatchVo implements Serializable {
|
||||
@Excel(name = "数据单位")
|
||||
private String dataUnit;
|
||||
|
||||
/** 数据枚举 */
|
||||
@Excel(name = "数据枚举")
|
||||
private String dataEnum;
|
||||
|
||||
/** 是否告警点位 */
|
||||
@Excel(name = "是否告警点位", readConverterExp = "0=否,1=是")
|
||||
private String isAlarm;
|
||||
@ -58,6 +66,22 @@ public class DevicePointMatchVo implements Serializable {
|
||||
this.matchField = matchField;
|
||||
}
|
||||
|
||||
public String getMatchFieldEnum() {
|
||||
return matchFieldEnum;
|
||||
}
|
||||
|
||||
public void setMatchFieldEnum(String matchFieldEnum) {
|
||||
this.matchFieldEnum = matchFieldEnum;
|
||||
}
|
||||
|
||||
public String getDataEnum() {
|
||||
return dataEnum;
|
||||
}
|
||||
|
||||
public void setDataEnum(String dataEnum) {
|
||||
this.dataEnum = dataEnum;
|
||||
}
|
||||
|
||||
public String getDataPoint() {
|
||||
return dataPoint;
|
||||
}
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import com.xzzn.ems.domain.EmsPointEnumMatch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 点位枚举匹配Mapper接口
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
public interface EmsPointEnumMatchMapper
|
||||
{
|
||||
/**
|
||||
* 查询点位枚举匹配
|
||||
*
|
||||
* @param id 点位枚举匹配主键
|
||||
* @return 点位枚举匹配
|
||||
*/
|
||||
public EmsPointEnumMatch selectEmsPointEnumMatchById(Long id);
|
||||
|
||||
/**
|
||||
* 查询点位枚举匹配列表
|
||||
*
|
||||
* @param emsPointEnumMatch 点位枚举匹配
|
||||
* @return 点位枚举匹配集合
|
||||
*/
|
||||
public List<EmsPointEnumMatch> selectEmsPointEnumMatchList(EmsPointEnumMatch emsPointEnumMatch);
|
||||
|
||||
/**
|
||||
* 新增点位枚举匹配
|
||||
*
|
||||
* @param emsPointEnumMatch 点位枚举匹配
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsPointEnumMatch(EmsPointEnumMatch emsPointEnumMatch);
|
||||
|
||||
/**
|
||||
* 修改点位枚举匹配
|
||||
*
|
||||
* @param emsPointEnumMatch 点位枚举匹配
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsPointEnumMatch(EmsPointEnumMatch emsPointEnumMatch);
|
||||
|
||||
public void updateDataEnumCodeById(EmsPointEnumMatch pointEnumMatch);
|
||||
|
||||
/**
|
||||
* 删除点位枚举匹配
|
||||
*
|
||||
* @param id 点位枚举匹配主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsPointEnumMatchById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除点位枚举匹配
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsPointEnumMatchByIds(Long[] ids);
|
||||
|
||||
public List<EmsPointEnumMatch> selectList(@Param("siteId") String siteId,
|
||||
@Param("deviceCategory") String deviceCategory,
|
||||
@Param("matchField") String matchField);
|
||||
}
|
||||
@ -72,6 +72,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
@ -214,10 +215,11 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理中水冷却数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.COOLING.getCode());
|
||||
|
||||
EmsCoolingData coolingData = new EmsCoolingData();
|
||||
|
||||
saveDeviceData(pointMatchList, obj, coolingData);
|
||||
saveDeviceData(pointMatchList, obj, coolingData, pointEnumMatchMap);
|
||||
|
||||
coolingData.setDataUpdateTime(dataUpdateTime);
|
||||
coolingData.setCreateBy("system");
|
||||
@ -243,13 +245,14 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理动环数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.XF.getCode());
|
||||
|
||||
// 暂时只更新设备表的设备状态 ZDYBYDCZT-主电源备用电池状态
|
||||
// 数据存表
|
||||
EmsXfData xfData = new EmsXfData();
|
||||
xfData.setDataTimestamp(dataUpdateTime);
|
||||
|
||||
saveDeviceData(pointMatchList, obj, xfData);
|
||||
saveDeviceData(pointMatchList, obj, xfData, pointEnumMatchMap);
|
||||
|
||||
xfData.setCreateBy("system");
|
||||
xfData.setCreateTime(DateUtils.getNowDate());
|
||||
@ -277,11 +280,12 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理动环数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.DH.getCode());
|
||||
|
||||
//DH
|
||||
EmsDhData dhData = new EmsDhData();
|
||||
|
||||
saveDeviceData(pointMatchList, obj, dhData);
|
||||
saveDeviceData(pointMatchList, obj, dhData, pointEnumMatchMap);
|
||||
|
||||
dhData.setDataUpdateTime(dateUpdateTime);
|
||||
dhData.setCreateBy("system");
|
||||
@ -311,6 +315,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理电池堆数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.STACK.getCode());
|
||||
|
||||
//BMS 电池簇
|
||||
EmsBatteryStack dataStack = new EmsBatteryStack();
|
||||
@ -321,7 +326,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
dataStack.setPcsCommunicationStatus(CommunicationStatus.OK.getCode());
|
||||
dataStack.setEmsCommunicationStatus(CommunicationStatus.OK.getCode());
|
||||
|
||||
saveDeviceData(pointMatchList, obj, dataStack);
|
||||
saveDeviceData(pointMatchList, obj, dataStack, pointEnumMatchMap);
|
||||
|
||||
dataStack.setCreateBy("system");
|
||||
dataStack.setCreateTime(DateUtils.getNowDate());
|
||||
@ -533,7 +538,8 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
}
|
||||
}
|
||||
|
||||
private void saveDeviceData(List<EmsPointMatch> pointMatchList, Map<String, Object> obj, Object entity) {
|
||||
private void saveDeviceData(List<EmsPointMatch> pointMatchList, Map<String, Object> obj,
|
||||
Object entity, Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap) {
|
||||
Map<String, String> pointMatchMap = pointMatchList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
data -> StringUtils.toCamelCase(data.getMatchField()),
|
||||
@ -541,10 +547,21 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
(existing, replacement) -> replacement));
|
||||
Field[] fields = entity.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (pointMatchMap.containsKey(field.getName())) {
|
||||
String fieldName = field.getName();
|
||||
if (pointMatchMap.containsKey(fieldName)) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
Object matchValue = obj.get(pointMatchMap.get(field.getName()));
|
||||
Object matchValue = obj.get(pointMatchMap.get(fieldName));
|
||||
//匹配枚举值转换
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = pointEnumMatchMap.get(fieldName);
|
||||
if (CollectionUtils.isNotEmpty(pointEnumMatchList)) {
|
||||
Object finalMatchValue = matchValue;
|
||||
Optional<EmsPointEnumMatch> enumMatch = pointEnumMatchList.stream()
|
||||
.filter(data -> data.getDataEnumCode().equals(finalMatchValue)).findFirst();
|
||||
if (enumMatch.isPresent()) {
|
||||
matchValue = enumMatch.get().getEnumCode();
|
||||
}
|
||||
}
|
||||
Class<?> fieldType = field.getType();
|
||||
if (String.class.equals(fieldType)) {
|
||||
matchValue = StringUtils.getString(matchValue);
|
||||
@ -553,7 +570,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
} else if (BigDecimal.class.equals(fieldType)) {
|
||||
matchValue = StringUtils.getBigDecimal(matchValue);
|
||||
} else if (Integer.class.equals(fieldType)) {
|
||||
matchValue = MapUtils.getInteger(obj, pointMatchMap.get(field.getName()));
|
||||
matchValue = MapUtils.getInteger(obj, pointMatchMap.get(fieldName));
|
||||
}
|
||||
field.set(entity, matchValue);
|
||||
} catch (IllegalAccessException e) {
|
||||
@ -573,11 +590,12 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理电池簇数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.CLUSTER.getCode());
|
||||
String stackDeviceId = getStackDeviceId(deviceId);
|
||||
//BMS 电池簇
|
||||
EmsBatteryCluster data = new EmsBatteryCluster();
|
||||
|
||||
saveDeviceData(pointMatchList, obj, data);
|
||||
saveDeviceData(pointMatchList, obj, data, pointEnumMatchMap);
|
||||
|
||||
data.setDataUpdateTime(dataUpdateTime);
|
||||
data.setWorkStatus(WorkStatus.NORMAL.getCode()); // 或其他默认值
|
||||
@ -626,6 +644,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理单体电池数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.BATTERY.getCode());
|
||||
List<EmsBatteryData> list = new ArrayList<>();
|
||||
List<EmsBatteryDataDailyLatest> dailyList = new ArrayList<>();
|
||||
List<EmsBatteryDataMinutes> minutesList = new ArrayList<>();
|
||||
@ -642,7 +661,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
batteryData.setDeviceId(recordId);
|
||||
batteryData.setBatteryCellId(recordId);
|
||||
|
||||
saveDeviceData(pointMatchList, fields, batteryData);
|
||||
saveDeviceData(pointMatchList, fields, batteryData, pointEnumMatchMap);
|
||||
|
||||
batteryData.setBatteryCluster(deviceId);
|
||||
batteryData.setBatteryPack(getStackDeviceId(deviceId));
|
||||
@ -706,11 +725,12 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理PCS数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.PCS.getCode());
|
||||
|
||||
//pcs
|
||||
EmsPcsData pcsData = new EmsPcsData();
|
||||
|
||||
saveDeviceData(pointMatchList, obj, pcsData);
|
||||
saveDeviceData(pointMatchList, obj, pcsData, pointEnumMatchMap);
|
||||
|
||||
// 状态指示类
|
||||
pcsData.setBranchStatus(BranchStatus.NORMAL.getCode());
|
||||
@ -756,6 +776,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理PCS支路数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.BRANCH.getCode());
|
||||
|
||||
//PCS支路
|
||||
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
|
||||
@ -767,7 +788,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
data.setSiteId(siteId);
|
||||
data.setGridStatus(GridStatus.GRID.getCode());
|
||||
|
||||
saveDeviceData(pointMatchList, fields, data);
|
||||
saveDeviceData(pointMatchList, fields, data, pointEnumMatchMap);
|
||||
|
||||
data.setBranchId(recordId);
|
||||
data.setCreateBy("system");
|
||||
@ -796,12 +817,13 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理LOAD总表数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.AMMETER.getCode());
|
||||
|
||||
EmsAmmeterData dataLoad = new EmsAmmeterData();
|
||||
// 更新时间
|
||||
dataLoad.setDataUpdateTime(dataUpdateTime);
|
||||
|
||||
saveDeviceData(pointMatchList, obj, dataLoad);
|
||||
saveDeviceData(pointMatchList, obj, dataLoad, pointEnumMatchMap);
|
||||
|
||||
dataLoad.setCreateBy("system");
|
||||
dataLoad.setCreateTime(DateUtils.getNowDate());
|
||||
@ -832,6 +854,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理LOAD总表数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.CLUSTER.getCode());
|
||||
//BMSC 电池簇
|
||||
EmsBatteryCluster data = new EmsBatteryCluster();
|
||||
// 其他非 BigDecimal 字段
|
||||
@ -853,10 +876,10 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
// 获取redis获取最新的BMSD数据
|
||||
Map<String, Object> stackObj = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_BMSD + siteId + "_" + stackDeviceId);
|
||||
data.setDeviceId(deviceId);
|
||||
saveDeviceData(pointMatchList, obj, data);
|
||||
saveDeviceData(pointMatchList, obj, data, pointEnumMatchMap);
|
||||
|
||||
// 取堆里面数据
|
||||
saveDeviceData(pointMatchList, stackObj, data);
|
||||
saveDeviceData(pointMatchList, stackObj, data, pointEnumMatchMap);
|
||||
|
||||
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
|
||||
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + siteId + "_" + deviceId, data);
|
||||
@ -929,6 +952,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理METE储能电表数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.AMMETER.getCode());
|
||||
|
||||
// 获取上次数据,便于后面计算差值均无则默认0
|
||||
EmsAmmeterData lastAmmeterData = getLastAmmeterData(siteId, deviceId);
|
||||
@ -937,7 +961,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
// 更新时间
|
||||
dataMete.setDataUpdateTime(dataUpdateTime);
|
||||
|
||||
saveDeviceData(pointMatchList, obj, dataMete);
|
||||
saveDeviceData(pointMatchList, obj, dataMete, pointEnumMatchMap);
|
||||
|
||||
dataMete.setCreateBy("system");
|
||||
dataMete.setCreateTime(DateUtils.getNowDate());
|
||||
@ -1396,11 +1420,12 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理中水冷却告警数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.PCS.getCode());
|
||||
EmsPcsAlarmData pcsAlarmData = new EmsPcsAlarmData();
|
||||
// 更新时间
|
||||
pcsAlarmData.setDataTimestamp(dataUpdateTime);
|
||||
|
||||
saveDeviceData(pointMatchList, obj, pcsAlarmData);
|
||||
saveDeviceData(pointMatchList, obj, pcsAlarmData, pointEnumMatchMap);
|
||||
|
||||
pcsAlarmData.setCreateBy("system");
|
||||
pcsAlarmData.setCreateTime(DateUtils.getNowDate());
|
||||
@ -1422,12 +1447,13 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理电池堆告警数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.STACK.getCode());
|
||||
|
||||
EmsStackAlarmData stackAlarmData = new EmsStackAlarmData();
|
||||
// 更新时间
|
||||
stackAlarmData.setDataTimestamp(dataUpdateTime);
|
||||
|
||||
saveDeviceData(pointMatchList, obj, stackAlarmData);
|
||||
saveDeviceData(pointMatchList, obj, stackAlarmData, pointEnumMatchMap);
|
||||
|
||||
stackAlarmData.setCreateBy("system");
|
||||
stackAlarmData.setCreateTime(DateUtils.getNowDate());
|
||||
@ -1448,11 +1474,12 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理电池簇告警数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.CLUSTER.getCode());
|
||||
EmsClusterAlarmData clusterAlarmData = new EmsClusterAlarmData();
|
||||
// 更新时间
|
||||
clusterAlarmData.setDataTimestamp(dataUpdateTime);
|
||||
|
||||
saveDeviceData(pointMatchList, obj, clusterAlarmData);
|
||||
saveDeviceData(pointMatchList, obj, clusterAlarmData, pointEnumMatchMap);
|
||||
|
||||
clusterAlarmData.setCreateBy("system");
|
||||
clusterAlarmData.setCreateTime(DateUtils.getNowDate());
|
||||
@ -1474,12 +1501,13 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
||||
log.info("未找到匹配的点位数据,无法处理中水冷却告警数据,siteId: " + siteId + ",deviceId: " + deviceId);
|
||||
return;
|
||||
}
|
||||
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.COOLING.getCode());
|
||||
|
||||
EmsCoolingAlarmData coolingAlarmData = new EmsCoolingAlarmData();
|
||||
// 更新时间
|
||||
coolingAlarmData.setDataTimestamp(dataUpdateTime);
|
||||
|
||||
saveDeviceData(pointMatchList, obj, coolingAlarmData);
|
||||
saveDeviceData(pointMatchList, obj, coolingAlarmData, pointEnumMatchMap);
|
||||
|
||||
coolingAlarmData.setCreateBy("system");
|
||||
coolingAlarmData.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
@ -28,10 +28,12 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.xzzn.common.utils.poi.ExcelUtil;
|
||||
import com.xzzn.ems.domain.EmsPointEnumMatch;
|
||||
import com.xzzn.ems.domain.vo.DevicePointMatchExportVo;
|
||||
import com.xzzn.ems.domain.vo.DevicePointMatchVo;
|
||||
import com.xzzn.ems.domain.vo.ImportPointDataRequest;
|
||||
import com.xzzn.ems.enums.DeviceMatchTable;
|
||||
import com.xzzn.ems.mapper.EmsPointEnumMatchMapper;
|
||||
import com.xzzn.ems.mapper.EmsPointMatchMapper;
|
||||
import com.xzzn.ems.domain.EmsPointMatch;
|
||||
import com.xzzn.ems.service.IEmsPointMatchService;
|
||||
@ -46,12 +48,14 @@ import javax.validation.Validator;
|
||||
* @date 2025-11-04
|
||||
*/
|
||||
@Service
|
||||
public class EmsPointMatchServiceImpl implements IEmsPointMatchService
|
||||
{
|
||||
public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
||||
private static final Logger log = LoggerFactory.getLogger(EmsPointMatchServiceImpl.class);
|
||||
private static final String SEPARATOR = "#";
|
||||
@Autowired
|
||||
private EmsPointMatchMapper emsPointMatchMapper;
|
||||
@Autowired
|
||||
private EmsPointEnumMatchMapper emsPointEnumMatchMapper;
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@ -63,13 +67,33 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService
|
||||
* @return 点位匹配
|
||||
*/
|
||||
@Override
|
||||
public List<DevicePointMatchExportVo> selectEmsPointMatchList(EmsPointMatch emsPointMatch)
|
||||
{
|
||||
return emsPointMatchMapper.selectEmsPointMatchExportList(emsPointMatch);
|
||||
public List<DevicePointMatchExportVo> selectEmsPointMatchList(EmsPointMatch emsPointMatch) {
|
||||
List<DevicePointMatchExportVo> devicePointMatchExportVos = emsPointMatchMapper.selectEmsPointMatchExportList(emsPointMatch);
|
||||
if (CollectionUtils.isEmpty(devicePointMatchExportVos)) {
|
||||
return devicePointMatchExportVos;
|
||||
}
|
||||
|
||||
for (DevicePointMatchExportVo devicePointMatch : devicePointMatchExportVos) {
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(emsPointMatch.getSiteId(),
|
||||
emsPointMatch.getDeviceCategory(), devicePointMatch.getMatchField());
|
||||
if (!CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
String enumName = pointEnumMatchList.stream().map(EmsPointEnumMatch::getEnumName).filter(StringUtils::isNotBlank).collect(Collectors.joining(SEPARATOR));
|
||||
String dataEnumCode = pointEnumMatchList.stream().map(EmsPointEnumMatch::getDataEnumCode).filter(StringUtils::isNotBlank).collect(Collectors.joining(SEPARATOR));
|
||||
// List<String> dataEnumCode = pointEnumMatchList.stream().map(EmsPointEnumMatch::getDataEnumCode).collect(Collectors.toList());
|
||||
|
||||
// devicePointMatch.setMatchFieldEnum(StringUtils.join(enumName, SEPARATOR));
|
||||
// devicePointMatch.setDataEnum(StringUtils.join(dataEnumCode, SEPARATOR));
|
||||
devicePointMatch.setMatchFieldEnum(enumName);
|
||||
devicePointMatch.setDataEnum(dataEnumCode);
|
||||
}
|
||||
}
|
||||
|
||||
return devicePointMatchExportVos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传点位清单
|
||||
*
|
||||
* @param pointMatchList
|
||||
* @param isUpdateSupport
|
||||
* @param operName
|
||||
@ -77,8 +101,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService
|
||||
*/
|
||||
@Override
|
||||
public String importPoint(List<EmsPointMatch> pointMatchList, boolean isUpdateSupport, String operName) {
|
||||
if (StringUtils.isNull(pointMatchList) || pointMatchList.size() == 0)
|
||||
{
|
||||
if (StringUtils.isNull(pointMatchList) || pointMatchList.size() == 0) {
|
||||
throw new ServiceException("导入用户数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
@ -89,19 +112,19 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService
|
||||
try {
|
||||
// 验证点位是否存在
|
||||
EmsPointMatch point = emsPointMatchMapper.getUniquePoint(pointMatch.getSiteId(),
|
||||
pointMatch.getDeviceCategory(),pointMatch.getDataPoint());
|
||||
pointMatch.getDeviceCategory(), pointMatch.getDataPoint());
|
||||
if (StringUtils.isNull(point)) {
|
||||
BeanValidators.validateWithException(validator, pointMatch);
|
||||
pointMatch.setCreateBy(operName);
|
||||
emsPointMatchMapper.insertEmsPointMatch(pointMatch);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、站点 " + pointMatch.getSiteId() + "、点位 " + pointMatch.getDataPoint()+ " 导入成功");
|
||||
successMsg.append("<br/>" + successNum + "、站点 " + pointMatch.getSiteId() + "、点位 " + pointMatch.getDataPoint() + " 导入成功");
|
||||
} else if (isUpdateSupport) {
|
||||
BeanValidators.validateWithException(validator, pointMatch);
|
||||
pointMatch.setUpdateBy(operName);
|
||||
emsPointMatchMapper.updateEmsPointMatch(pointMatch);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、站点 " + pointMatch.getSiteId() + "、点位 " + pointMatch.getDataPoint()+ " 更新成功");
|
||||
successMsg.append("<br/>" + successNum + "、站点 " + pointMatch.getSiteId() + "、点位 " + pointMatch.getDataPoint() + " 更新成功");
|
||||
} else {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、站点" + pointMatch.getSiteId() + "、点位 " + pointMatch.getDataPoint() + " 已存在");
|
||||
@ -123,6 +146,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService
|
||||
|
||||
/**
|
||||
* 导入设备点位清单数据到数据库,并同步到Redis
|
||||
*
|
||||
* @param request
|
||||
* @param operName
|
||||
* @return
|
||||
@ -176,6 +200,9 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService
|
||||
savePoint.setId(dbPoint.getId());
|
||||
emsPointMatchMapper.updateEmsPointMatch(savePoint);
|
||||
}
|
||||
// 保存点位枚举映射关系
|
||||
savePointMatchEnum(pointMatch.getMatchFieldEnum(), pointMatch.getDataEnum(), savePoint);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("点位清单导入失败:{}", e.getMessage());
|
||||
throw new ServiceException("点位清单导入失败!");
|
||||
@ -206,11 +233,51 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService
|
||||
}
|
||||
|
||||
private void syncToRedis(String siteId, String deviceCategory) {
|
||||
// 同步到Redis
|
||||
// 点位匹配数据同步到Redis
|
||||
String pointMatchKey = DevicePointMatchDataProcessor.getPointMacthCacheKey(siteId, deviceCategory);
|
||||
List<EmsPointMatch> pointMatchData = emsPointMatchMapper.getDevicePointMatchList(siteId, deviceCategory);
|
||||
// log.info("同步点位匹配数据到Redis key:{} data:{}", pointMatchKey, pointMatchData);
|
||||
redisCache.setCacheObject(pointMatchKey, pointMatchData);
|
||||
log.info("点位匹配数据同步完成 data:{}", JSON.toJSONString(redisCache.getCacheObject(pointMatchKey)));
|
||||
if (redisCache.hasKey(pointMatchKey)) {
|
||||
redisCache.deleteObject(pointMatchKey);
|
||||
}
|
||||
redisCache.setCacheList(pointMatchKey, pointMatchData);
|
||||
log.info("点位匹配数据同步完成 data:{}", JSON.toJSONString(redisCache.getCacheList(pointMatchKey)));
|
||||
|
||||
// 点位枚举匹配数据同步到Redis
|
||||
String pointEnumMatchKey = DevicePointMatchDataProcessor.getPointEnumMacthCacheKey(siteId, deviceCategory);
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, deviceCategory, null);
|
||||
if (!CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
if (redisCache.hasKey(pointEnumMatchKey)) {
|
||||
redisCache.deleteObject(pointEnumMatchKey);
|
||||
}
|
||||
redisCache.setCacheList(pointEnumMatchKey, pointEnumMatchList);
|
||||
log.info("点位枚举匹配数据同步完成 data:{}", JSON.toJSONString(redisCache.getCacheList(pointEnumMatchKey)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void savePointMatchEnum(String matchFieldEnum, String dataEnum, EmsPointMatch savePoint) {
|
||||
if (StringUtils.isAllBlank(matchFieldEnum, dataEnum)) {
|
||||
return;
|
||||
}
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(savePoint.getSiteId(), savePoint.getDeviceCategory(), savePoint.getMatchField());
|
||||
if (CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
return;
|
||||
}
|
||||
String[] matchFieldEnums = matchFieldEnum.split(SEPARATOR);
|
||||
String[] dataEnums = dataEnum.split(SEPARATOR);
|
||||
if (matchFieldEnums.length != dataEnums.length) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < matchFieldEnums.length; i++) {
|
||||
String enumName = matchFieldEnums[i];
|
||||
String dataEnumCode = dataEnums[i];
|
||||
pointEnumMatchList.forEach(pointEnumMatch -> {
|
||||
if (pointEnumMatch.getEnumName().equals(enumName)) {
|
||||
pointEnumMatch.setDataEnumCode(dataEnumCode);
|
||||
emsPointEnumMatchMapper.updateDataEnumCodeById(pointEnumMatch);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,11 +11,13 @@ import com.xzzn.common.enums.PointType;
|
||||
import com.xzzn.common.utils.DataUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.EmsDevicesSetting;
|
||||
import com.xzzn.ems.domain.EmsPointEnumMatch;
|
||||
import com.xzzn.ems.domain.EmsPointMatch;
|
||||
import com.xzzn.ems.domain.vo.DevicePointMatchInfo;
|
||||
import com.xzzn.ems.domain.vo.StackStatisListVo;
|
||||
import com.xzzn.ems.enums.DeviceMatchTable;
|
||||
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
|
||||
import com.xzzn.ems.mapper.EmsPointEnumMatchMapper;
|
||||
import com.xzzn.ems.mapper.EmsPointMatchMapper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@ -25,6 +27,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@ -47,6 +50,8 @@ public class DevicePointMatchDataProcessor {
|
||||
private EmsDevicesSettingMapper emsDevicesSettingMapper;
|
||||
@Autowired
|
||||
private EmsPointMatchMapper emsPointMatchMapper;
|
||||
@Autowired
|
||||
private EmsPointEnumMatchMapper emsPointEnumMatchMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@ -115,6 +120,25 @@ public class DevicePointMatchDataProcessor {
|
||||
return pointMatchList;
|
||||
}
|
||||
|
||||
public List<EmsPointEnumMatch> getPointEnumMatchList(String siteId, String deviceCategory) {
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = redisCache.getCacheList(getPointEnumMacthCacheKey(siteId, deviceCategory));
|
||||
|
||||
if (CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, deviceCategory, null);
|
||||
}
|
||||
|
||||
return pointEnumMatchList;
|
||||
}
|
||||
|
||||
public Map<String, List<EmsPointEnumMatch>> getPointEnumMatchMap(String siteId, String deviceCategory) {
|
||||
List<EmsPointEnumMatch> pointEnumMatchList = getPointEnumMatchList(siteId, deviceCategory);
|
||||
if (CollectionUtils.isEmpty(pointEnumMatchList)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
return pointEnumMatchList.stream()
|
||||
.collect(Collectors.groupingBy(data -> StringUtils.toCamelCase(data.getMatchField())));
|
||||
}
|
||||
|
||||
public void saveDevicePointMatch(String siteId, String deviceId, DeviceMatchTable pointMatchType, String dataDevice) {
|
||||
// EmsDevicesSetting devicesSetting = emsDevicesSettingMapper.getDeviceBySiteAndDeviceId(deviceId, siteId);
|
||||
// if (devicesSetting == null) {
|
||||
@ -194,4 +218,15 @@ public class DevicePointMatchDataProcessor {
|
||||
{
|
||||
return RedisKeyConstants.POINT_MATCH + deviceCategory + "_" + siteId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置点位枚举缓存key
|
||||
* @param siteId
|
||||
* @param deviceCategory
|
||||
* @return 点位枚举缓存key
|
||||
*/
|
||||
public static String getPointEnumMacthCacheKey(String siteId, String deviceCategory)
|
||||
{
|
||||
return RedisKeyConstants.POINT_ENUM_MATCH + deviceCategory + "_" + siteId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,122 @@
|
||||
<?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.xzzn.ems.mapper.EmsPointEnumMatchMapper">
|
||||
|
||||
<resultMap type="EmsPointEnumMatch" id="EmsPointEnumMatchResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="matchField" column="match_field" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="deviceCategory" column="device_category" />
|
||||
<result property="enumCode" column="enum_code" />
|
||||
<result property="enumName" column="enum_name" />
|
||||
<result property="enumDesc" column="enum_desc" />
|
||||
<result property="dataEnumCode" column="data_enum_code" />
|
||||
<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="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsPointEnumMatchVo">
|
||||
select id, match_field, site_id, device_category, enum_code, enum_name, enum_desc, data_enum_code, create_by, create_time, update_by, update_time, remark from ems_point_enum_match
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsPointEnumMatchList" parameterType="EmsPointEnumMatch" resultMap="EmsPointEnumMatchResult">
|
||||
<include refid="selectEmsPointEnumMatchVo"/>
|
||||
<where>
|
||||
<if test="matchField != null and matchField != ''"> and match_field = #{matchField}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="deviceCategory != null and deviceCategory != ''"> and device_category = #{deviceCategory}</if>
|
||||
<if test="enumCode != null and enumCode != ''"> and enum_code = #{enumCode}</if>
|
||||
<if test="enumName != null and enumName != ''"> and enum_name like concat('%', #{enumName}, '%')</if>
|
||||
<if test="enumDesc != null and enumDesc != ''"> and enum_desc = #{enumDesc}</if>
|
||||
<if test="dataEnumCode != null and dataEnumCode != ''"> and data_enum_code = #{dataEnumCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmsPointEnumMatchById" parameterType="Long" resultMap="EmsPointEnumMatchResult">
|
||||
<include refid="selectEmsPointEnumMatchVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsPointEnumMatch" parameterType="EmsPointEnumMatch" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ems_point_enum_match
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="matchField != null">match_field,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="deviceCategory != null">device_category,</if>
|
||||
<if test="enumCode != null">enum_code,</if>
|
||||
<if test="enumName != null">enum_name,</if>
|
||||
<if test="enumDesc != null">enum_desc,</if>
|
||||
<if test="dataEnumCode != null">data_enum_code,</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="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="matchField != null">#{matchField},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="deviceCategory != null">#{deviceCategory},</if>
|
||||
<if test="enumCode != null">#{enumCode},</if>
|
||||
<if test="enumName != null">#{enumName},</if>
|
||||
<if test="enumDesc != null">#{enumDesc},</if>
|
||||
<if test="dataEnumCode != null">#{dataEnumCode},</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="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmsPointEnumMatch" parameterType="EmsPointEnumMatch">
|
||||
update ems_point_enum_match
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="matchField != null">match_field = #{matchField},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="deviceCategory != null">device_category = #{deviceCategory},</if>
|
||||
<if test="enumCode != null">enum_code = #{enumCode},</if>
|
||||
<if test="enumName != null">enum_name = #{enumName},</if>
|
||||
<if test="enumDesc != null">enum_desc = #{enumDesc},</if>
|
||||
<if test="dataEnumCode != null">data_enum_code = #{dataEnumCode},</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="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateDataEnumCodeById" parameterType="EmsPointEnumMatch">
|
||||
update ems_point_enum_match
|
||||
set data_enum_code = #{dataEnumCode}, update_time = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsPointEnumMatchById" parameterType="Long">
|
||||
delete from ems_point_enum_match where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsPointEnumMatchByIds" parameterType="String">
|
||||
delete from ems_point_enum_match where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectList" resultMap="EmsPointEnumMatchResult">
|
||||
<include refid="selectEmsPointEnumMatchVo"/>
|
||||
<where>
|
||||
<if test="matchField != null and matchField != ''"> and match_field = #{matchField}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="deviceCategory != null and deviceCategory != ''"> and device_category = #{deviceCategory}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user