Files
saas-houduan/tongran-rocketmq/src/main/resources/mapper/rocketmq/InitialSystemOtherCollectDataMapper.xml
T
gaoyutao a5b5f5b08d 1、mtr探测设备增加并发限制。
2、开发防火墙策略区分ipv4和ipv6。
3、脚本执行策略下发时间优化。
2025-12-03 19:18:12 +08:00

120 lines
6.7 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.tongran.rocketmq.mapper.InitialSystemOtherCollectDataMapper">
<resultMap type="InitialSystemOtherCollectData" id="InitialSystemOtherCollectDataResult">
<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="selectInitialSystemOtherCollectDataVo">
select id, client_id, collect_type, collect_value, create_time, update_time, create_by, update_by from initial_system_other_collect_data
</sql>
<select id="selectInitialSystemOtherCollectDataList" parameterType="InitialSystemOtherCollectData" resultMap="InitialSystemOtherCollectDataResult">
<include refid="selectInitialSystemOtherCollectDataVo"/>
<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>
<if test="startTime != null and startTime != ''"> and create_time &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
</where>
</select>
<select id="selectInitialSystemOtherCollectDataById" parameterType="Long" resultMap="InitialSystemOtherCollectDataResult">
<include refid="selectInitialSystemOtherCollectDataVo"/>
where id = #{id}
</select>
<insert id="insertInitialSystemOtherCollectData" parameterType="InitialSystemOtherCollectData" useGeneratedKeys="true" keyProperty="id">
insert IGNORE into initial_system_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="updateInitialSystemOtherCollectData" parameterType="InitialSystemOtherCollectData">
update initial_system_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="deleteInitialSystemOtherCollectDataById" parameterType="Long">
delete from initial_system_other_collect_data where id = #{id}
</delete>
<delete id="deleteInitialSystemOtherCollectDataByIds" parameterType="String">
delete from initial_system_other_collect_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getMonitorMsg" parameterType="InitialSystemOtherCollectData" resultType="java.util.Map">
SELECT
MAX(CASE WHEN t.collect_type = 'memorySizeTotalCollect' THEN t.collect_value END) as memorySizeTotalCollect,
MAX(CASE WHEN t.collect_type = 'systemSwOsCollect' THEN t.collect_value END) as systemSwOsCollect,
MAX(CASE WHEN t.collect_type = 'systemSwArchCollect' THEN t.collect_value END) as systemSwArchCollect,
MAX(CASE WHEN t.collect_type = 'kernelMaxprocCollect' THEN t.collect_value END) as kernelMaxprocCollect,
MAX(CASE WHEN t.collect_type = 'systemDiskSizeTotalCollect' THEN t.collect_value END) as systemDiskSizeTotalCollect,
MAX(CASE WHEN t.collect_type = 'systemBoottimeCollect' THEN t.collect_value END) as systemBoottimeCollect,
MAX(CASE WHEN t.collect_type = 'systemUnameCollect' THEN t.collect_value END) as systemUnameCollect,
MAX(CASE WHEN t.collect_type = 'systemLocaltimeCollect' THEN t.collect_value END) as systemLocaltimeCollect,
MAX(CASE WHEN t.collect_type = 'systemUptimeCollect' THEN t.collect_value END) as systemUptimeCollect
FROM `initial_system_other_collect_data` t
INNER JOIN (
SELECT collect_type, MAX(create_time) as max_time
FROM `initial_system_other_collect_data`
WHERE client_id = #{clientId}
GROUP BY collect_type
) latest ON t.collect_type = latest.collect_type AND t.create_time = latest.max_time
WHERE t.client_id = #{clientId}
</select>
<delete id="deleteInitialSystemOtherCollectData" parameterType="InitialSystemOtherCollectData">
delete from initial_system_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 &lt; #{createTime}
</when>
<otherwise>
and 1=0
</otherwise>
</choose>
</where>
</delete>
</mapper>