IP公共组配置部分功能提交
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.nis.web.dao.basics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.CommonGroupInfo;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface CommonGroupManageDao extends CrudDao<CommonGroupInfo> {
|
||||
List<CommonGroupInfo> findCommonGroupInfoList(CommonGroupInfo commonGroupInfo);
|
||||
|
||||
CommonGroupInfo getById(int id);
|
||||
|
||||
List<CommonGroupInfo> findCommonGroupInfosByType(int groupType);
|
||||
|
||||
List<CommonGroupInfo> findGroupInfoList(@Param("ids")String ids);
|
||||
|
||||
/*List<PolicyGroupInfo> findPolicyGroupInfos();
|
||||
List<PolicyGroupInfo> findHasIPPolicyGroupInfosByType(int groupType);
|
||||
List<PolicyGroupInfo> findPolicyGroupInfosHasIpRegionByType(int groupType);
|
||||
List<PolicyGroupInfo> findNatPolicyGroups();
|
||||
|
||||
PolicyGroupInfo getInfoByAsnNo(PolicyGroupInfo policyGroupInfo);
|
||||
List<PolicyGroupInfo> getHasAreaPolicyGroups(int groupType);
|
||||
int insertBatch(List<PolicyGroupInfo> list);
|
||||
|
||||
Integer getGroupIdByGroupName(String groupName);
|
||||
PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo);
|
||||
|
||||
*/
|
||||
}
|
||||
272
src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.xml
Normal file
272
src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.xml
Normal file
@@ -0,0 +1,272 @@
|
||||
<?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.basics.CommonGroupManageDao" >
|
||||
|
||||
<resultMap id="CommonGroupInfoMap" type="com.nis.domain.basics.CommonGroupInfo" >
|
||||
<id column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
|
||||
<result column="group_type" property="groupType" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="CommonGroupInfoColumns">
|
||||
r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time,
|
||||
r.creator_id,r.editor_id,r.service_group_id,r.description
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findCommonGroupInfoList" resultMap="CommonGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="CommonGroupInfoColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name
|
||||
,e.name as editor_name
|
||||
</trim>
|
||||
FROM policy_group_info r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
AND r.group_name like concat(concat('%',#{groupName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="groupType != null">
|
||||
AND r.group_type =#{groupType }
|
||||
</if>
|
||||
<if test="groupType == null">
|
||||
AND r.group_type NOT IN(1,2,3,4)
|
||||
</if>
|
||||
AND r.IS_VALID =1
|
||||
<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>
|
||||
<!-- 数据范围过滤 -->
|
||||
<!-- ${sqlMap.dsf} -->
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.group_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getById" resultType="com.nis.domain.basics.CommonGroupInfo">
|
||||
SELECT
|
||||
<include refid="CommonGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
WHERE
|
||||
r.group_id = #{groupId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.basics.CommonGroupInfo" >
|
||||
INSERT INTO policy_group_info(
|
||||
IS_VALID,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
GROUP_NAME,
|
||||
GROUP_TYPE,
|
||||
SERVICE_GROUP_ID,
|
||||
DESCRIPTION
|
||||
)values (
|
||||
1,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{groupName,jdbcType=VARCHAR},
|
||||
#{groupType,jdbcType=INTEGER},
|
||||
#{serviceGroupId,jdbcType=INTEGER},
|
||||
#{description,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO policy_group_info(
|
||||
IS_VALID,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
GROUP_NAME,
|
||||
GROUP_TYPE,
|
||||
SERVICE_GROUP_ID,
|
||||
DESCRIPTION
|
||||
)values
|
||||
<foreach collection ="list" item="info" separator =",">
|
||||
(
|
||||
1,
|
||||
#{info.creatorId,jdbcType=INTEGER},
|
||||
#{info.createTime,jdbcType=TIMESTAMP},
|
||||
#{info.groupName,jdbcType=VARCHAR},
|
||||
#{info.groupType,jdbcType=INTEGER},
|
||||
#{info.serviceGroupId,jdbcType=INTEGER},
|
||||
#{info.description,jdbcType=VARCHAR}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.nis.domain.basics.CommonGroupInfo" >
|
||||
UPDATE policy_group_info
|
||||
<set>
|
||||
<trim suffixOverrides=",">
|
||||
<if test="groupName != null and groupName != ''" >
|
||||
group_name = #{groupName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="groupType != null" >
|
||||
group_type = #{groupType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="description != null" >
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,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>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
<if test="groupId != null" >
|
||||
and group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="serviceGroupId != null" >
|
||||
and service_group_id = #{serviceGroupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="findCommonGroupInfosByType" resultMap="CommonGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="CommonGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
WHERE
|
||||
r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="findGroupInfoList" resultMap="CommonGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="CommonGroupInfoColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name
|
||||
,e.name as editor_name
|
||||
</trim>
|
||||
FROM
|
||||
policy_group_info r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
WHERE
|
||||
r.group_id IN (${ids})
|
||||
</select>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<!-- <select id="findPolicyGroupInfos" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM policy_group_info r
|
||||
where r.is_valid=1
|
||||
</select>
|
||||
<select id="findNatPolicyGroups" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM policy_group_info r
|
||||
where r.is_valid=1 AND r.group_type = 2 OR r.group_type = 3
|
||||
</select>
|
||||
<select id="findHasIPPolicyGroupInfosByType" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM (
|
||||
SELECT DISTINCT dns_strategy_id FROM dns_ip_cfg WHERE is_valid=1 AND is_audit=1
|
||||
) a
|
||||
LEFT JOIN policy_group_info r ON a.dns_strategy_id=r.group_id
|
||||
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getInfoByAsnNo" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="groupId != null" >
|
||||
AND group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="asnNo != null" >
|
||||
AND asn_no = #{asnNo,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
AND is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null" >
|
||||
AND is_valid != -1
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="getHasAreaPolicyGroups" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
WHERE
|
||||
r.is_valid = 1 AND
|
||||
r.group_type = #{groupType,jdbcType=INTEGER} AND
|
||||
r.group_id IN (
|
||||
SELECT ga.group_id FROM group_area_info ga WHERE ga.is_valid != -1
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getGroupIdByGroupName" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
r.group_id
|
||||
FROM
|
||||
policy_group_info r
|
||||
WHERE
|
||||
r.group_name = #{groupName}
|
||||
</select>
|
||||
|
||||
<select id="getGroupInfo" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM
|
||||
policy_group_info r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="groupName != null and groupName != ''" >
|
||||
AND group_name = #{groupName,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="groupType != null" >
|
||||
AND group_type = #{groupType,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="asnNo != null" >
|
||||
AND asn_no = #{asnNo,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
AND is_valid = #{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null" >
|
||||
AND is_valid != -1
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
</mapper>
|
||||
31
src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.java
Normal file
31
src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.nis.web.dao.basics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.basics.IpCommCfg;
|
||||
import com.nis.domain.basics.Varibles;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
@MyBatisDao
|
||||
public interface IpCommGroupCfgDao extends CrudDao<IpCommCfg>{
|
||||
public List<IpCommCfg> findPage(IpCommCfg cfg);
|
||||
public List<IpCommCfg> findByPage(@Param("ids")String ids);
|
||||
public void delete(@Param("ids")String ids);
|
||||
public void updateIssued(IpCommCfg cfg);
|
||||
public List<IpCommCfg> getByIds(@Param("ids")String ids);
|
||||
public List<IpCommCfg> findAllList(IpCommCfg cfg);
|
||||
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
|
||||
public List<Integer> countValidIPs(@Param("groups")String groups,@Param("ids")String ids);
|
||||
public int insertBatch(List<IpCommCfg> list);
|
||||
public Varibles getVaribles(@Param("name")String name);
|
||||
public void ajaxDeleteAsnIp(@Param("ids")String ids);
|
||||
public IpCommCfg getOne(IpCommCfg cfg);
|
||||
public List<Object[]> findAllIpCommGroupCfgList();
|
||||
public void insertIpCommGroupCfg(IpCommCfg ipPortCfg);
|
||||
public int getGroupIdCount(int groupId);
|
||||
|
||||
// 校验分组是否被引用
|
||||
public List<IpCommCfg> getCfgInfoByGroupIds(@Param("ids")String ids);
|
||||
}
|
||||
526
src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.xml
Normal file
526
src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.xml
Normal file
@@ -0,0 +1,526 @@
|
||||
<?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.basics.IpCommGroupCfgDao">
|
||||
<resultMap id="IpCommGroupCfgMap" type="com.nis.domain.basics.IpCommCfg">
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
|
||||
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
|
||||
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
|
||||
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
|
||||
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
|
||||
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
|
||||
<result column="direction" property="direction" jdbcType="INTEGER" />
|
||||
<result column="protocol" property="protocol" jdbcType="INTEGER" />
|
||||
<result column="protocol_id" property="protocolId" 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="compile_id" property="compileId" 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="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
|
||||
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="columns">
|
||||
r.cfg_id,r.cfg_desc,r.cfg_type,r.cfg_region_code,r.ip_type,r.src_ip_pattern,r.src_ip_address,r.dest_ip_pattern,r.dest_ip_address,
|
||||
r.src_port_pattern,r.src_port,r.dest_port_pattern,r.dest_port
|
||||
,r.protocol,r.protocol_id,r.direction,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.user_region1
|
||||
,r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.compile_id,r.region_id,r.group_id
|
||||
</sql>
|
||||
|
||||
<select id="findPage" resultMap="IpCommGroupCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
|
||||
</trim>
|
||||
from ip_comm_cfg r
|
||||
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
|
||||
<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="cfgDesc != null and cfgDesc != ''">
|
||||
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="cfgRegionCode != null">
|
||||
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''">
|
||||
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="ipType != null">
|
||||
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcIpPattern != null">
|
||||
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="destIpPattern != null">
|
||||
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress != ''">
|
||||
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="destIpAddress != null and destIpAddress != ''">
|
||||
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="srcPortPattern != null">
|
||||
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="destPortPattern != null">
|
||||
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcPort != null and srcPort !=''">
|
||||
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="destPort != null and destPort !=''">
|
||||
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="direction != null">
|
||||
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocol != null">
|
||||
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocolId != null">
|
||||
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
|
||||
</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="createTime != null and createTime !=''">
|
||||
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editorName != null and editorName !=''">
|
||||
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editTime != null and editTime !='' ">
|
||||
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditorName != null and auditorName !=''">
|
||||
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="auditTime != null and auditTime !=''">
|
||||
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
|
||||
</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="regionId != null">
|
||||
AND r.region_id=#{regionId,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="areaEffectiveIds != null and areaEffectiveIds !=''">
|
||||
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="userRegion3 != null">
|
||||
AND r.user_region3 like concat(concat('%',#{userRegion3,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
|
||||
<!-- 数据范围过滤 -->
|
||||
${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="get" resultMap="IpCommGroupCfgMap">
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
ip_comm_cfg r
|
||||
WHERE
|
||||
r.cfg_id = #{ids} AND r.is_valid != -1
|
||||
</select>
|
||||
|
||||
<select id="getCfgInfoByGroupIds" resultMap="IpCommGroupCfgMap">
|
||||
SELECT
|
||||
<include refid="columns"></include>
|
||||
FROM
|
||||
ip_comm_cfg r
|
||||
WHERE
|
||||
r.group_id IN(${ids}) AND r.is_valid != -1
|
||||
</select>
|
||||
<select id="getByIds" resultMap="IpCommGroupCfgMap">
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
from ip_comm_cfg r
|
||||
where r.cfg_id in (${ids}) and r.is_valid !=-1
|
||||
</select>
|
||||
<select id="getByAsnNo" resultMap="IpCommGroupCfgMap" parameterType="java.lang.Long" >
|
||||
select
|
||||
<include refid="columns"></include>
|
||||
from ip_comm_cfg r where r.is_valid!=-1 and r.user_region1=#{asnId}
|
||||
</select>
|
||||
<insert id="insertIpCommGroupCfg" parameterType="com.nis.domain.basics.IpCommCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into ip_comm_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
REGION_ID,
|
||||
GROUP_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
FUNCTION_ID,
|
||||
IP_TYPE,
|
||||
SRC_IP_ADDRESS,
|
||||
SRC_IP_PATTERN,
|
||||
DEST_IP_PATTERN,
|
||||
SRC_PORT_PATTERN,
|
||||
DEST_PORT_PATTERN,
|
||||
SRC_PORT,
|
||||
PROTOCOL,
|
||||
PROTOCOL_ID,
|
||||
DIRECTION,
|
||||
DEST_PORT,
|
||||
DEST_IP_ADDRESS,
|
||||
CFG_TYPE,
|
||||
CFG_REGION_CODE,
|
||||
USER_REGION1,
|
||||
USER_REGION2,
|
||||
USER_REGION3,
|
||||
USER_REGION4,
|
||||
USER_REGION5,
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{groupId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{ipType,jdbcType=INTEGER},
|
||||
#{srcIpAddress,jdbcType=VARCHAR},
|
||||
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
|
||||
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
|
||||
#{srcPort,jdbcType=VARCHAR},
|
||||
#{protocol,jdbcType=INTEGER},
|
||||
#{protocolId,jdbcType=INTEGER},
|
||||
#{direction,jdbcType=INTEGER},
|
||||
#{destPort,jdbcType=VARCHAR},
|
||||
#{destIpAddress,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertForBatch" parameterType="com.nis.domain.basics.IpCommCfg" >
|
||||
insert into ip_comm_cfg (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
REGION_ID,
|
||||
GROUP_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
FUNCTION_ID,
|
||||
IP_TYPE,
|
||||
SRC_IP_ADDRESS,
|
||||
SRC_IP_PATTERN,
|
||||
DEST_IP_PATTERN,
|
||||
SRC_PORT_PATTERN,
|
||||
DEST_PORT_PATTERN,
|
||||
SRC_PORT,
|
||||
PROTOCOL,
|
||||
PROTOCOL_ID,
|
||||
DIRECTION,
|
||||
DEST_PORT,
|
||||
DEST_IP_ADDRESS,
|
||||
CFG_TYPE,
|
||||
CFG_REGION_CODE,
|
||||
USER_REGION1,
|
||||
USER_REGION2,
|
||||
USER_REGION3,
|
||||
USER_REGION4,
|
||||
USER_REGION5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
#{isValid,jdbcType=INTEGER},
|
||||
#{isAudit,jdbcType=INTEGER},
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{regionId,jdbcType=INTEGER},
|
||||
#{groupId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{ipType,jdbcType=INTEGER},
|
||||
#{srcIpAddress,jdbcType=VARCHAR},
|
||||
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
|
||||
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
|
||||
#{srcPort,jdbcType=VARCHAR},
|
||||
#{protocol,jdbcType=INTEGER},
|
||||
#{protocolId,jdbcType=INTEGER},
|
||||
#{direction,jdbcType=INTEGER},
|
||||
#{destPort,jdbcType=VARCHAR},
|
||||
#{destIpAddress,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<update id="update" parameterType="com.nis.domain.basics.IpCommCfg" >
|
||||
update ip_comm_cfg
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
CFG_DESC = #{cfgDesc,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="regionId != null" >
|
||||
REGION_ID = #{regionId,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="ipType != null" >
|
||||
IP_TYPE = #{ipType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress != ''" >
|
||||
SRC_IP_ADDRESS = #{srcIpAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="srcIpPattern != null" >
|
||||
SRC_IP_PATTERN = #{srcIpPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="destIpPattern != null" >
|
||||
DEST_IP_PATTERN =#{destIpPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcPortPattern != null" >
|
||||
SRC_PORT_PATTERN = #{srcPortPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="destPortPattern != null" >
|
||||
DEST_PORT_PATTERN = #{destPortPattern,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcPort != null and srcPort != ''" >
|
||||
SRC_PORT = #{srcPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="protocol != null" >
|
||||
PROTOCOL = #{protocol,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="protocolId != null" >
|
||||
PROTOCOL_ID = #{protocolId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="direction != null" >
|
||||
DIRECTION = #{direction,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="destPort != null and destPort != ''" >
|
||||
DEST_PORT = #{destPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="destIpAddress != null and destIpAddress != ''" >
|
||||
DEST_IP_ADDRESS = #{destIpAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgType != null and cfgType != ''" >
|
||||
CFG_TYPE = #{cfgType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="cfgRegionCode != null " >
|
||||
CFG_REGION_CODE = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
USER_REGION1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion2 != null and userRegion2 != ''" >
|
||||
USER_REGION2 = #{userRegion2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion3 != null and userRegion3 != ''" >
|
||||
USER_REGION3 = #{userRegion3,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion4 != null and userRegion4 != ''" >
|
||||
USER_REGION4 = #{userRegion4,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion5 != null and userRegion5 != ''" >
|
||||
USER_REGION5 = #{userRegion5,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="groupId != null and groupId != ''" >
|
||||
GROUP_ID = #{groupId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="regionId != null and regionId != ''" >
|
||||
REGION_ID = #{regionId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
and cfg_id = #{cfgId,jdbcType=INTEGER}
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="java.lang.String" >
|
||||
delete from ip_comm_cfg where cfg_id in (${ids})
|
||||
</delete>
|
||||
<select id="getGroupIdCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
||||
SELECT COUNT(cfg_id) groupCount from ip_comm_cfg
|
||||
WHERE group_id= #{groupId}
|
||||
and is_valid=1
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user