2025-09-23 18:21:05 +08:00
|
|
|
<?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">
|
2025-11-24 16:19:09 +08:00
|
|
|
<mapper namespace="com.tongran.rocketmq.mapper.InitialSwitchOtherCollectDataMapper">
|
2025-09-23 18:21:05 +08:00
|
|
|
|
|
|
|
|
<resultMap type="InitialSwitchOtherCollectData" id="InitialSwitchOtherCollectDataResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="clientId" column="client_id" />
|
|
|
|
|
<result property="collectType" column="collect_type" />
|
|
|
|
|
<result property="collectValue" column="collect_value" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectInitialSwitchOtherCollectDataVo">
|
|
|
|
|
select id, client_id, collect_type, collect_value, create_time, update_time, create_by, update_by from initial_switch_other_collect_data
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectInitialSwitchOtherCollectDataList" parameterType="InitialSwitchOtherCollectData" resultMap="InitialSwitchOtherCollectDataResult">
|
|
|
|
|
<include refid="selectInitialSwitchOtherCollectDataVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
|
|
|
|
<if test="collectType != null and collectType != ''"> and collect_type = #{collectType}</if>
|
|
|
|
|
<if test="collectValue != null and collectValue != ''"> and collect_value = #{collectValue}</if>
|
2025-10-11 17:54:17 +08:00
|
|
|
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
|
|
|
|
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
2025-09-23 18:21:05 +08:00
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectInitialSwitchOtherCollectDataById" parameterType="Long" resultMap="InitialSwitchOtherCollectDataResult">
|
|
|
|
|
<include refid="selectInitialSwitchOtherCollectDataVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertInitialSwitchOtherCollectData" parameterType="InitialSwitchOtherCollectData" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert IGNORE into initial_switch_other_collect_data
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="clientId != null and clientId != ''">client_id,</if>
|
|
|
|
|
<if test="collectType != null and collectType != ''">collect_type,</if>
|
|
|
|
|
<if test="collectValue != null">collect_value,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
|
|
|
|
<if test="collectType != null and collectType != ''">#{collectType},</if>
|
|
|
|
|
<if test="collectValue != null">#{collectValue},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateInitialSwitchOtherCollectData" parameterType="InitialSwitchOtherCollectData">
|
|
|
|
|
update initial_switch_other_collect_data
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
|
|
|
|
|
<if test="collectType != null and collectType != ''">collect_type = #{collectType},</if>
|
|
|
|
|
<if test="collectValue != null">collect_value = #{collectValue},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteInitialSwitchOtherCollectDataById" parameterType="Long">
|
|
|
|
|
delete from initial_switch_other_collect_data where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteInitialSwitchOtherCollectDataByIds" parameterType="String">
|
|
|
|
|
delete from initial_switch_other_collect_data where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2025-10-14 18:17:31 +08:00
|
|
|
<select id="getSwitchMonitorMsg" parameterType="InitialSwitchOtherCollectData" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'sysDescr' THEN t.collect_value END) as sysDescr,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'sysObjectID' THEN t.collect_value END) as sysObjectID,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'sysUpTime' THEN t.collect_value END) as sysUpTime,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'sysContact' THEN t.collect_value END) as sysContact,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'sysName' THEN t.collect_value END) as sysName,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'sysLocation' THEN t.collect_value END) as sysLocation,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'hwStackSystemMac' THEN t.collect_value END) as hwStackSystemMac,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'entIndex' THEN t.collect_value END) as entIndex,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'entPhysicalName' THEN t.collect_value END) as entPhysicalName,
|
|
|
|
|
MAX(CASE WHEN t.collect_type = 'entPhysicalSoftwareRev' THEN t.collect_value END) as entPhysicalSoftwareRev
|
|
|
|
|
FROM `initial_switch_other_collect_data` t
|
2025-11-07 10:21:44 +08:00
|
|
|
INNER JOIN (
|
|
|
|
|
SELECT collect_type, MAX(create_time) as max_time
|
2025-10-14 18:17:31 +08:00
|
|
|
FROM `initial_switch_other_collect_data`
|
|
|
|
|
WHERE client_id = #{clientId}
|
2025-11-07 10:21:44 +08:00
|
|
|
GROUP BY collect_type
|
|
|
|
|
) latest ON t.collect_type = latest.collect_type AND t.create_time = latest.max_time
|
2025-10-14 18:17:31 +08:00
|
|
|
WHERE t.client_id = #{clientId}
|
|
|
|
|
</select>
|
2025-12-24 19:55:47 +08:00
|
|
|
<delete id="deleteInitialSwitchOtherCollectData" parameterType="Long">
|
|
|
|
|
delete from initial_switch_other_collect_data
|
|
|
|
|
<where>
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="clientId != null and collectType != null and createTime != null">
|
|
|
|
|
AND client_id = #{clientId}
|
|
|
|
|
AND collect_type = #{collectType}
|
|
|
|
|
AND create_time < #{createTime}
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
and 1=0
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</where>
|
|
|
|
|
</delete>
|
2025-09-23 18:21:05 +08:00
|
|
|
</mapper>
|