2018-03-17 17:09:19 +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.specific.SpecificServiceHostCfgDao" >
<resultMap id= "specificServiceHostCfgResultMap"
type="com.nis.domain.specific.SpecificServiceHostCfg">
<id column= "host_id" property= "hostId" jdbcType= "INTEGER" />
2018-03-21 13:43:43 +08:00
<result column= "spec_service_id" property= "specServiceId" jdbcType= "INTEGER" />
<result column= "ip_type" property= "ipType" jdbcType= "INTEGER" />
2018-03-17 17:09:19 +08:00
<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= "is_valid" property= "isValid" jdbcType= "INTEGER" />
<result column= "is_audit" property= "isAudit" jdbcType= "INTEGER" />
<result column= "create_time" property= "createTime" jdbcType= "TIMESTAMP" />
<result column= "edit_time" property= "editTime" jdbcType= "TIMESTAMP" />
<result column= "audit_time" property= "auditTime" jdbcType= "TIMESTAMP" />
<!-- 创建人员 -->
<association property= "creator" javaType= "com.nis.domain.SysUser" >
<id property= "id" column= "creator_id" />
</association>
<!-- 修改人员 -->
<association property= "editor" javaType= "com.nis.domain.SysUser" >
<id property= "id" column= "editor_id" />
</association>
<!-- 审核人员 -->
<association property= "auditor" javaType= "com.nis.domain.SysUser" >
<id property= "id" column= "auditor_id" />
</association>
</resultMap>
<sql id= "specificServiceHostCfgColumns" >
s.host_id AS hostId,
s.spec_service_id AS specServiceId,
2018-03-21 13:43:43 +08:00
s.ip_type AS ipType,
2018-03-17 17:09:19 +08:00
s.src_ip AS srcIp,
s.src_ip_mask AS srcIpMask,
s.src_port AS srcPort,
s.src_port_mask AS srcPortMask,
s.dst_ip AS dstIp,
s.dst_ip_mask AS dstIpMask,
s.dst_port AS dstPort,
s.dst_port_mask AS dstPortMask,
s.direction AS direction,
s.protocol AS protocol,
s.is_valid AS isValid,
s.is_audit AS isAudit,
s.creator_id AS "creator.id",
s.create_time AS createTime,
s.editor_id AS "editor.id",
s.edit_time AS editTime,
s.auditor_id AS "auditor.id",
s.audit_time AS auditTime
</sql>
<!-- 根据id查出对象 -->
<select id= "getByHostId" resultType= "com.nis.domain.specific.SpecificServiceHostCfg"
parameterType="java.lang.Integer">
select
<include refid= "specificServiceHostCfgColumns" />
from specific_service_host_cfg s where s.host_id = #{hostId}
</select>
<!-- 查询分页 -->
<select id= "findSpecHostList" resultMap= "specificServiceHostCfgResultMap" parameterType= "com.nis.domain.specific.SpecificServiceHostCfg" >
2018-03-21 13:43:43 +08:00
select * from specific_service_host_cfg where is_valid = 1
2018-03-17 17:09:19 +08:00
<if test= "isAudit !=null" >
AND is_audit = #{isAudit}
</if>
<if test= "specServiceId !=null" >
AND spec_service_id = #{specServiceId}
</if>
2018-03-21 13:43:43 +08:00
<if test= "ipType !=null" >
AND ip_type = #{ipType}
</if>
<if test= "srcIp !=null and srcIp !='' " >
AND src_ip = #{srcIp}
</if>
<if test= "dstIp !=null and dstIp !='' " >
AND dst_ip = #{dstIp}
</if>
2018-03-17 17:09:19 +08:00
<if test= "protocol !=null" >
AND protocol = #{protocol}
</if>
<if test= "direction !=null" >
AND direction = #{direction}
</if>
2018-03-21 13:43:43 +08:00
<if test= "beginDate !=null and beginDate !='' " >
2018-03-17 17:09:19 +08:00
AND create_time > = #{beginDate,jdbcType=TIMESTAMP}
</if>
2018-03-21 13:43:43 +08:00
<if test= "endDate !=null and endDate !='' " >
2018-03-17 17:09:19 +08:00
AND create_time < = #{endDate,jdbcType=TIMESTAMP}
</if>
2018-03-21 13:43:43 +08:00
<if test= "editBeginDate !=null and editBeginDate !='' " >
2018-03-17 17:09:19 +08:00
AND edit_time > = #{editBeginDate,jdbcType=TIMESTAMP}
</if>
2018-03-21 13:43:43 +08:00
<if test= "editEndDate !=null and editEndDate !='' " >
2018-03-17 17:09:19 +08:00
AND edit_time < = #{editEndDate,jdbcType=TIMESTAMP}
</if>
2018-03-21 13:43:43 +08:00
<if test= "auditBeginDate !=null and auditBeginDate !='' " >
2018-03-17 17:09:19 +08:00
AND audit_time > = #{auditBeginDate,jdbcType=TIMESTAMP}
</if>
2018-03-21 13:43:43 +08:00
<if test= "auditEndDate !=null and auditEndDate !='' " >
2018-03-17 17:09:19 +08:00
AND audit_time < = #{auditEndDate,jdbcType=TIMESTAMP}
</if>
<choose >
<when test= "page !=null and page.orderBy != null and page.orderBy != ''" >
ORDER BY ${page.orderBy}
</when>
<otherwise >
ORDER BY create_time desc
</otherwise>
</choose>
</select>
2018-03-21 13:43:43 +08:00
<!-- 根据协议ID查询对象 -->
<select id= "getBySpecServiceId" resultType= "com.nis.domain.specific.SpecificServiceHostCfg" parameterType= "java.lang.Integer" >
select
<include refid= "specificServiceHostCfgColumns" />
from specific_service_host_cfg s where s.spec_service_id = #{specServiceId}
2018-03-17 17:09:19 +08:00
</select>
<!-- 新增 -->
<insert id= "insert" parameterType= "com.nis.domain.specific.SpecificServiceHostCfg" >
2018-03-21 13:43:43 +08:00
insert into specific_service_host_cfg (spec_service_id,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,editor_id,edit_time,auditor_id,audit_time)
values(#{specServiceId},#{ipType},#{srcIp},#{srcIpMask},#{srcPort},#{srcPortMask},#{dstIp},#{dstIpMask},#{dstPort},#{dstPortMask},#{direction},#{protocol},#{isValid},#{isAudit},#{creator.id},#{createTime},#{editor.id},#{editTime},#{auditor.id},#{auditTime})
2018-03-17 17:09:19 +08:00
</insert>
<!-- 修改 -->
<update id= "update" parameterType= "com.nis.domain.specific.SpecificServiceHostCfg" >
update specific_service_host_cfg s set
s.spec_service_id = #{specServiceId},
2018-03-21 13:43:43 +08:00
s.ip_type = #{ipType},
2018-03-17 17:09:19 +08:00
s.src_ip = #{srcIp},
s.src_ip_mask = #{srcIpMask},
s.src_port = #{srcPort},
s.src_port_mask = #{srcPortMask},
s.dst_ip = #{dstIp},
s.dst_ip_mask = #{dstIpMask},
s.dst_port = #{dstPort},
s.dst_port_mask = #{dstPortMask},
s.direction = #{direction},
s.protocol = #{protocol},
s.is_valid = #{isValid},
s.is_audit = #{isAudit},
s.creator_id = #{creator.id},
s.create_time = #{createTime},
s.editor_id = #{editor.id},
s.edit_time = #{editTime},
s.auditor_id = #{auditor.id},
s.audit_time = #{auditTime}
where s.host_id = #{hostId}
</update>
<!-- 删除 -->
<update id= "delete" parameterType= "java.lang.Integer" >
update specific_service_host_cfg s set
s.is_valid = 0
where s.host_id = #{hostId}
</update>
</mapper>