2018-03-22 14:41:10 +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" >
|
|
|
|
|
<mapper namespace="com.nis.web.dao.configuration.DnsIpCfgDao">
|
|
|
|
|
<resultMap id="dnsIpCfgMap" type="com.nis.domain.configuration.DnsIpCfg">
|
|
|
|
|
<id column="cfg_id" property="cfgId"/>
|
|
|
|
|
<result column="cfg_desc" property="cfgDesc"/>
|
|
|
|
|
<result column="ip_type" property="ipType"/>
|
|
|
|
|
<result column="src_ip" property="srcIp"/>
|
|
|
|
|
<result column="src_ip_mask" property="srcIpMask"/>
|
|
|
|
|
<result column="src_port" property="srcPort"/>
|
|
|
|
|
<result column="src_port_mask" property="srcPortMask"/>
|
|
|
|
|
<result column="dst_ip" property="dstIp"/>
|
|
|
|
|
<result column="dst_ip_mask" property="dstIpMask"/>
|
|
|
|
|
<result column="dst_port" property="dstPort"/>
|
|
|
|
|
<result column="dst_port_mask" property="dstPortMask"/>
|
|
|
|
|
<result column="direction" property="direction"/>
|
|
|
|
|
<result column="protocol" property="protocol"/>
|
|
|
|
|
<result column="is_valid" property="isValid"/>
|
|
|
|
|
<result column="is_audit" property="isAudit"/>
|
|
|
|
|
<result column="creator_id" property="creator.id"/>
|
|
|
|
|
<result column="create_time" property="createTime"/>
|
|
|
|
|
<result column="editor_id" property="editor.id"/>
|
|
|
|
|
<result column="edit_time" property="editTime"/>
|
|
|
|
|
<result column="auditor_id" property="auditor.id"/>
|
|
|
|
|
<result column="audit_time" property="auditTime"/>
|
|
|
|
|
<result column="request_id" property="request.id"/>
|
|
|
|
|
<result column="fake_id" property="fakeId"/>
|
|
|
|
|
<result column="classify" property="classify"/>
|
|
|
|
|
<result column="attribute" property="attribute"/>
|
|
|
|
|
<result column="label" property="label"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="columns">
|
|
|
|
|
dic.CFG_ID, dic.CFG_DESC, dic.IP_TYPE, dic.SRC_IP, dic.SRC_IP_MASK, dic.SRC_PORT,
|
|
|
|
|
dic.SRC_PORT_MASK, dic.DST_IP, dic.DST_IP_MASK, dic.DST_PORT, dic.DST_PORT_MASK,
|
|
|
|
|
dic.DIRECTION, dic.PROTOCOL, dic.IS_VALID, dic.IS_AUDIT, dic.CREATOR_ID,
|
|
|
|
|
dic.CREATE_TIME, dic.EDITOR_ID, dic.EDIT_TIME, dic.AUDITOR_ID, dic.AUDIT_TIME,
|
|
|
|
|
dic.REQUEST_ID, dic.FAKE_ID, dic.CLASSIFY, dic.ATTRIBUTE, dic.LABLE
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="findList" resultMap="dnsIpCfgMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="columns"></include>,
|
|
|
|
|
c.name as "creator.name",
|
|
|
|
|
e.name as "editor.name",
|
|
|
|
|
a.name as "auditor.name",
|
|
|
|
|
ri.request_title as "request.requestTitle"
|
|
|
|
|
from dns_ip_cfg dic
|
|
|
|
|
left join sys_user c on dic.creator_id=c.id
|
|
|
|
|
left join sys_user e on dic.creator_id=e.id
|
|
|
|
|
left join sys_user a on dic.creator_id=a.id
|
|
|
|
|
left join request_info ri on dic.request_id=ri.id
|
|
|
|
|
where dic.is_valid=1
|
|
|
|
|
<if test="searchCreateTimeStart != null">
|
|
|
|
|
and dic.create_time >= #{searchCreateTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="searchCreateTimeEnd != null">
|
|
|
|
|
and dic.create_time <= #{searchCreateTimeEnd}
|
|
|
|
|
</if>
|
2018-03-22 15:20:52 +08:00
|
|
|
<!-- <if test="searchEditTimeStart != null">
|
2018-03-22 14:41:10 +08:00
|
|
|
and dic.create_time >= #{searchEditTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="searchEditTimeEnd != null">
|
|
|
|
|
and dic.create_time <= #{searchEditTimeEnd}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="searchAuditTimeStart != null">
|
|
|
|
|
and dic.create_time >= #{searchAuditTimeStart}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="searchAuditTimeEnd != null">
|
|
|
|
|
and dic.create_time <= #{searchAuditTimeEnd}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isAudit != null">
|
|
|
|
|
and dic.is_audit = #{isAudit}
|
2018-03-22 15:20:52 +08:00
|
|
|
</if> -->
|
2018-03-22 14:41:10 +08:00
|
|
|
<if test="request != null and request.id != null">
|
|
|
|
|
and dic.request_id = #{request.id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="classify != null and classify != ''">
|
|
|
|
|
and concat(",", dic.classify, ",") like concat("%,", #{classify}, ",%")
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attribute != null and attribute != ''">
|
|
|
|
|
and concat(",", dic.attribute, ",") like concat("%,", #{attribute}, ",%")
|
|
|
|
|
</if>
|
|
|
|
|
<if test="lable != null and lable != ''">
|
|
|
|
|
and concat(",", dic.lable, ",") like concat("%,", #{lable}, ",%")
|
|
|
|
|
</if>
|
2018-03-22 15:20:52 +08:00
|
|
|
<if test="cfgDesc != null and cfgDesc != ''">
|
|
|
|
|
and dic.cfg_desc like concat("%", #{cfgDesc}, "%")
|
|
|
|
|
</if>
|
2018-03-22 14:41:10 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="get" resultMap="dnsIpCfgMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="columns"></include>,
|
|
|
|
|
c.name as "creator.name",
|
|
|
|
|
e.name as "editor.name",
|
|
|
|
|
a.name as "auditor.name",
|
|
|
|
|
ri.request_title as "request.requestTitle"
|
|
|
|
|
from dns_ip_cfg dic
|
|
|
|
|
left join sys_user c on dic.creator_id=c.id
|
|
|
|
|
left join sys_user e on dic.creator_id=e.id
|
|
|
|
|
left join sys_user a on dic.creator_id=a.id
|
|
|
|
|
left join request_info ri on dic.request_id=ri.id
|
|
|
|
|
where dic.cfg_id=#{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insert">
|
|
|
|
|
insert into dns_ip_cfg (
|
|
|
|
|
cfg_desc, ip_type, src_ip, src_ip_mask, src_port,
|
|
|
|
|
src_port_mask, dst_ip, dst_ip_mask, dst_port, dst_port_mask,
|
|
|
|
|
direction, protocol, is_valid, is_audit, creator_id,
|
|
|
|
|
create_time, request_id, fake_id, classify, attribute, lable
|
|
|
|
|
) values (
|
|
|
|
|
#{cfgDesc}, #{ipType}, #{srcIp}, #{srcIpMask}, #{srcPort}, #{srcPortMask},
|
|
|
|
|
#{dstIp}, #{dstIpMask}, #{dstPort}, #{dstPortMask}, #{direction}, #{protocol},
|
|
|
|
|
#{isValid}, #{isAudit}, #{creator.id}, #{createTime}, #{request.id}, #{fakeId},
|
|
|
|
|
#{classify}, #{attribute}, #{lable}
|
|
|
|
|
)
|
2018-03-27 19:00:57 +08:00
|
|
|
<selectKey keyProperty="cfgId" resultType="java.lang.Long">
|
|
|
|
|
select LAST_INSERT_ID() as cfg_id
|
|
|
|
|
</selectKey>
|
2018-03-22 14:41:10 +08:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="update">
|
|
|
|
|
update
|
|
|
|
|
dns_ip_cfg
|
|
|
|
|
set
|
|
|
|
|
cfg_desc=#{cfgDesc}, ip_type=#{ipType}, src_ip=#{srcIp}, src_ip_mask=#{srcIpMask},
|
|
|
|
|
src_port=#{srcPort}, src_port_mask=#{srcPortMask}, dst_ip=#{dstIp},
|
|
|
|
|
dst_ip_mask=#{dstIpMask}, dst_port=#{dstPort}, dst_port_mask=#{dstPortMask},
|
|
|
|
|
direction=#{direction}, protocol=#{protocol}, request_id=#{request.id},
|
|
|
|
|
fake_id=#{fakeId}, classify=#{classify}, attribute=#{attribute}, lable=#{lable},
|
|
|
|
|
editor_id=#{editor.id}, edit_time=#{editTime}
|
|
|
|
|
where cfg_id=#{cfgId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="delete">
|
|
|
|
|
update
|
|
|
|
|
dns_ip_cfg
|
|
|
|
|
set
|
|
|
|
|
is_valid=0
|
|
|
|
|
where cfg_id=#{cfgId}
|
|
|
|
|
</update>
|
2018-03-28 10:16:27 +08:00
|
|
|
<update id="deleteByFakeId">
|
|
|
|
|
update
|
|
|
|
|
dns_ip_cfg
|
|
|
|
|
set
|
|
|
|
|
is_valid=0
|
|
|
|
|
where fake_id =#{fakeId}
|
|
|
|
|
</update>
|
2018-03-22 14:41:10 +08:00
|
|
|
|
|
|
|
|
</mapper>
|