IP类配置提交

This commit is contained in:
wangxin
2018-02-25 18:43:20 +08:00
parent 1c93923000
commit 6647314e2b
16 changed files with 1411 additions and 107 deletions

View File

@@ -18,9 +18,12 @@ public interface IpCfgDao extends CrudDao<BaseIpCfg>{
public BaseIpCfg getById(@Param("tableName")String tableName,@Param("cfgId")Long id) ;
public BaseIpCfg get(BaseIpCfg entity) ;
public List<BaseIpCfg> findList(BaseIpCfg entity) ;
public List<BaseIpCfg> findAllList(BaseIpCfg entity) ;
public int insert(BaseIpCfg entity) ;
public int updateByPrimaryKeySelective(BaseIpCfg entity) ;
public int updateValid(BaseIpCfg entity) ;
public int delete(BaseIpCfg entity) ;
public int audit(BaseIpCfg entity) ;
public int getIsValid(@Param("tableName")String tableName,@Param("cfgId")Long id);
public int getIsValid(BaseIpCfg entity);
public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id);
public int getIsAudit(BaseIpCfg entity);
}

View File

@@ -12,7 +12,7 @@
<result column="dst_ip" property="dstIp" jdbcType="VARCHAR" />
<result column="dst_ip_mask" property="dstIpMask" jdbcType="VARCHAR" />
<result column="dst_port" property="dstPort" jdbcType="VARCHAR" />
<result column="dst_port_mask" property="srcPortMask" jdbcType="VARCHAR" />
<result column="dst_port_mask" property="dstPortMask" jdbcType="VARCHAR" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
@@ -34,6 +34,42 @@
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="BaseIpMapWithUser" type="com.nis.domain.configuration.BaseIpCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip" property="srcIp" jdbcType="VARCHAR" />
<result column="src_ip_mask" property="srcIpMask" jdbcType="VARCHAR" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="src_port_mask" property="srcPortMask" jdbcType="VARCHAR" />
<result column="dst_ip" property="dstIp" jdbcType="VARCHAR" />
<result column="dst_ip_mask" property="dstIpMask" jdbcType="VARCHAR" />
<result column="dst_port" property="dstPort" jdbcType="VARCHAR" />
<result column="dst_port_mask" property="dstPortMask" 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="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="FtpIpMap" type="com.nis.domain.configuration.FtpIpCfg" extends="BaseIpMap" />
<resultMap id="HttpIpMap" type="com.nis.domain.configuration.HttpIpCfg" extends="BaseIpMap" />
<resultMap id="L2tpIpMap" type="com.nis.domain.configuration.L2tpIpCfg" extends="BaseIpMap" />
@@ -56,6 +92,14 @@
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS
</sql>
<sql id="BaseIpCfg_Column_List_with_id_alias" >
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.IP_TYPE as ipType, r.SRC_IP as scrIp, r.SRC_IP_MASK as srcIpMask, r.SRC_PORT as srcPort,
r.SRC_PORT_MASK as srcPortMask ,r.DST_IP as dstIp,r.DST_IP_MASK as dstIpMask, r.DST_PORT as dstPort, r.DST_PORT_MASK as dstPortMask,
r.DIRECTION as direction,r.PROTOCOL as protocol,r.PROTOCOL_ID as protocolId,r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.AREA_EFFECTIVE_IDS AS areaEffectiveIds
</sql>
<sql id="BaseIpCfg_Column_List" >
CFG_DESC, IP_TYPE, SRC_IP, SRC_IP_MASK, SRC_PORT,
SRC_PORT_MASK ,DST_IP ,DST_IP_MASK, DST_PORT, DST_PORT_MASK,
@@ -89,101 +133,235 @@
FROM ${tableName}
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
CFG_ID=#{cfgId,jdbcType=BIGINT}
AND CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null">
CFG_DESC=#{cfgDesc,jdbcType=VARCHAR}
AND CFG_DESC=#{cfgDesc,jdbcType=VARCHAR}
</if>
<if test="ipType != null">
IP_TYPE=#{ipType,jdbcType=INTEGER}
AND IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIp != null">
SRC_IP=#{srcIp,jdbcType=VARCHAR}
AND SRC_IP=#{srcIp,jdbcType=VARCHAR}
</if>
<if test="srcIpMask != null">
SRC_IP_MASK=#{srcIpMask,jdbcType=VARCHAR}
AND SRC_IP_MASK=#{srcIpMask,jdbcType=VARCHAR}
</if>
<if test="srcPort != null">
SRC_PORT=#{srcPort,jdbcType=VARCHAR}
AND SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="srcPortMask != null">
SRC_PORT_MASK=#{srcPortMask,jdbcType=VARCHAR}
AND SRC_PORT_MASK=#{srcPortMask,jdbcType=VARCHAR}
</if>
<if test="dstIp != null">
DST_IP=#{dstIp,jdbcType=VARCHAR}
AND DST_IP=#{dstIp,jdbcType=VARCHAR}
</if>
<if test="dstIpMask != null">
DST_IP_MASK=#{dstIpMask,jdbcType=VARCHAR}
AND DST_IP_MASK=#{dstIpMask,jdbcType=VARCHAR}
</if>
<if test="dstPort != null">
DST_PORT=#{dstPort,jdbcType=VARCHAR}
AND DST_PORT=#{dstPort,jdbcType=VARCHAR}
</if>
<if test="dstPortMask != null">
DST_PORT_MASK=#{dstPortMask,jdbcType=VARCHAR}
AND DST_PORT_MASK=#{dstPortMask,jdbcType=VARCHAR}
</if>
<if test="direction != null">
DIRECTION=#{direction,jdbcType=INTEGER}
AND DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null">
PROTOCOL=#{protocol,jdbcType=INTEGER}
AND PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null">
PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
AND PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null">
ACTION=#{action,jdbcType=INTEGER}
AND ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
IS_VALID=#{isValid,jdbcType=INTEGER}
AND IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isAudit != null">
IS_AUDIT=#{isAudit,jdbcType=INTEGER}
AND IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorId != null">
CREATOR_ID=#{creatorId,jdbcType=INTEGER}
AND CREATOR_ID=#{creatorId,jdbcType=INTEGER}
</if>
<if test="createTime != null">
CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
AND CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorId != null">
EDITOR_ID=#{editorId,jdbcType=INTEGER}
AND EDITOR_ID=#{editorId,jdbcType=INTEGER}
</if>
<if test="editTime != null">
EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
AND EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorId != null">
AUDITOR_ID=#{auditorId,jdbcType=INTEGER}
AND AUDITOR_ID=#{auditorId,jdbcType=INTEGER}
</if>
<if test="auditTime != null">
AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
AND AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
SERVICE_ID=#{serviceId,jdbcType=INTEGER}
AND SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
REQUEST_ID=#{requestId,jdbcType=INTEGER}
AND REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
COMPILE_ID=#{compileId,jdbcType=INTEGER}
AND COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
AND IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null">
classify=#{classify,jdbcType=VARCHAR}
AND classify=#{classify,jdbcType=VARCHAR}
</if>
<if test="attribute != null">
attribute=#{attribute,jdbcType=VARCHAR}
AND attribute=#{attribute,jdbcType=VARCHAR}
</if>
<if test="lable != null">
lable=#{lable,jdbcType=VARCHAR}
AND lable=#{lable,jdbcType=VARCHAR}
</if>
<if test="areaEffectiveIds != null">
AREA_EFFECTIVE_IDS=#{areaEffectiveIds,jdbcType=VARCHAR}
AND AREA_EFFECTIVE_IDS=#{areaEffectiveIds,jdbcType=VARCHAR}
</if>
</trim>
</select>
<select id="findList" resultMap="BaseIpMap">
<select id="findList" resultMap="BaseIpMapWithUser">
select
<!--<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>-->
<include refid="BaseIpCfg_Column_List_with_id_alias"/>
<!-- </otherwise>
</choose> -->
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName,sdic.item_value as classifyName,sdia.item_value as attributeName
,sdil.item_value as lableName
</trim>
from ${tableName} r
left join sys_user s on r.creator_id=s.id
left join sys_user u on r.editor_id=u.id
left join sys_user e on r.auditor_id=e.id
left join request_info ri on r.request_id=ri.id
left join service_dict_info sdic on r.classify=sdic.item_code and sdic.item_type=1 and sdic.is_valid=1 and sdic.is_leaf=0
left join service_dict_info sdia on r.attribute=sdia.item_code and sdia.item_type=1 and sdia.is_valid=1 and sdia.is_leaf=0
left join service_dict_info sdil on r.lable=sdil.item_code and sdil.item_type=1 and sdil.is_valid=1 and sdil.is_leaf=0
<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 r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIp != null">
AND r.SRC_IP=#{srcIp,jdbcType=VARCHAR}
</if>
<if test="srcIpMask != null">
AND r.SRC_IP_MASK=#{srcIpMask,jdbcType=VARCHAR}
</if>
<if test="srcPort != null">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="srcPortMask != null">
AND r.SRC_PORT_MASK=#{srcPortMask,jdbcType=VARCHAR}
</if>
<if test="dstIp != null">
AND r.DST_IP=#{dstIp,jdbcType=VARCHAR}
</if>
<if test="dstIpMask != null">
AND r.DST_IP_MASK=#{dstIpMask,jdbcType=VARCHAR}
</if>
<if test="dstPort != null">
AND r.DST_PORT=#{dstPort,jdbcType=VARCHAR}
</if>
<if test="dstPortMask != null">
AND r.DST_PORT_MASK=#{dstPortMask,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 CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null">
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="compileId != null">
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY CFG_ID desc
</otherwise>
</choose>
</select>
<select id="findAllList" resultMap="BaseIpMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
@@ -314,4 +492,23 @@
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<update id="updateValid" parameterType="com.nis.domain.configuration.BaseIpCfg" >
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<update id="audit" parameterType="com.nis.domain.configuration.BaseIpCfg" >
update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER}, auditor_id = #{auditorId,jdbcType=INTEGER}, audit_time = #{auditTime,jdbcType=TIMESTAMP}
<if test="isValid != null" >
,is_valid = #{isValid,jdbcType=INTEGER}
</if>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<select id="getIsValid" resultType="java.lang.Integer" parameterType="java.lang.Long" >
SELECT IS_VALID FROM ${tableName}
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
<select id="getIsAudit" resultType="java.lang.Integer" parameterType="java.lang.Long" >
SELECT IS_AUDIT FROM ${tableName}
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
</mapper>

