mqtt配置修改

This commit is contained in:
2025-11-11 10:37:04 +08:00
parent 43edc47aaa
commit 5381cd597c
4 changed files with 135 additions and 30 deletions

View File

@ -14,7 +14,6 @@ import com.xzzn.common.annotation.Excel;
public class EmsMqttTopicConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
@ -22,13 +21,21 @@ public class EmsMqttTopicConfig extends BaseEntity
@Excel(name = "订阅topic")
private String mqttTopic;
/** QoS等级0/1/2 */
@Excel(name = "QoS等级", readConverterExp = "0=/1/2")
private Integer qos;
/** topic描述 */
@Excel(name = "topic描述")
private String topicName;
/** 对应方法 */
@Excel(name = "对应方法")
private String method;
private String handleMethod;
/** 处理器类型:(device=设备数据system=系统状态alarm=告警数据等) */
@Excel(name = "处理器类型:(device=设备数据system=系统状态alarm=告警数据等)")
private String handleType;
/** 站点id */
@Excel(name = "站点id")
@ -54,6 +61,16 @@ public class EmsMqttTopicConfig extends BaseEntity
return mqttTopic;
}
public void setQos(Integer qos)
{
this.qos = qos;
}
public Integer getQos()
{
return qos;
}
public void setTopicName(String topicName)
{
this.topicName = topicName;
@ -64,14 +81,24 @@ public class EmsMqttTopicConfig extends BaseEntity
return topicName;
}
public void setMethod(String method)
public void setHandleMethod(String handleMethod)
{
this.method = method;
this.handleMethod = handleMethod;
}
public String getMethod()
public String getHandleMethod()
{
return method;
return handleMethod;
}
public void setHandleType(String handleType)
{
this.handleType = handleType;
}
public String getHandleType()
{
return handleType;
}
public void setSiteId(String siteId)
@ -89,8 +116,10 @@ public class EmsMqttTopicConfig extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("mqttTopic", getMqttTopic())
.append("qos", getQos())
.append("topicName", getTopicName())
.append("method", getMethod())
.append("handleMethod", getHandleMethod())
.append("handleType", getHandleType())
.append("siteId", getSiteId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())

View File

@ -58,4 +58,7 @@ public interface EmsMqttTopicConfigMapper
* @return 结果
*/
public int deleteEmsMqttTopicConfigByIds(Long[] ids);
// 判断topic是否存在
public String checkTopicIsExist(String strategyTopic);
}

View File

@ -7,8 +7,10 @@
<resultMap type="EmsMqttTopicConfig" id="EmsMqttTopicConfigResult">
<result property="id" column="id" />
<result property="mqttTopic" column="mqtt_topic" />
<result property="qos" column="qos" />
<result property="topicName" column="topic_name" />
<result property="method" column="method" />
<result property="handleMethod" column="handle_method" />
<result property="handleType" column="handle_type" />
<result property="siteId" column="siteId" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -17,15 +19,17 @@
</resultMap>
<sql id="selectEmsMqttTopicConfigVo">
select id, mqtt_topic, topic_name, method, siteId, create_by, create_time, update_by, update_time from ems_mqtt_topic_config
select id, mqtt_topic, qos, topic_name, handle_method, handle_type, siteId, create_by, create_time, update_by, update_time from ems_mqtt_topic_config
</sql>
<select id="selectEmsMqttTopicConfigList" parameterType="EmsMqttTopicConfig" resultMap="EmsMqttTopicConfigResult">
<include refid="selectEmsMqttTopicConfigVo"/>
<where>
<if test="mqttTopic != null and mqttTopic != ''"> and mqtt_topic like concat('%', #{mqttTopic}, '%')</if>
<if test="mqttTopic != null and mqttTopic != ''"> and mqtt_topic = #{mqttTopic}</if>
<if test="qos != null "> and qos = #{qos}</if>
<if test="topicName != null and topicName != ''"> and topic_name like concat('%', #{topicName}, '%')</if>
<if test="method != null and method != ''"> and method = #{method}</if>
<if test="handleMethod != null and handleMethod != ''"> and handle_method = #{handleMethod}</if>
<if test="handleType != null and handleType != ''"> and handle_type = #{handleType}</if>
<if test="siteId != null and siteId != ''"> and siteId = #{siteId}</if>
</where>
</select>
@ -39,8 +43,10 @@
insert into ems_mqtt_topic_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mqttTopic != null">mqtt_topic,</if>
<if test="qos != null">qos,</if>
<if test="topicName != null">topic_name,</if>
<if test="method != null">method,</if>
<if test="handleMethod != null">handle_method,</if>
<if test="handleType != null">handle_type,</if>
<if test="siteId != null">siteId,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -49,8 +55,10 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mqttTopic != null">#{mqttTopic},</if>
<if test="qos != null">#{qos},</if>
<if test="topicName != null">#{topicName},</if>
<if test="method != null">#{method},</if>
<if test="handleMethod != null">#{handleMethod},</if>
<if test="handleType != null">#{handleType},</if>
<if test="siteId != null">#{siteId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -63,8 +71,10 @@
update ems_mqtt_topic_config
<trim prefix="SET" suffixOverrides=",">
<if test="mqttTopic != null">mqtt_topic = #{mqttTopic},</if>
<if test="qos != null">qos = #{qos},</if>
<if test="topicName != null">topic_name = #{topicName},</if>
<if test="method != null">method = #{method},</if>
<if test="handleMethod != null">handle_method = #{handleMethod},</if>
<if test="handleType != null">handle_type = #{handleType},</if>
<if test="siteId != null">siteId = #{siteId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
@ -84,4 +94,10 @@
#{id}
</foreach>
</delete>
<select id="checkTopicIsExist" parameterType="String" resultType="String">
select mqtt_topic as topic
from ems_mqtt_topic_config
where mqtt_topic = #{strategyTopic}
</select>
</mapper>