完善IP复用地址池、策略配置.

This commit is contained in:
zhangwq
2018-12-01 16:06:08 +08:00
parent 68e822bb26
commit 8cfb175fd2
18 changed files with 804 additions and 405 deletions

View File

@@ -3,11 +3,9 @@
<mapper namespace="com.nis.web.dao.configuration.IpAddrPoolCfgDao">
<resultMap id="addrPoolMap" type="com.nis.domain.configuration.IpAddrPoolCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="addr_pool_id" property="addrPoolId" jdbcType="INTEGER"/>
<id column="cfg_id" property="cfgId" jdbcType="BIGINT"/>
<result column="addr_pool_name" property="addrPoolName" jdbcType="VARCHAR"/>
<result column="ip_total" property="ipTotal" jdbcType="INTEGER"/>
<result column="available_ip_total" property="availableIpTotal" jdbcType="INTEGER"/>
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
@@ -38,7 +36,7 @@
</resultMap>
<sql id="addrPoolColumns">
r.CFG_ID,r.ADDR_POOL_ID,r.IP_TOTAL,r.AVAILABLE_IP_TOTAL,r.ACTION,r.IS_VALID,r.IS_AUDIT,
r.CFG_ID,r.ADDR_POOL_NAME,r.IP_TOTAL,r.ACTION,r.IS_VALID,r.IS_AUDIT,
r.CFG_REGION_CODE,r.CFG_TYPE,r.FUNCTION_ID,r.SERVICE_ID,r.COMPILE_ID,r.REQUEST_ID,
r.CLASSIFY,r.ATTRIBUTE,r.LABLE,
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
@@ -62,13 +60,10 @@
,s.name as creator_name,
e.name as editor_name,
u.name as auditor_name,
a.group_name as addr_pool_name,
ri.request_title as requestName
</trim>
FROM
ip_reuse_addr_pool r
left join
policy_group_info a on r.addr_pool_id = a.group_Id
left join
sys_user s on r.creator_id = s.id
left join
@@ -81,24 +76,18 @@
<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 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="addrPoolId != null">
AND r.addr_pool_id = #{addrPoolId,jdbcType=INTEGER}
</if>
<if test="addrPoolName != null and addrPoolName != ''">
AND r.addr_pool_name = #{addrPoolName,jdbcType=VARCHAR}
AND r.addr_pool_name LIKE concat(concat('%',#{addrPoolName,jdbcType=VARCHAR}),'%')
</if>
<if test="ipTotal != null">
AND r.ip_total = #{ipTotal,jdbcType=INTEGER}
</if>
<if test="availableIpTotal != null">
AND r.available_ip_total = #{availableIpTotal,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
@@ -149,7 +138,7 @@
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.CFG_ID DESC
ORDER BY r.cfg_id DESC
</otherwise>
</choose>
</select>
@@ -161,6 +150,9 @@
FROM
ip_reuse_addr_pool r
<where>
<if test="cfgId != null">
AND r.cfg_id=#{cfgId,jdbcType=BIGINT}
</if>
<if test="isValid !=null">
AND r.is_valid = #{isValid,jdbcType=INTEGER}
</if>
@@ -169,12 +161,9 @@
</if>
<if test="isAudit !=null">
AND r.is_audit = #{isAudit,jdbcType=INTEGER}
</if>
<if test="cfgId != null">
AND r.cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
</where>
ORDER BY cfg_Id
</if>
</where>
ORDER BY r.cfg_id
</select>
<!-- 保存地址池IP信息 -->
@@ -258,10 +247,8 @@
<insert id="saveAddrPoolCfg" parameterType="com.nis.domain.configuration.IpAddrPoolCfg">
INSERT INTO ip_reuse_addr_pool(
addr_pool_id,
addr_pool_name,
ip_total,
available_ip_total,
action,
is_valid,
is_audit,
@@ -289,10 +276,8 @@
user_region4,
user_region5
)VALUES (
#{addrPoolId,jdbcType=INTEGER},
#{addrPoolName,jdbcType=VARCHAR},
#{ipTotal,jdbcType=INTEGER},
#{availableIpTotal,jdbcType=INTEGER},
#{action,jdbcType=INTEGER},
0,
0,
@@ -328,19 +313,62 @@
FROM
ip_reuse_ip_cfg a
WHERE
a.is_valid != -1 AND a.user_region1 = #{addrPoolId}
a.is_valid != -1 AND a.user_region1 = #{cfgId}
</select>
<select id="getAddrPoolId" resultType="java.lang.Integer">
SELECT
a.addr_pool_id
FROM
ip_reuse_addr_pool a
WHERE
a.is_valid != -1 AND a.cfg_id = #{cfgId}
</select>
<update id="updateReuseIpCfgs" parameterType="com.nis.domain.configuration.IpAddrPoolCfg">
update ip_reuse_ip_cfg
<set >
<trim suffixOverrides=",">
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</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 createTime != ''" >
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>
</trim>
</set>
where user_region1 = #{cfgId,jdbcType=BIGINT}
</update>
<delete id="deleteReuseIpCfgs" parameterType="java.lang.Integer">
<delete id="deleteReuseIpCfgs" parameterType="java.lang.Long">
DELETE FROM ip_reuse_ip_cfg WHERE user_region1 = #{addrPoolId}
</delete>
@@ -348,18 +376,9 @@
update ip_reuse_addr_pool
<set >
<trim suffixOverrides=",">
<if test="addrPoolId != null" >
addr_pool_id = #{addrPoolId,jdbcType=INTEGER},
</if>
<if test="ipTotal != null" >
ip_total = #{ipTotal,jdbcType=INTEGER},
</if>
<if test="availableIpTotal != null" >
available_ip_total = #{availableIpTotal,jdbcType=INTEGER},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
@@ -423,16 +442,16 @@
FROM ip_reuse_addr_pool r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.cfg_id=#{cfgId,jdbcType=BIGINT}
AND r.cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="isValid !=null">
AND r.is_valid =#{isValid,jdbcType=INTEGER}
AND r.is_valid = #{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.is_valid != -1
</if>
<if test="functionId != null">
AND r.function_id=#{functionId,jdbcType=INTEGER}
AND r.function_id = #{functionId,jdbcType=INTEGER}
</if>
<if test="addrPoolName != null and addrPoolName != ''">
AND r.addr_pool_name = #{addrPoolName,jdbcType=VARCHAR}
@@ -442,7 +461,16 @@
<select id="findAddrPoolCfg" resultMap="addrPoolMap">
SELECT
<include refid="addrPoolColumns"/>,r.ADDR_POOL_NAME
<include refid="addrPoolColumns"/>
FROM ip_reuse_addr_pool r WHERE r.is_audit=1
</select>
<select id="getAddrPoolIdByName" resultType="java.lang.Long">
SELECT
r.cfg_id
FROM
ip_reuse_addr_pool r
WHERE
r.addr_pool_name = #{addrPoolName} AND r.is_valid != -1
</select>
</mapper>