134 lines
7.1 KiB
XML
134 lines
7.1 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.realtime.protection.server.rule.staticrule.StaticRuleMapper">
|
|
|
|
<insert id="newStaticRuleObject" useGeneratedKeys="true" keyProperty="staticRuleId"
|
|
parameterType="com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject">
|
|
|
|
insert into t_static_rule(static_rule_name, static_rule_create_time,
|
|
static_rule_create_username, static_rule_create_depart,
|
|
static_rule_create_user_id, static_rule_sip, static_rule_msip,
|
|
static_rule_sport, static_rule_msport,
|
|
static_rule_dip, static_rule_mdip, static_rule_dport, static_rule_mdport,
|
|
static_rule_protocol, static_rule_mprotocol, static_rule_dns,
|
|
static_rule_url, static_rule_priority, static_rule_range,
|
|
static_rule_frequency, static_rule_audit_status)
|
|
values (#{object.staticRuleName}, #{object.staticRuleCreateTime}, #{object.staticRuleCreateUsername},
|
|
#{object.staticRuleCreateDepart}, #{object.staticRuleCreateUserId}, INET_ATON(#{object.staticRuleSip}),
|
|
INET_ATON(#{object.staticRuleMsip}), #{object.staticRuleSport}, #{object.staticRuleMsport},
|
|
INET_ATON(#{object.staticRuleDip}), INET_ATON(#{object.staticRuleMdip}), #{object.staticRuleDport},
|
|
#{object.staticRuleMdport}, #{object.staticRuleProtocol}, #{object.staticRuleMprotocol},
|
|
#{object.staticRuleDns}, #{object.staticRuleURL}, #{object.staticRulePriority},
|
|
#{object.staticRuleRange}, #{object.staticRuleFrequency},
|
|
#{object.staticRuleAuditStatus})
|
|
</insert>
|
|
<insert id="newStaticRules">
|
|
insert into t_static_rule(static_rule_name, static_rule_create_time,
|
|
static_rule_create_username, static_rule_create_depart,
|
|
static_rule_create_user_id, static_rule_sip, static_rule_msip,
|
|
static_rule_sport, static_rule_msport,
|
|
static_rule_dip, static_rule_mdip, static_rule_dport, static_rule_mdport,
|
|
static_rule_protocol, static_rule_mprotocol, static_rule_dns,
|
|
static_rule_url, static_rule_priority, static_rule_range,
|
|
static_rule_frequency, static_rule_audit_status)
|
|
values
|
|
<foreach collection="staticRuleBatch" item="object" separator=",">
|
|
(#{object.staticRuleName}, #{object.staticRuleCreateTime}, #{object.staticRuleCreateUsername},
|
|
#{object.staticRuleCreateDepart}, #{object.staticRuleCreateUserId}, INET_ATON(#{object.staticRuleSip}),
|
|
INET_ATON(#{object.staticRuleMsip}), #{object.staticRuleSport}, #{object.staticRuleMsport},
|
|
INET_ATON(#{object.staticRuleDip}), INET_ATON(#{object.staticRuleMdip}), #{object.staticRuleDport},
|
|
#{object.staticRuleMdport}, #{object.staticRuleProtocol}, #{object.staticRuleMprotocol},
|
|
#{object.staticRuleDns}, #{object.staticRuleURL}, #{object.staticRulePriority},
|
|
#{object.staticRuleRange}, #{object.staticRuleFrequency},
|
|
0)
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<update id="updateStaticRule">
|
|
update t_static_rule
|
|
<set>
|
|
<if test="object.staticRuleName != null and object.staticRuleName != ''">
|
|
static_rule_name = #{object.staticRuleName},
|
|
</if>
|
|
static_rule_sip = INET_ATON(#{object.staticRuleSip}),
|
|
static_rule_msip = INET_ATON(#{object.staticRuleMsip}),
|
|
static_rule_sport = #{object.staticRuleSport},
|
|
static_rule_msport = #{object.staticRuleMsport},
|
|
static_rule_dip = INET_ATON(#{object.staticRuleDip}),
|
|
static_rule_mdip = INET_ATON(#{object.staticRuleMdip}),
|
|
static_rule_dport = #{object.staticRuleDport},
|
|
static_rule_mdport = #{object.staticRuleMdport},
|
|
static_rule_protocol = #{object.staticRuleProtocol},
|
|
static_rule_mprotocol = #{object.staticRuleMprotocol},
|
|
static_rule_dns = #{object.staticRuleDns},
|
|
static_rule_url = #{object.staticRuleURL},
|
|
<if test="object.staticRulePriority != null and object.staticRulePriority != ''">
|
|
static_rule_priority = #{object.staticRulePriority},
|
|
</if>
|
|
<if test="object.staticRuleRange != null and object.staticRuleRange != ''">
|
|
static_rule_range = #{object.staticRuleRange},
|
|
</if>
|
|
<if test="object.staticRuleFrequency != null and object.staticRuleFrequency != ''">
|
|
static_rule_frequency = #{object.staticRuleFrequency},
|
|
</if>
|
|
|
|
</set>
|
|
where static_rule_id = #{id}
|
|
</update>
|
|
<update id="updateAuditStatusById">
|
|
update t_static_rule
|
|
set static_rule_audit_status = #{auditStatus}
|
|
where static_rule_id = #{id}
|
|
</update>
|
|
<delete id="deleteStaticRules">
|
|
delete from t_static_rule
|
|
where static_rule_id in
|
|
<foreach collection="staticRuleIds" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<resultMap id="staticRuleMap" type="com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject">
|
|
<id column="static_rule_id" property="staticRuleId"/>
|
|
<result column="static_rule_name" property="staticRuleName"/>
|
|
<result column="static_rule_create_time" property="staticRuleCreateTime"/>
|
|
<result column="static_rule_create_username" property="staticRuleCreateUsername"/>
|
|
<result column="static_rule_create_depart" property="staticRuleCreateDepart"/>
|
|
<result column="static_rule_used_task_id" property="staticRuleUsedTaskId"/>
|
|
|
|
<result column="static_rule_sip" property="staticRuleSip"/>
|
|
<result column="static_rule_sport" property="staticRuleSport"/>
|
|
<result column="static_rule_dip" property="staticRuleDip"/>
|
|
<result column="static_rule_mdip" property="staticRuleMdip"/>
|
|
<result column="static_rule_dport" property="staticRuleDport"/>
|
|
<result column="static_rule_protocol" property="staticRuleProtocol"/>
|
|
</resultMap>
|
|
|
|
<select id="queryStaticRule" resultMap="staticRuleMap">
|
|
SELECT * FROM t_static_rule
|
|
<where>
|
|
<if test="static_rule_name != null and static_rule_name != ''">
|
|
static_rule_name like concat('%', #{static_rule_name}, '%')
|
|
</if>
|
|
<if test="static_rule_id != null">
|
|
AND static_rule_id = #{static_rule_id}
|
|
</if>
|
|
</where>
|
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
|
</select>
|
|
|
|
<select id="queryStaticRuleById" resultMap="staticRuleMap">
|
|
SELECT *
|
|
FROM t_static_rule
|
|
WHERE static_rule_id = #{static_rule_id}
|
|
</select>
|
|
<select id="queryAuditStatusById" resultType="java.lang.Integer">
|
|
SELECT static_rule_audit_status
|
|
FROM t_static_rule
|
|
WHERE static_rule_id = #{id}
|
|
</select>
|
|
|
|
</mapper> |