View File

@@ -1,6 +1,7 @@
package com.nis.web.dao.configuration;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
@@ -29,6 +30,4 @@ public interface RequestInfoDao extends CrudDao {
int updateByPrimaryKey(RequestInfo requestInfo);
}

View File

@@ -270,4 +270,48 @@
audit_time = #{auditTime,jdbcType=DATE}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findAllList" resultMap="BaseResultMap">
select
r.id AS id,
r.request_number AS requestNumber,
r.request_org AS requestOrg,
r.request_time AS requestTime,
r.request_title AS requestTitle,
r.request_content AS requestContent,
r.is_valid AS isValid,
r.is_audit AS isAudit,
s.name AS creatorName,
r.create_time AS createTime,
u.name AS editorName,
r.edit_time AS editTime,
e.name AS currentName,
r.audit_time AS auditTime
from request_info r
left join sys_user s on r.creator_id=s.id
left join sys_user u on r.editor_id=u.id
left join sys_user e on r.auditor_id=e.id
<trim prefix="where" prefixOverrides="AND|OR">
<if test="requestTitle != null and requestTitle != ''">
AND r.request_title like
<if test="dbName == 'mysql'">CONCAT('%',#{requestTitle}, '%')</if>
</if>
<if test="requestContent != null and requestContent != ''">
AND r.request_content like
<if test="dbName == 'mysql'">CONCAT('%',#{requestContent},'%')</if>
</if>
<if test="requestNumber != null and requestNumber != ''">
AND r.request_number=#{requestNumber}
</if>
<if test="isAudit != null">
AND r.is_audit=${isAudit}
</if>
<if test=" timeType = 'requestTime' and beginDate!=null and beginDate!='' and endDate!=null and endDate!=''">
AND r.request_time between #{beginDate} and #{endDate}
</if>
<if test="timeType = 'createTime' and beginDate!=null and beginDate!='' and endDate!=null and endDate!=''">
AND (r.create_time between #{beginDate} and #{endDate}) or (r.audit_time between #{beginDate} and #{endDate})
</if>
</trim>
order by r.request_time desc
</select>
</mapper>

View File

@@ -44,6 +44,9 @@ public interface ServiceDictInfoDao extends CrudDao<ServiceDictInfo> {
* @return
*/
List<ServiceDictInfo> findAllDict();
List<ServiceDictInfo> findItemDict(@Param("itemType")int itemType,@Param("isValid")int isValid);
List<ServiceDictInfo> findAllItemDict(@Param("itemType")int itemType);

View File

@@ -162,5 +162,15 @@
UPDATE service_dict_info s set s.is_valid = #{isValid} where s.service_dict_id = #{serviceDictId}
</update>
<select id="findItemDict" resultMap="dictResultMap">
select
<include refid="serviceDictInfoColumns" />
from service_dict_info s where s.is_leaf = 0 and s.item_type=#{itemType} and s.is_valid=#{isValid};
</select>
<select id="findAllItemDict" resultMap="dictResultMap">
select
<include refid="serviceDictInfoColumns" />
from service_dict_info s where s.is_leaf = 0 and s.item_type=#{itemType};
</select>
</mapper>