This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/java/com/nis/web/dao/configuration/DnsResStrategyDao.xml
wangxin 82a2e803ae (1)修复基础协议,app协议,加密隧道行为主配置被账号配置覆盖的bug
(2)DNS配置下发时,只展示有审核通过的欺骗IP的DNS策略
2018-09-26 16:00:45 +08:00

371 lines
14 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.nis.web.dao.configuration.DnsResStrategyDao" >
<resultMap id="DnsResStrategyMap" type="com.nis.domain.configuration.DnsResStrategy" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="res_group_1_id" property="resGroup1Id" jdbcType="INTEGER" />
<result column="res_group_1_num" property="resGroup1Num" jdbcType="INTEGER" />
<result column="res_group_2_id" property="resGroup2Id" jdbcType="INTEGER" />
<result column="res_group_2_num" property="resGroup2Num" jdbcType="INTEGER" />
<result column="res_group_3_id" property="resGroup3Id" jdbcType="INTEGER" />
<result column="res_group_3_num" property="resGroup3Num" jdbcType="INTEGER" />
<result column="res_group_4_id" property="resGroup4Id" jdbcType="INTEGER" />
<result column="res_group_4_num" property="resGroup4Num" jdbcType="INTEGER" />
<result column="res_group_5_id" property="resGroup5Id" jdbcType="INTEGER" />
<result column="res_group_5_num" property="resGroup5Num" jdbcType="INTEGER" />
<result column="min_ttl" property="minTtl" jdbcType="INTEGER" />
<result column="max_ttl" property="maxTtl" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="group_1_name" property="group1Name" jdbcType="VARCHAR" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
</resultMap>
<sql id="DnsResStrategyColumns">
r.cfg_id,r.cfg_desc,r.res_group_1_id,
r.res_group_1_num,r.res_group_2_id,r.res_group_2_num,r.res_group_3_id
,r.res_group_3_num,r.res_group_4_id,r.res_group_4_num
,r.res_group_5_id,r.res_group_5_num,r.min_ttl
,r.max_ttl,r.cfg_type,r.action
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id
,r.is_area_effective,r.classify,r.attribute,r.lable
,r.area_effective_ids,r.function_id,r.cfg_region_code,r.compile_id
</sql>
<!-- 查出所有 有效数据-->
<select id="findPage" resultMap="DnsResStrategyMap">
SELECT
<include refid="DnsResStrategyColumns"/>
<trim prefix="," prefixOverrides=",">
, a.group_name group_1_name,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM dns_res_strategy r
left join policy_group_info a on r.res_group_1_id=a.group_Id
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
left join sys_user u on r.auditor_id=u.id
left join request_info ri on r.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId != null">
AND r.compile_id=#{compileId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="group1Name != null and group1Name != ''">
AND a.group_name like concat(concat('%',#{group1Name,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.function_id=#{functionId,jdbcType=INTEGER}
</if>
<![CDATA[ and r.cfg_id <> 0]]>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.CFG_ID desc
</otherwise>
</choose>
</select>
<!-- 查出所有 有效数据-->
<select id="findList" resultMap="DnsResStrategyMap">
SELECT
<include refid="DnsResStrategyColumns"/>
FROM dns_res_strategy r
<where>
<if test="isValid == -1">
AND r.is_valid !=-1
</if>
<if test="isValid == 1">
AND r.is_valid =1
</if>
<if test="isValid == 0">
AND r.is_valid =0
</if>
<if test="isAudit == 0">
AND r.is_audit =0
</if>
<if test="isAudit == 1">
AND r.is_audit =1
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<![CDATA[ and r.cfg_id <> 0]]>
</where>
order by cfg_Id
</select>
<!-- 查出所有 有效数据-->
<select id="findhasValidIpList" resultMap="DnsResStrategyMap">
SELECT
<include refid="DnsResStrategyColumns"/>
FROM (
SELECT DISTINCT dns_strategy_id FROM dns_ip_cfg WHERE is_valid=1 AND is_audit=1
) a
LEFT JOIN dns_res_strategy r ON a.dns_strategy_id=r.res_group_1_id
<where>
<if test="isValid == -1">
AND r.is_valid !=-1
</if>
<if test="isValid == 1">
AND r.is_valid =1
</if>
<if test="isValid == 0">
AND r.is_valid =0
</if>
<if test="isAudit == 0">
AND r.is_audit =0
</if>
<if test="isAudit == 1">
AND r.is_audit =1
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<![CDATA[ and r.cfg_id <> 0]]>
</where>
order by r.cfg_Id
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.DnsResStrategy" >
insert into dns_res_strategy (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
res_group_1_id,
res_group_1_num,
res_group_2_id,
res_group_2_num,
res_group_3_id,
res_group_3_num,
res_group_4_id,
res_group_4_num,
res_group_5_id,
res_group_5_num,
min_ttl,
max_ttl,
cfg_type,
compile_Id,
cfg_region_code
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{resGroup1Id,jdbcType=INTEGER},
#{resGroup1Num,jdbcType=INTEGER},
#{resGroup2Id,jdbcType=INTEGER},
#{resGroup2Num,jdbcType=INTEGER},
#{resGroup3Id,jdbcType=INTEGER},
#{resGroup3Num,jdbcType=INTEGER},
#{resGroup4Id,jdbcType=INTEGER},
#{resGroup4Num,jdbcType=INTEGER},
#{resGroup5Id,jdbcType=INTEGER},
#{resGroup5Num,jdbcType=INTEGER},
#{minTtl,jdbcType=INTEGER},
#{maxTtl,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{compileId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER}
)
</insert>
<update id="update" parameterType="com.nis.domain.configuration.DnsResStrategy" >
update dns_res_strategy
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="compileId != null " >
compile_Id = #{compileId,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="resGroup1Id != null" >
res_group_1_id = #{resGroup1Id,jdbcType=INTEGER},
</if>
<if test="resGroup1Num != null" >
res_group_1_num = #{resGroup1Num,jdbcType=INTEGER},
</if>
<if test="resGroup2Id != null" >
res_group_2_id = #{resGroup2Id,jdbcType=INTEGER},
</if>
<if test="resGroup2Num != null" >
res_group_2_num = #{resGroup2Num,jdbcType=INTEGER},
</if>
<if test="resGroup3Id != null" >
res_group_3_id = #{resGroup3Id,jdbcType=INTEGER},
</if>
<if test="resGroup3Num != null" >
res_group_3_num = #{resGroup3Num,jdbcType=INTEGER},
</if>
<if test="resGroup4Id != null" >
res_group_4_id = #{resGroup4Id,jdbcType=INTEGER},
</if>
<if test="resGroup4Num != null" >
res_group_4_num = #{resGroup4Num,jdbcType=INTEGER},
</if>
<if test="resGroup5Id != null" >
res_group_5_id = #{resGroup5Id,jdbcType=INTEGER},
</if>
<if test="resGroup5Num != null" >
res_group_5_num = #{resGroup5Num,jdbcType=INTEGER},
</if>
<if test="minTtl != null" >
min_ttl = #{minTtl,jdbcType=INTEGER},
</if>
<if test="maxTtl != null" >
max_ttl = #{maxTtl,jdbcType=INTEGER},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
<if test="functionId != null" >
and function_id = #{functionId,jdbcType=INTEGER}
</if>
</where>
</update>
</mapper>