资源模板以及资源策略模块方法和接口。

This commit is contained in:
gaoyutao
2025-09-11 17:57:51 +08:00
parent df7ed79fcb
commit 3dc8b2c2c6
59 changed files with 3523 additions and 184 deletions
@@ -105,21 +105,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insert" parameterType="InitialBandwidthTraffic">
INSERT INTO ${tableName} (
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
`in_speed`, `out_speed`, create_by, update_by, client_id, create_time
`in_speed`, `out_speed`, duplex, speed, create_by, update_by, client_id, create_time
) VALUES (
#{name}, #{mac}, #{status}, #{type}, #{ipV4}, #{inDropped}, #{outDropped},
#{inSpeed}, #{outSpeed}, #{createBy}, #{updateBy}, #{clientId}, #{createTime}
#{inSpeed}, #{outSpeed}, #{duplex}, #{speed}, #{createBy}, #{updateBy}, #{clientId}, #{createTime}
)
</insert>
<insert id="batchInsert" parameterType="InitialBandwidthTraffic">
INSERT IGNORE INTO ${tableName} (
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
`in_speed`, `out_speed`,create_by, update_by, client_id, create_time
`in_speed`, `out_speed`,duplex, speed, create_by, update_by, client_id, create_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.name}, #{item.mac}, #{item.status}, #{item.type}, #{item.ipV4}, #{item.inDropped}, #{item.outDropped},
#{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime}
#{item.inSpeed}, #{item.outSpeed}, #{item.duplex}, #{item.speed}, #{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime}
)
</foreach>
</insert>
@@ -0,0 +1,119 @@
<?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.ruoyi.rocketmq.mapper.RmInitialMonitorItemMapper">
<resultMap type="RmInitialMonitorItem" id="RmInitialMonitorItemResult">
<result property="id" column="id" />
<result property="itemType" column="item_type" />
<result property="metricKey" column="metric_key" />
<result property="metricName" column="metric_name" />
<result property="oid" column="oid" />
<result property="filterValue" column="filter_value" />
<result property="monitorDescription" column="monitor_description" />
<result property="dataType" column="data_type" />
<result property="resourceType" column="resource_type" />
<result property="collectionCycle" column="collection_cycle" />
<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="selectRmInitialMonitorItemVo">
select id, item_type, metric_key, metric_name, oid, filter_value, monitor_description, data_type, resource_type, collection_cycle, create_time, update_time, create_by, update_by from rm_initial_monitor_item
</sql>
<select id="selectRmInitialMonitorItemList" parameterType="RmInitialMonitorItem" resultMap="RmInitialMonitorItemResult">
<include refid="selectRmInitialMonitorItemVo"/>
<where>
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
<if test="metricKey != null and metricKey != ''"> and metric_key = #{metricKey}</if>
<if test="metricName != null and metricName != ''"> and metric_name like concat('%', #{metricName}, '%')</if>
<if test="oid != null and oid != ''"> and oid = #{oid}</if>
<if test="filterValue != null and filterValue != ''"> and filter_value = #{filterValue}</if>
<if test="monitorDescription != null and monitorDescription != ''"> and monitor_description = #{monitorDescription}</if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="collectionCycle != null and collectionCycle != ''"> and collection_cycle = #{collectionCycle}</if>
</where>
</select>
<select id="selectRmInitialMonitorItemById" parameterType="Long" resultMap="RmInitialMonitorItemResult">
<include refid="selectRmInitialMonitorItemVo"/>
where id = #{id}
</select>
<insert id="insertRmInitialMonitorItem" parameterType="RmInitialMonitorItem" useGeneratedKeys="true" keyProperty="id">
insert into rm_initial_monitor_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="itemType != null and itemType != ''">item_type,</if>
<if test="metricKey != null and metricKey != ''">metric_key,</if>
<if test="metricName != null and metricName != ''">metric_name,</if>
<if test="oid != null">oid,</if>
<if test="filterValue != null">filter_value,</if>
<if test="monitorDescription != null">monitor_description,</if>
<if test="dataType != null and dataType != ''">data_type,</if>
<if test="resourceType != null and resourceType != ''">resource_type,</if>
<if test="collectionCycle != null">collection_cycle,</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="itemType != null and itemType != ''">#{itemType},</if>
<if test="metricKey != null and metricKey != ''">#{metricKey},</if>
<if test="metricName != null and metricName != ''">#{metricName},</if>
<if test="oid != null">#{oid},</if>
<if test="filterValue != null">#{filterValue},</if>
<if test="monitorDescription != null">#{monitorDescription},</if>
<if test="dataType != null and dataType != ''">#{dataType},</if>
<if test="resourceType != null and resourceType != ''">#{resourceType},</if>
<if test="collectionCycle != null">#{collectionCycle},</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="updateRmInitialMonitorItem" parameterType="RmInitialMonitorItem">
update rm_initial_monitor_item
<trim prefix="SET" suffixOverrides=",">
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
<if test="metricKey != null and metricKey != ''">metric_key = #{metricKey},</if>
<if test="metricName != null and metricName != ''">metric_name = #{metricName},</if>
<if test="oid != null">oid = #{oid},</if>
<if test="filterValue != null">filter_value = #{filterValue},</if>
<if test="monitorDescription != null">monitor_description = #{monitorDescription},</if>
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
<if test="resourceType != null and resourceType != ''">resource_type = #{resourceType},</if>
<if test="collectionCycle != null">collection_cycle = #{collectionCycle},</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="deleteRmInitialMonitorItemById" parameterType="Long">
delete from rm_initial_monitor_item where id = #{id}
</delete>
<delete id="deleteRmInitialMonitorItemByIds" parameterType="String">
delete from rm_initial_monitor_item where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectRmInitialMonitorItemByIds" parameterType="java.lang.Long" resultMap="RmInitialMonitorItemResult">
<include refid="selectRmInitialMonitorItemVo"/>
where id in
<foreach item="id" collection="monitorIds" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>
@@ -0,0 +1,97 @@
<?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.ruoyi.rocketmq.mapper.RmMonitorPolicyMapper">
<resultMap type="RmMonitorPolicy" id="RmMonitorPolicyResult">
<result property="id" column="id" />
<result property="templateId" column="template_id" />
<result property="resourceGroupId" column="resource_group_id" />
<result property="policyName" column="policy_name" />
<result property="description" column="description" />
<result property="status" column="status" />
<result property="deployTime" column="deploy_time" />
<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="selectRmMonitorPolicyVo">
select id, template_id, resource_group_id, policy_name, description, status, deploy_time, create_time, update_time, create_by, update_by from rm_monitor_policy
</sql>
<select id="selectRmMonitorPolicyList" parameterType="RmMonitorPolicy" resultMap="RmMonitorPolicyResult">
<include refid="selectRmMonitorPolicyVo"/>
<where>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="resourceGroupId != null "> and resource_group_id = #{resourceGroupId}</if>
<if test="policyName != null and policyName != ''"> and policy_name like concat('%', #{policyName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="deployTime != null "> and deploy_time = #{deployTime}</if>
</where>
</select>
<select id="selectRmMonitorPolicyById" parameterType="Long" resultMap="RmMonitorPolicyResult">
<include refid="selectRmMonitorPolicyVo"/>
where id = #{id}
</select>
<insert id="insertRmMonitorPolicy" parameterType="RmMonitorPolicy" useGeneratedKeys="true" keyProperty="id">
insert into rm_monitor_policy
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateId != null">template_id,</if>
<if test="resourceGroupId != null">resource_group_id,</if>
<if test="policyName != null and policyName != ''">policy_name,</if>
<if test="description != null">description,</if>
<if test="status != null and status != ''">status,</if>
<if test="deployTime != null">deploy_time,</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="templateId != null">#{templateId},</if>
<if test="resourceGroupId != null">#{resourceGroupId},</if>
<if test="policyName != null and policyName != ''">#{policyName},</if>
<if test="description != null">#{description},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="deployTime != null">#{deployTime},</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="updateRmMonitorPolicy" parameterType="RmMonitorPolicy">
update rm_monitor_policy
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null">template_id = #{templateId},</if>
<if test="resourceGroupId != null">resource_group_id = #{resourceGroupId},</if>
<if test="policyName != null and policyName != ''">policy_name = #{policyName},</if>
<if test="description != null">description = #{description},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="deployTime != null">deploy_time = #{deployTime},</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="deleteRmMonitorPolicyById" parameterType="Long">
delete from rm_monitor_policy where id = #{id}
</delete>
<delete id="deleteRmMonitorPolicyByIds" parameterType="String">
delete from rm_monitor_policy where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,97 @@
<?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.ruoyi.rocketmq.mapper.RmMonitorTemplateMapper">
<resultMap type="RmMonitorTemplate" id="RmMonitorTemplateResult">
<result property="id" column="id" />
<result property="templateName" column="template_name" />
<result property="description" column="description" />
<result property="monitorItems" column="monitor_items" />
<result property="discoveryRules" column="discovery_rules" />
<result property="resourceGroupId" column="resource_group_id" />
<result property="resourcyType" column="resourcy_type" />
<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="selectRmMonitorTemplateVo">
select id, template_name, description, monitor_items, discovery_rules, resource_group_id, resourcy_type, create_time, update_time, create_by, update_by from rm_monitor_template
</sql>
<select id="selectRmMonitorTemplateList" parameterType="RmMonitorTemplate" resultMap="RmMonitorTemplateResult">
<include refid="selectRmMonitorTemplateVo"/>
<where>
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="monitorItems != null and monitorItems != ''"> and monitor_items = #{monitorItems}</if>
<if test="discoveryRules != null and discoveryRules != ''"> and discovery_rules = #{discoveryRules}</if>
<if test="resourceGroupId != null "> and resource_group_id = #{resourceGroupId}</if>
<if test="resourcyType != null and resourcyType != ''"> and resourcy_type = #{resourcyType}</if>
</where>
</select>
<select id="selectRmMonitorTemplateById" parameterType="Long" resultMap="RmMonitorTemplateResult">
<include refid="selectRmMonitorTemplateVo"/>
where id = #{id}
</select>
<insert id="insertRmMonitorTemplate" parameterType="RmMonitorTemplate" useGeneratedKeys="true" keyProperty="id">
insert into rm_monitor_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateName != null and templateName != ''">template_name,</if>
<if test="description != null">description,</if>
<if test="monitorItems != null">monitor_items,</if>
<if test="discoveryRules != null">discovery_rules,</if>
<if test="resourceGroupId != null">resource_group_id,</if>
<if test="resourcyType != null">resourcy_type,</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="templateName != null and templateName != ''">#{templateName},</if>
<if test="description != null">#{description},</if>
<if test="monitorItems != null">#{monitorItems},</if>
<if test="discoveryRules != null">#{discoveryRules},</if>
<if test="resourceGroupId != null">#{resourceGroupId},</if>
<if test="resourcyType != null">#{resourcyType},</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="updateRmMonitorTemplate" parameterType="RmMonitorTemplate">
update rm_monitor_template
<trim prefix="SET" suffixOverrides=",">
<if test="templateName != null and templateName != ''">template_name = #{templateName},</if>
<if test="description != null">description = #{description},</if>
<if test="monitorItems != null">monitor_items = #{monitorItems},</if>
<if test="discoveryRules != null">discovery_rules = #{discoveryRules},</if>
<if test="resourceGroupId != null">resource_group_id = #{resourceGroupId},</if>
<if test="resourcyType != null">resourcy_type = #{resourcyType},</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="deleteRmMonitorTemplateById" parameterType="Long">
delete from rm_monitor_template where id = #{id}
</delete>
<delete id="deleteRmMonitorTemplateByIds" parameterType="String">
delete from rm_monitor_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,128 @@
<?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.ruoyi.rocketmq.mapper.RmTemplateLinuxMapper">
<resultMap type="RmTemplateLinux" id="RmTemplateLinuxResult">
<result property="id" column="id" />
<result property="templateId" column="template_id" />
<result property="policyId" column="policy_id" />
<result property="itemType" column="item_type" />
<result property="metricKey" column="metric_key" />
<result property="metricName" column="metric_name" />
<result property="dataType" column="data_type" />
<result property="monitorStatus" column="monitor_status" />
<result property="collectionCycle" column="collection_cycle" />
<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="selectRmTemplateLinuxVo">
select id, template_id, policy_id, item_type, metric_key, metric_name, data_type, monitor_status, collection_cycle, create_time, update_time, create_by, update_by from rm_template_linux
</sql>
<select id="selectRmTemplateLinuxList" parameterType="RmTemplateLinux" resultMap="RmTemplateLinuxResult">
<include refid="selectRmTemplateLinuxVo"/>
<where>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="policyId != null "> and policy_id = #{policyId}</if>
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
<if test="metricKey != null and metricKey != ''"> and metric_key = #{metricKey}</if>
<if test="metricName != null and metricName != ''"> and metric_name like concat('%', #{metricName}, '%')</if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
<if test="monitorStatus != null and monitorStatus != ''"> and monitor_status = #{monitorStatus}</if>
<if test="collectionCycle != null and collectionCycle != ''"> and collection_cycle = #{collectionCycle}</if>
</where>
</select>
<select id="selectRmTemplateLinuxById" parameterType="Long" resultMap="RmTemplateLinuxResult">
<include refid="selectRmTemplateLinuxVo"/>
where id = #{id}
</select>
<insert id="insertRmTemplateLinux" parameterType="RmTemplateLinux" useGeneratedKeys="true" keyProperty="id">
insert into rm_template_linux
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateId != null">template_id,</if>
<if test="policyId != null">policy_id,</if>
<if test="itemType != null and itemType != ''">item_type,</if>
<if test="metricKey != null and metricKey != ''">metric_key,</if>
<if test="metricName != null and metricName != ''">metric_name,</if>
<if test="dataType != null and dataType != ''">data_type,</if>
<if test="monitorStatus != null">monitor_status,</if>
<if test="collectionCycle != null">collection_cycle,</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="templateId != null">#{templateId},</if>
<if test="policyId != null">#{policyId},</if>
<if test="itemType != null and itemType != ''">#{itemType},</if>
<if test="metricKey != null and metricKey != ''">#{metricKey},</if>
<if test="metricName != null and metricName != ''">#{metricName},</if>
<if test="dataType != null and dataType != ''">#{dataType},</if>
<if test="monitorStatus != null">#{monitorStatus},</if>
<if test="collectionCycle != null">#{collectionCycle},</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="updateRmTemplateLinux" parameterType="RmTemplateLinux">
update rm_template_linux
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null">template_id = #{templateId},</if>
<if test="policyId != null">policy_id = #{policyId},</if>
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
<if test="metricKey != null and metricKey != ''">metric_key = #{metricKey},</if>
<if test="metricName != null and metricName != ''">metric_name = #{metricName},</if>
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
<if test="monitorStatus != null">monitor_status = #{monitorStatus},</if>
<if test="collectionCycle != null">collection_cycle = #{collectionCycle},</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="deleteRmTemplateLinuxById" parameterType="Long">
delete from rm_template_linux where id = #{id}
</delete>
<delete id="deleteRmTemplateLinuxByIds" parameterType="String">
delete from rm_template_linux where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsertRmTemplateLinux" parameterType="list">
insert into rm_template_linux
(template_id, policy_id, item_type, metric_key, metric_name, data_type,
monitor_status, create_time, update_time, create_by, update_by)
values
<foreach collection="list" item="item" separator=",">
(
#{item.templateId},
#{item.policyId},
#{item.itemType},
#{item.metricKey},
#{item.metricName},
#{item.dataType},
#{item.monitorStatus},
#{item.createTime},
#{item.updateTime},
#{item.createBy},
#{item.updateBy}
)
</foreach>
</insert>
</mapper>
@@ -0,0 +1,160 @@
<?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.ruoyi.rocketmq.mapper.RmTemplateSwitchMapper">
<resultMap type="RmTemplateSwitch" id="RmTemplateSwitchResult">
<result property="id" column="id" />
<result property="templateId" column="template_id" />
<result property="policyId" column="policy_id" />
<result property="itemType" column="item_type" />
<result property="metricKey" column="metric_key" />
<result property="metricName" column="metric_name" />
<result property="oid" column="oid" />
<result property="filterValue" column="filter_value" />
<result property="switchDescription" column="switch_description" />
<result property="dataType" column="data_type" />
<result property="monitorStatus" column="monitor_status" />
<result property="collectionCycle" column="collection_cycle" />
<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="selectRmTemplateSwitchVo">
select id, template_id, policy_id, item_type, metric_key, metric_name, oid, filter_value, switch_description, data_type, monitor_status, collection_cycle, create_time, update_time, create_by, update_by from rm_template_switch
</sql>
<select id="selectRmTemplateSwitchList" parameterType="RmTemplateSwitch" resultMap="RmTemplateSwitchResult">
<include refid="selectRmTemplateSwitchVo"/>
<where>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="policyId != null "> and policy_id = #{policyId}</if>
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
<if test="metricKey != null and metricKey != ''"> and metric_key = #{metricKey}</if>
<if test="metricName != null and metricName != ''"> and metric_name like concat('%', #{metricName}, '%')</if>
<if test="oid != null and oid != ''"> and oid = #{oid}</if>
<if test="filterValue != null and filterValue != ''"> and filter_value = #{filterValue}</if>
<if test="switchDescription != null and switchDescription != ''"> and switch_description = #{switchDescription}</if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
<if test="monitorStatus != null and monitorStatus != ''"> and monitor_status = #{monitorStatus}</if>
<if test="collectionCycle != null and collectionCycle != ''"> and collection_cycle = #{collectionCycle}</if>
</where>
</select>
<select id="selectRmTemplateSwitchById" parameterType="Long" resultMap="RmTemplateSwitchResult">
<include refid="selectRmTemplateSwitchVo"/>
where id = #{id}
</select>
<insert id="insertRmTemplateSwitch" parameterType="RmTemplateSwitch" useGeneratedKeys="true" keyProperty="id">
insert into rm_template_switch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateId != null">template_id,</if>
<if test="policyId != null">policy_id,</if>
<if test="itemType != null and itemType != ''">item_type,</if>
<if test="metricKey != null and metricKey != ''">metric_key,</if>
<if test="metricName != null and metricName != ''">metric_name,</if>
<if test="oid != null and oid != ''">oid,</if>
<if test="filterValue != null">filter_value,</if>
<if test="switchDescription != null">switch_description,</if>
<if test="dataType != null and dataType != ''">data_type,</if>
<if test="monitorStatus != null">monitor_status,</if>
<if test="collectionCycle != null">collection_cycle,</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="templateId != null">#{templateId},</if>
<if test="policyId != null">#{policyId},</if>
<if test="itemType != null and itemType != ''">#{itemType},</if>
<if test="metricKey != null and metricKey != ''">#{metricKey},</if>
<if test="metricName != null and metricName != ''">#{metricName},</if>
<if test="oid != null and oid != ''">#{oid},</if>
<if test="filterValue != null">#{filterValue},</if>
<if test="switchDescription != null">#{switchDescription},</if>
<if test="dataType != null and dataType != ''">#{dataType},</if>
<if test="monitorStatus != null">#{monitorStatus},</if>
<if test="collectionCycle != null">#{collectionCycle},</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="updateRmTemplateSwitch" parameterType="RmTemplateSwitch">
update rm_template_switch
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null">template_id = #{templateId},</if>
<if test="policyId != null">policy_id = #{policyId},</if>
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
<if test="metricKey != null and metricKey != ''">metric_key = #{metricKey},</if>
<if test="metricName != null and metricName != ''">metric_name = #{metricName},</if>
<if test="oid != null and oid != ''">oid = #{oid},</if>
<if test="filterValue != null">filter_value = #{filterValue},</if>
<if test="switchDescription != null">switch_description = #{switchDescription},</if>
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
<if test="monitorStatus != null">monitor_status = #{monitorStatus},</if>
<if test="collectionCycle != null">collection_cycle = #{collectionCycle},</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="deleteRmTemplateSwitchById" parameterType="Long">
delete from rm_template_switch where id = #{id}
</delete>
<delete id="deleteRmTemplateSwitchByIds" parameterType="String">
delete from rm_template_switch where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsertRmTemplateSwitch" parameterType="list">
INSERT INTO rm_template_switch
(
template_id,
policy_id,
item_type,
metric_key,
metric_name,
oid,
filter_value,
switch_description,
data_type,
monitor_status,
create_time,
update_time,
create_by,
update_by
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.templateId},
#{item.policyId},
#{item.itemType},
#{item.metricKey},
#{item.metricName},
#{item.oid},
#{item.filterValue},
#{item.switchDescription},
#{item.dataType},
#{item.monitorStatus},
#{item.createTime},
#{item.updateTime},
#{item.createBy},
#{item.updateBy}
)
</foreach>
</insert>
</mapper>