Files
emsback/ems-system/src/main/resources/mapper/ems/MqttSyncLogMapper.xml
2025-11-17 02:47:43 +08:00

105 lines
5.4 KiB
XML

<?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="syncObject" column="sync_object" />
<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, sync_object, 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="syncObject != null and syncObject != ''"> and sync_object = #{syncObject}</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="syncObject != null">sync_object,</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="syncObject != null">#{syncObject},</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="syncObject != null">sync_object = #{syncObject},</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>