验收3-设备保护告警同步本地
This commit is contained in:
158
ems-system/src/main/java/com/xzzn/ems/domain/MqttSyncLog.java
Normal file
158
ems-system/src/main/java/com/xzzn/ems/domain/MqttSyncLog.java
Normal file
@ -0,0 +1,158 @@
|
||||
package com.xzzn.ems.domain;
|
||||
|
||||
import com.xzzn.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* MQTT云上本地同步日志对象 mqtt_sync_log
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-11-12
|
||||
*/
|
||||
public class MqttSyncLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 同步消息唯一标识(与消息中的syncId一致) */
|
||||
@Excel(name = "同步消息唯一标识", readConverterExp = "与=消息中的syncId一致")
|
||||
private String syncId;
|
||||
|
||||
/** MQTT主题 */
|
||||
@Excel(name = "MQTT主题")
|
||||
private String topic;
|
||||
|
||||
/** 操作类型:INSERT/UPDATE/DELETE */
|
||||
@Excel(name = "操作类型:INSERT/UPDATE/DELETE")
|
||||
private String operateType;
|
||||
|
||||
/** 涉及的表名 */
|
||||
@Excel(name = "涉及的表名")
|
||||
private String tableName;
|
||||
|
||||
/** 同步数据内容(JSON格式) */
|
||||
@Excel(name = "同步数据内容", readConverterExp = "J=SON格式")
|
||||
private String content;
|
||||
|
||||
/** 处理状态:SUCCESS/FAIL */
|
||||
@Excel(name = "处理状态:SUCCESS/FAIL")
|
||||
private String status;
|
||||
|
||||
/** 失败原因(status=FAIL时填写) */
|
||||
@Excel(name = "失败原因", readConverterExp = "s=tatus=FAIL时填写")
|
||||
private String errorMsg;
|
||||
|
||||
/** 同步目标 */
|
||||
@Excel(name = "同步目标")
|
||||
private String target;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setSyncId(String syncId)
|
||||
{
|
||||
this.syncId = syncId;
|
||||
}
|
||||
|
||||
public String getSyncId()
|
||||
{
|
||||
return syncId;
|
||||
}
|
||||
|
||||
public void setTopic(String topic)
|
||||
{
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
public String getTopic()
|
||||
{
|
||||
return topic;
|
||||
}
|
||||
|
||||
public void setOperateType(String operateType)
|
||||
{
|
||||
this.operateType = operateType;
|
||||
}
|
||||
|
||||
public String getOperateType()
|
||||
{
|
||||
return operateType;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName)
|
||||
{
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public String getTableName()
|
||||
{
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setErrorMsg(String errorMsg)
|
||||
{
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
public String getErrorMsg()
|
||||
{
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
public void setTarget(String target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public String getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("syncId", getSyncId())
|
||||
.append("topic", getTopic())
|
||||
.append("operateType", getOperateType())
|
||||
.append("tableName", getTableName())
|
||||
.append("content", getContent())
|
||||
.append("status", getStatus())
|
||||
.append("errorMsg", getErrorMsg())
|
||||
.append("target", getTarget())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsFaultProtectionPlan;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 故障告警保护方案Mapper接口
|
||||
@ -58,4 +59,9 @@ public interface EmsFaultProtectionPlanMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsFaultProtectionPlanByIds(Long[] ids);
|
||||
|
||||
// 根据站点+faultName+faultLevel 同步删除
|
||||
public void deleteEmsFaultProtectionPlan(@Param("siteId")String siteId,
|
||||
@Param("faultName")String faultName,
|
||||
@Param("faultLevel")Integer faultLevel);
|
||||
}
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.MqttSyncLog;
|
||||
|
||||
/**
|
||||
* MQTT云上本地同步日志Mapper接口
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-11-12
|
||||
*/
|
||||
public interface MqttSyncLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询MQTT云上本地同步日志
|
||||
*
|
||||
* @param id MQTT云上本地同步日志主键
|
||||
* @return MQTT云上本地同步日志
|
||||
*/
|
||||
public MqttSyncLog selectMqttSyncLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询MQTT云上本地同步日志列表
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return MQTT云上本地同步日志集合
|
||||
*/
|
||||
public List<MqttSyncLog> selectMqttSyncLogList(MqttSyncLog mqttSyncLog);
|
||||
|
||||
/**
|
||||
* 新增MQTT云上本地同步日志
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMqttSyncLog(MqttSyncLog mqttSyncLog);
|
||||
|
||||
/**
|
||||
* 修改MQTT云上本地同步日志
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMqttSyncLog(MqttSyncLog mqttSyncLog);
|
||||
|
||||
/**
|
||||
* 删除MQTT云上本地同步日志
|
||||
*
|
||||
* @param id MQTT云上本地同步日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMqttSyncLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除MQTT云上本地同步日志
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMqttSyncLogByIds(Long[] ids);
|
||||
|
||||
public MqttSyncLog selectMqttSyncLogBySyncId(String syncId);
|
||||
}
|
||||
@ -58,4 +58,7 @@ public interface IEmsFaultProtectionPlanService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsFaultProtectionPlanById(Long id);
|
||||
|
||||
// 处理云上同步设备保护告警信息
|
||||
public void dealSyncData(String content, String operateType);
|
||||
}
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
package com.xzzn.ems.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.MqttSyncLog;
|
||||
|
||||
/**
|
||||
* MQTT云上本地同步日志Service接口
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-11-12
|
||||
*/
|
||||
public interface IMqttSyncLogService
|
||||
{
|
||||
/**
|
||||
* 查询MQTT云上本地同步日志
|
||||
*
|
||||
* @param id MQTT云上本地同步日志主键
|
||||
* @return MQTT云上本地同步日志
|
||||
*/
|
||||
public MqttSyncLog selectMqttSyncLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询MQTT云上本地同步日志列表
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return MQTT云上本地同步日志集合
|
||||
*/
|
||||
public List<MqttSyncLog> selectMqttSyncLogList(MqttSyncLog mqttSyncLog);
|
||||
|
||||
/**
|
||||
* 新增MQTT云上本地同步日志
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMqttSyncLog(MqttSyncLog mqttSyncLog);
|
||||
|
||||
/**
|
||||
* 修改MQTT云上本地同步日志
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMqttSyncLog(MqttSyncLog mqttSyncLog);
|
||||
|
||||
/**
|
||||
* 批量删除MQTT云上本地同步日志
|
||||
*
|
||||
* @param ids 需要删除的MQTT云上本地同步日志主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMqttSyncLogByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除MQTT云上本地同步日志信息
|
||||
*
|
||||
* @param id MQTT云上本地同步日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMqttSyncLogById(Long id);
|
||||
|
||||
// 处理策略信息
|
||||
public void handleMqttStrategyData(String payload);
|
||||
// 处理设备告警保护信息
|
||||
public void handleMqttPlanData(MqttSyncLog planLog);
|
||||
}
|
||||
@ -1,7 +1,13 @@
|
||||
package com.xzzn.ems.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.EmsStrategyRunning;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xzzn.ems.mapper.EmsFaultProtectionPlanMapper;
|
||||
@ -93,4 +99,44 @@ public class EmsFaultProtectionPlanServiceImpl implements IEmsFaultProtectionPla
|
||||
{
|
||||
return emsFaultProtectionPlanMapper.deleteEmsFaultProtectionPlanById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealSyncData(String content, String operateType) {
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EmsFaultProtectionPlan faultProtectionPlan = JSON.parseObject(content, EmsFaultProtectionPlan.class);
|
||||
switch(operateType) {
|
||||
case "INSERT":
|
||||
insertEmsFaultProtectionPlan(faultProtectionPlan);
|
||||
break;
|
||||
case "UPDATE":
|
||||
updateEmsFaultProtectionPlan(faultProtectionPlan);
|
||||
break;
|
||||
case "DELETE":
|
||||
// 根据站点+faultName+faultLevel 删除
|
||||
String siteId = faultProtectionPlan.getSiteId();
|
||||
String faultName = faultProtectionPlan.getFaultName();
|
||||
Integer faultLevel = faultProtectionPlan.getFaultLevel();
|
||||
emsFaultProtectionPlanMapper.deleteEmsFaultProtectionPlan(siteId, faultName, faultLevel);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static Long[] convertJsonToLongArray(String json) {
|
||||
// 解析 JSON 为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(json);
|
||||
// 获取 "id" 对应的 JSONArray
|
||||
JSONArray idArray = jsonObject.getJSONArray("id");
|
||||
|
||||
if (idArray == null) {
|
||||
return new Long[0]; // 数组不存在时返回空数组
|
||||
}
|
||||
|
||||
// 转换为 Long 数组
|
||||
return idArray.toArray(new Long[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,10 +71,32 @@ public class EmsStrategyServiceImpl implements IEmsStrategyService
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
return;
|
||||
}
|
||||
// switch (operateType) {
|
||||
// case "INSERT":
|
||||
// EmsStrategyRunning emsStrategyRunning = JSON.parseObject(content, EmsStrategyRunning.class);
|
||||
// emsStrategyRunningMapper.insertEmsStrategyRunning(emsStrategyRunning);
|
||||
// }
|
||||
EmsStrategyRunning emsStrategyRunning = JSON.parseObject(content, EmsStrategyRunning.class);
|
||||
switch (operateType) {
|
||||
case "INSERT":
|
||||
emsStrategyRunningMapper.insertEmsStrategyRunning(emsStrategyRunning);
|
||||
break;
|
||||
case "STOP":
|
||||
Long id = emsStrategyRunning.getId();
|
||||
emsStrategyRunningMapper.stopEmsStrategyRunning(id);
|
||||
break;
|
||||
case "UPDATE":
|
||||
String siteId = emsStrategyRunning.getSiteId();
|
||||
Long mainId = emsStrategyRunning.getMainStrategyId();
|
||||
Long auxId = emsStrategyRunning.getAuxiliaryStrategyId();
|
||||
EmsStrategyRunning existStrategy = emsStrategyRunningMapper.getRunningStrategy(siteId);
|
||||
if (existStrategy != null) { // 存在正在运行的则更新
|
||||
existStrategy.setMainStrategyId(mainId);
|
||||
existStrategy.setAuxiliaryStrategyId(auxId);
|
||||
emsStrategyRunningMapper.updateEmsStrategyRunning(emsStrategyRunning);
|
||||
} else { // 不存在着插入
|
||||
emsStrategyRunning.setCreateTime(DateUtils.getNowDate());
|
||||
emsStrategyRunningMapper.insertEmsStrategyRunning(emsStrategyRunning);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// 未知操作类型-不同步
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,150 @@
|
||||
package com.xzzn.ems.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.service.IEmsFaultProtectionPlanService;
|
||||
import com.xzzn.ems.service.IEmsStrategyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xzzn.ems.mapper.MqttSyncLogMapper;
|
||||
import com.xzzn.ems.domain.MqttSyncLog;
|
||||
import com.xzzn.ems.service.IMqttSyncLogService;
|
||||
|
||||
/**
|
||||
* MQTT云上本地同步日志Service业务层处理
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-11-12
|
||||
*/
|
||||
@Service
|
||||
public class MqttSyncLogServiceImpl implements IMqttSyncLogService
|
||||
{
|
||||
@Autowired
|
||||
private MqttSyncLogMapper mqttSyncLogMapper;
|
||||
@Autowired
|
||||
private IEmsFaultProtectionPlanService emsFaultProtectionPlanService;
|
||||
@Autowired
|
||||
private IEmsStrategyService emsStrategyService;
|
||||
|
||||
/**
|
||||
* 查询MQTT云上本地同步日志
|
||||
*
|
||||
* @param id MQTT云上本地同步日志主键
|
||||
* @return MQTT云上本地同步日志
|
||||
*/
|
||||
@Override
|
||||
public MqttSyncLog selectMqttSyncLogById(Long id)
|
||||
{
|
||||
return mqttSyncLogMapper.selectMqttSyncLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询MQTT云上本地同步日志列表
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return MQTT云上本地同步日志
|
||||
*/
|
||||
@Override
|
||||
public List<MqttSyncLog> selectMqttSyncLogList(MqttSyncLog mqttSyncLog)
|
||||
{
|
||||
return mqttSyncLogMapper.selectMqttSyncLogList(mqttSyncLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增MQTT云上本地同步日志
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMqttSyncLog(MqttSyncLog mqttSyncLog)
|
||||
{
|
||||
mqttSyncLog.setCreateTime(DateUtils.getNowDate());
|
||||
return mqttSyncLogMapper.insertMqttSyncLog(mqttSyncLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改MQTT云上本地同步日志
|
||||
*
|
||||
* @param mqttSyncLog MQTT云上本地同步日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMqttSyncLog(MqttSyncLog mqttSyncLog)
|
||||
{
|
||||
return mqttSyncLogMapper.updateMqttSyncLog(mqttSyncLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除MQTT云上本地同步日志
|
||||
*
|
||||
* @param ids 需要删除的MQTT云上本地同步日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMqttSyncLogByIds(Long[] ids)
|
||||
{
|
||||
return mqttSyncLogMapper.deleteMqttSyncLogByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除MQTT云上本地同步日志信息
|
||||
*
|
||||
* @param id MQTT云上本地同步日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMqttSyncLogById(Long id)
|
||||
{
|
||||
return mqttSyncLogMapper.deleteMqttSyncLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理云上运行策略数据
|
||||
* @param payload
|
||||
*/
|
||||
@Override
|
||||
public void handleMqttStrategyData(String payload) {
|
||||
MqttSyncLog syncLog = JSON.parseObject(payload, MqttSyncLog.class);
|
||||
if (syncLog != null) {
|
||||
// 校验是否存在
|
||||
String syncId = syncLog.getSyncId();
|
||||
MqttSyncLog existLog = mqttSyncLogMapper.selectMqttSyncLogBySyncId(syncId);
|
||||
if (existLog == null) {
|
||||
// 根据不同操作更新
|
||||
String operateType = syncLog.getOperateType();
|
||||
if (!StringUtils.isEmpty(operateType)) {
|
||||
emsStrategyService.dealStrategyData(syncLog.getContent(),operateType);
|
||||
}
|
||||
}
|
||||
// 保存日志
|
||||
insertMqttSyncLog(syncLog);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理云上同步的告警保护信息
|
||||
* @param planLog
|
||||
*/
|
||||
@Override
|
||||
public void handleMqttPlanData(MqttSyncLog planLog) {
|
||||
// 校验是否存在
|
||||
String syncId = planLog.getSyncId();
|
||||
MqttSyncLog existLog = mqttSyncLogMapper.selectMqttSyncLogBySyncId(syncId);
|
||||
if (existLog != null) {
|
||||
return;
|
||||
}
|
||||
// 保存日志
|
||||
insertMqttSyncLog(planLog);
|
||||
|
||||
// 处理数据
|
||||
String operateType = planLog.getOperateType();
|
||||
if (!StringUtils.isEmpty(operateType)) {
|
||||
emsFaultProtectionPlanService.dealSyncData(planLog.getContent(),operateType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -114,4 +114,11 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsFaultProtectionPlan">
|
||||
delete from ems_fault_protection_plan
|
||||
where site_id = #{siteId}
|
||||
and fault_name = #{faultName}
|
||||
and fault_level = #{faultLevel}
|
||||
</delete>
|
||||
</mapper>
|
||||
100
ems-system/src/main/resources/mapper/ems/MqttSyncLogMapper.xml
Normal file
100
ems-system/src/main/resources/mapper/ems/MqttSyncLogMapper.xml
Normal file
@ -0,0 +1,100 @@
|
||||
<?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.MqttSyncLogMapper">
|
||||
|
||||
<resultMap type="MqttSyncLog" id="MqttSyncLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="syncId" column="sync_id" />
|
||||
<result property="topic" column="topic" />
|
||||
<result property="operateType" column="operate_type" />
|
||||
<result property="tableName" column="table_name" />
|
||||
<result property="content" column="content" />
|
||||
<result property="status" column="status" />
|
||||
<result property="errorMsg" column="error_msg" />
|
||||
<result property="target" column="target" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMqttSyncLogVo">
|
||||
select id, sync_id, topic, operate_type, table_name, content, status, error_msg, target, create_time from mqtt_sync_log
|
||||
</sql>
|
||||
|
||||
<select id="selectMqttSyncLogList" parameterType="MqttSyncLog" resultMap="MqttSyncLogResult">
|
||||
<include refid="selectMqttSyncLogVo"/>
|
||||
<where>
|
||||
<if test="syncId != null and syncId != ''"> and sync_id = #{syncId}</if>
|
||||
<if test="topic != null and topic != ''"> and topic = #{topic}</if>
|
||||
<if test="operateType != null and operateType != ''"> and operate_type = #{operateType}</if>
|
||||
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
|
||||
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="errorMsg != null and errorMsg != ''"> and error_msg = #{errorMsg}</if>
|
||||
<if test="target != null and target != ''"> and target = #{target}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMqttSyncLogById" parameterType="Long" resultMap="MqttSyncLogResult">
|
||||
<include refid="selectMqttSyncLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertMqttSyncLog" parameterType="MqttSyncLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mqtt_sync_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="syncId != null and syncId != ''">sync_id,</if>
|
||||
<if test="topic != null and topic != ''">topic,</if>
|
||||
<if test="operateType != null and operateType != ''">operate_type,</if>
|
||||
<if test="tableName != null and tableName != ''">table_name,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="errorMsg != null">error_msg,</if>
|
||||
<if test="target != null">target,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="syncId != null and syncId != ''">#{syncId},</if>
|
||||
<if test="topic != null and topic != ''">#{topic},</if>
|
||||
<if test="operateType != null and operateType != ''">#{operateType},</if>
|
||||
<if test="tableName != null and tableName != ''">#{tableName},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="errorMsg != null">#{errorMsg},</if>
|
||||
<if test="target != null">#{target},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMqttSyncLog" parameterType="MqttSyncLog">
|
||||
update mqtt_sync_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="syncId != null and syncId != ''">sync_id = #{syncId},</if>
|
||||
<if test="topic != null and topic != ''">topic = #{topic},</if>
|
||||
<if test="operateType != null and operateType != ''">operate_type = #{operateType},</if>
|
||||
<if test="tableName != null and tableName != ''">table_name = #{tableName},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="errorMsg != null">error_msg = #{errorMsg},</if>
|
||||
<if test="target != null">target = #{target},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMqttSyncLogById" parameterType="Long">
|
||||
delete from mqtt_sync_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMqttSyncLogByIds" parameterType="String">
|
||||
delete from mqtt_sync_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectMqttSyncLogBySyncId" parameterType="String" resultMap="MqttSyncLogResult">
|
||||
<include refid="selectMqttSyncLogVo"/>
|
||||
where sync_id = #{syncId}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user