解决冲突 提交本地
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package com.nis.web.dao.specific;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.specific.SpecificServiceCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface SpecificServiceCfgDao extends CrudDao<SpecificServiceCfg> {
|
||||
|
||||
/**
|
||||
* 根据id查出对象
|
||||
* @param specServiceId
|
||||
* @return
|
||||
*/
|
||||
SpecificServiceCfg getBySpecServiceId(Integer specServiceId);
|
||||
/**
|
||||
* 查询所有符合条件顶层分页列表
|
||||
* @param specificServiceCfg
|
||||
*/
|
||||
List<SpecificServiceCfg> findTopPage(SpecificServiceCfg specificServiceCfg);
|
||||
/**
|
||||
* 查询所有符合条件的数据
|
||||
* @param specificServiceCfg
|
||||
* @return
|
||||
*/
|
||||
List<SpecificServiceCfg> findAllSpecificServiceCfg(SpecificServiceCfg specificServiceCfg);
|
||||
/**
|
||||
* 修改配置信息
|
||||
* @param specificServiceCfg
|
||||
* @param oldId
|
||||
*/
|
||||
void update(@Param("specificServiceCfg")SpecificServiceCfg specificServiceCfg, @Param("oldId")Integer oldId);
|
||||
/**
|
||||
* 根据specServiceId查询所有下级
|
||||
* @param specServiceId
|
||||
* @return
|
||||
*/
|
||||
List<SpecificServiceCfg> getChildrenById(Integer specServiceId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
142
src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml
Normal file
142
src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml
Normal file
@@ -0,0 +1,142 @@
|
||||
<?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.SpecificServiceCfgDao" >
|
||||
|
||||
<resultMap id="CFGResultMap" type="com.nis.domain.specific.SpecificServiceCfg" >
|
||||
<id column="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
|
||||
<result column="spec_service_name" property="specServiceName" jdbcType="VARCHAR" />
|
||||
<result column="spec_service_desc" property="specServiceDesc" jdbcType="VARCHAR" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="op_time" property="opTime" jdbcType="TIMESTAMP" />
|
||||
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
|
||||
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<!-- 父id -->
|
||||
<association property="parent" javaType="com.nis.domain.specific.SpecificServiceCfg">
|
||||
<id column="parent_id" property="specServiceId" jdbcType="INTEGER" />
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<sql id="specificServiceCfgColumns">
|
||||
s.spec_service_id AS specServiceId,
|
||||
s.spec_service_name AS specServiceName,
|
||||
s.spec_service_desc AS specServiceDesc,
|
||||
s.is_valid AS isValid,
|
||||
s.op_time AS opTime,
|
||||
s.parent_id AS "parent.specServiceId",
|
||||
s.is_leaf AS isLeaf,
|
||||
s.group_id AS groupId
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- 根据id查出对象 -->
|
||||
<select id="getBySpecServiceId" resultType="com.nis.domain.specific.SpecificServiceCfg" parameterType="java.lang.Integer">
|
||||
select <include refid="specificServiceCfgColumns" />
|
||||
from specific_service_cfg s where s.spec_service_id = #{specServiceId}
|
||||
</select>
|
||||
|
||||
<!-- 查出所有符合条件的顶层数据 -->
|
||||
|
||||
<select id="findTopPage" resultMap="CFGResultMap" parameterType="com.nis.domain.specific.SpecificServiceCfg">
|
||||
SELECT * FROM specific_service_cfg s WHERE s.is_valid=1
|
||||
|
||||
<if test="specServiceId != null">
|
||||
AND s.spec_service_id like '%${specServiceId}%'
|
||||
</if>
|
||||
<if test="specServiceName != null and specServiceName != '' ">
|
||||
AND s.spec_service_name like '%${specServiceName}%'
|
||||
</if>
|
||||
<if test="specServiceDesc != null and specServiceDesc != '' ">
|
||||
AND s.spec_service_desc like '%${specServiceDesc}%'
|
||||
</if>
|
||||
<if test="beginDate != null" >
|
||||
AND s.op_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate != null" >
|
||||
AND s.op_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
AND s.parent_id not in (
|
||||
SELECT s2.spec_service_id FROM specific_service_cfg s2 WHERE s2.is_valid=1
|
||||
<if test="specServiceId != null">
|
||||
AND s2.spec_service_id like '%${specServiceId}%'
|
||||
</if>
|
||||
<if test="specServiceName != null and specServiceName != '' ">
|
||||
AND s2.spec_service_name like '%${specServiceName}%'
|
||||
</if>
|
||||
<if test="specServiceDesc != null and specServiceDesc != '' ">
|
||||
AND s2.spec_service_desc like '%${specServiceDesc}%'
|
||||
</if>
|
||||
<if test="beginDate != null" >
|
||||
AND s2.op_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate != null" >
|
||||
AND s2.op_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
)
|
||||
<choose>
|
||||
<when test="page != null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY s.${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY s.op_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的所有数据 -->
|
||||
<select id="findAllSpecificServiceCfg" resultMap="CFGResultMap" parameterType="com.nis.domain.specific.SpecificServiceCfg">
|
||||
SELECT * from specific_service_cfg where is_valid = 1
|
||||
<if test="specServiceId != null">
|
||||
AND spec_service_id like '%${specServiceId}%'
|
||||
</if>
|
||||
<if test="specServiceName != null and specServiceName != '' ">
|
||||
AND spec_service_name like '%${specServiceName}%'
|
||||
</if>
|
||||
<if test="specServiceDesc != null and specServiceDesc != '' ">
|
||||
AND spec_service_desc like '%${specServiceDesc}%'
|
||||
</if>
|
||||
<if test="beginDate != null">
|
||||
AND op_time > #{beginDate}
|
||||
</if>
|
||||
<if test="endDate != null" >
|
||||
AND op_time < #{endDate}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="page != null and page.orderBy != null and page.orderBy != '' ">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY op_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true">
|
||||
insert into specific_service_cfg (spec_service_id,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id)
|
||||
values(#{specServiceId},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId})
|
||||
</insert>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="update" parameterType="com.nis.domain.specific.SpecificServiceCfg">
|
||||
UPDATE specific_service_cfg s SET
|
||||
s.spec_service_id = #{specificServiceCfg.specServiceId},
|
||||
s.spec_service_name = #{specificServiceCfg.specServiceName},
|
||||
s.spec_service_desc = #{specificServiceCfg.specServiceDesc},
|
||||
s.is_valid = #{specificServiceCfg.isValid},
|
||||
s.op_time = #{specificServiceCfg.opTime},
|
||||
s.parent_id = #{specificServiceCfg.parent.specServiceId},
|
||||
s.is_leaf = #{specificServiceCfg.isLeaf},
|
||||
s.group_id = #{specificServiceCfg.groupId}
|
||||
WHERE s.spec_service_id = #{oldId}
|
||||
</update>
|
||||
|
||||
<!-- 删除 -->
|
||||
<update id="delete" parameterType="com.nis.domain.specific.SpecificServiceCfg">
|
||||
UPDATE specific_service_cfg s set s.is_valid = #{isValid} where s.spec_service_id = #{specServiceId}
|
||||
</update>
|
||||
<!-- getChildrenById -->
|
||||
<select id="getChildrenById" resultMap="CFGResultMap" parameterType="java.lang.Integer">
|
||||
SELECT * FROM specific_service_cfg s WHERE s.is_valid = 1 and s.parent_id = #{specServiceId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.nis.web.dao.specific;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nis.domain.specific.SpecificServiceHostCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
|
||||
@MyBatisDao
|
||||
public interface SpecificServiceHostCfgDao extends CrudDao<SpecificServiceHostCfg> {
|
||||
|
||||
/**
|
||||
* 根据主键查询数据对象
|
||||
* @param hostId
|
||||
* @return
|
||||
*/
|
||||
SpecificServiceHostCfg getByHostId(Integer hostId);
|
||||
|
||||
/**
|
||||
* 查询分页
|
||||
* @param specificServiceHostCfg
|
||||
* @return
|
||||
*/
|
||||
List<SpecificServiceHostCfg> findSpecHostList(SpecificServiceHostCfg specificServiceHostCfg);
|
||||
|
||||
/**
|
||||
* 查出所有
|
||||
* @return
|
||||
*/
|
||||
List<SpecificServiceHostCfg> getAll();
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param hostId
|
||||
*/
|
||||
void delete(Integer hostId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?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" />
|
||||
<result column="spec_service_id" property="specServiceId"
|
||||
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="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,
|
||||
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">
|
||||
select * from specific_service_host_cfg where 1 = 1
|
||||
<if test="isAudit !=null" >
|
||||
AND is_audit = #{isAudit}
|
||||
</if>
|
||||
<if test="specServiceId !=null" >
|
||||
AND spec_service_id = #{specServiceId}
|
||||
</if>
|
||||
<if test="protocol !=null" >
|
||||
AND protocol = #{protocol}
|
||||
</if>
|
||||
<if test="direction !=null" >
|
||||
AND direction = #{direction}
|
||||
</if>
|
||||
<if test="beginDate !=null" >
|
||||
AND create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="endDate !=null" >
|
||||
AND create_time <= #{endDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editBeginDate !=null" >
|
||||
AND edit_time >= #{editBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editEndDate !=null" >
|
||||
AND edit_time <= #{editEndDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditBeginDate !=null" >
|
||||
AND audit_time >= #{auditBeginDate,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditEndDate !=null" >
|
||||
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>
|
||||
|
||||
<!-- 查询所有 -->
|
||||
<select id="getAll" resultMap="specificServiceHostCfgResultMap">
|
||||
select * from specific_service_host_cfg
|
||||
</select>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceHostCfg">
|
||||
insert into specific_service_host_cfg (spec_service_id,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},#{srcIp},#{srcIpMask},#{srcPort},#{srcPortMask},#{dstIp},#{dstIpMask},#{dstPort},#{dstPortMask},#{direction},#{protocol},#{isValid},#{isAudit},#{creator.id},#{createTime},#{editor.id},#{editTime},#{auditor.id},#{auditTime})
|
||||
</insert>
|
||||
<!-- 修改 -->
|
||||
<update id="update" parameterType="com.nis.domain.specific.SpecificServiceHostCfg">
|
||||
update specific_service_host_cfg s set
|
||||
s.spec_service_id = #{specServiceId},
|
||||
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>
|
||||
Reference in New Issue
Block a user