IP类Dao,Service,Controller提交,后续会调整
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
@@ -10,8 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/ip")
|
||||
public class IpCfgController {
|
||||
|
||||
public class IpCfgController extends BaseController{
|
||||
// @Autowired
|
||||
// protected IpCfgService ipCfgService;
|
||||
|
||||
@RequestMapping(value = {"ipWhiteList"})
|
||||
public String ipWhiteList() {
|
||||
@@ -24,15 +37,75 @@ public class IpCfgController {
|
||||
return "/cfg/ipWhiteForm";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"ipBlockList"})
|
||||
public String ipBlockList() {
|
||||
public String ipBlockList(Model model,BaseIpCfg baseIpCfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
if(baseIpCfg!=null){
|
||||
Integer serviceId=baseIpCfg.getServiceId();
|
||||
logger.info("sercice id is "+serviceId);
|
||||
if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
baseIpCfg.setTableName(tableName);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(new Page<BaseIpCfg>(request, response, 1), baseIpCfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "/cfg/ipBlockList";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = {"ipBlockForm"})
|
||||
public String ipBlockForm() {
|
||||
public String ipBlockForm(Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
logger.info("sercice id is "+serviceId);
|
||||
System.out.println("ipBlockForm loaded");
|
||||
if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
String className=ipCfgService.getClassName(tableName);
|
||||
logger.info("class name is "+className);
|
||||
String packageName=BaseIpCfg.class.getPackage().getName();
|
||||
try {
|
||||
//通过反射获得BaseIpCfg的子类的实例,并调用子类的initDefaultValue初始化默认值
|
||||
Class clazz=Class.forName(packageName+"."+className);
|
||||
BaseIpCfg ipcfg=(BaseIpCfg)clazz.newInstance();
|
||||
ipcfg.setTableName(tableName);
|
||||
ipcfg.initDefaultValue();
|
||||
model.addAttribute("_ipCfg", ipcfg);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "/cfg/ipBlockForm";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* addIpPortCfg(新增IP配置)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(method=RequestMethod.POST,value = {"addIpCfg"})
|
||||
public String addIpCfg(@ModelAttribute("ipCfg") BaseIpCfg ipCfg) {
|
||||
if(ipCfg!=null&&!StringUtils.isBlank(ipCfg.getTableName())){
|
||||
int result=ipCfgService.addIpCfg(ipCfg);
|
||||
}
|
||||
return "/cfg/ipBlockForm";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
/**
|
||||
* IP相关配置数据处理类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class IpCfgDao {
|
||||
|
||||
@MyBatisDao
|
||||
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) ;
|
||||
}
|
||||
|
||||
317
src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml
Normal file
317
src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml
Normal file
@@ -0,0 +1,317 @@
|
||||
<?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.configuration.IpCfgDao" >
|
||||
<resultMap id="BaseIpMap" 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="srcPortMask" 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" />
|
||||
</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" />
|
||||
<resultMap id="MailIpMap" type="com.nis.domain.configuration.MailIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="MmsIpMap" type="com.nis.domain.configuration.MmsIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="OpenvpnIpMap" type="com.nis.domain.configuration.OpenvpnIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="PptpIpMap" type="com.nis.domain.configuration.PptpIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="RtmpIpMap" type="com.nis.domain.configuration.RtmpIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="RtpIpMap" type="com.nis.domain.configuration.RtpIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="RtspIpMap" type="com.nis.domain.configuration.RtspIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="SipIpMap" type="com.nis.domain.configuration.SipIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="SshIpMap" type="com.nis.domain.configuration.SshIpCfg" extends="BaseIpMap" />
|
||||
<resultMap id="SslIpMap" type="com.nis.domain.configuration.SslIpCfg" extends="BaseIpMap" />
|
||||
|
||||
<sql id="BaseIpCfg_Column_List_with_id" >
|
||||
CFG_ID, CFG_DESC, IP_TYPE, SRC_IP, SRC_IP_MASK, SRC_PORT,
|
||||
SRC_PORT_MASK ,DST_IP ,DST_IP_MASK, DST_PORT, DST_PORT_MASK,
|
||||
DIRECTION,PROTOCOL,PROTOCOL_ID,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS
|
||||
</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,
|
||||
DIRECTION,PROTOCOL,PROTOCOL_ID,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS
|
||||
</sql>
|
||||
<sql id="BaseIpCfg_Value_List" >
|
||||
#{cfgDesc,jdbcType=VARCHAR},#{ipType,jdbcType=INTEGER},
|
||||
#{srcIp,jdbcType=VARCHAR},#{srcIpMask,jdbcType=VARCHAR},#{srcPort,jdbcType=VARCHAR},
|
||||
#{srcPortMask,jdbcType=VARCHAR},#{dstIp,jdbcType=VARCHAR},#{dstIpMask,jdbcType=VARCHAR},
|
||||
#{dstPort,jdbcType=VARCHAR},#{dstPortMask,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
|
||||
#{protocol,jdbcType=INTEGER},#{protocolId,jdbcType=INTEGER},#{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},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR}
|
||||
</sql>
|
||||
<select id="getById" resultMap="BaseIpMap" parameterType="java.lang.Long" >
|
||||
SELECT
|
||||
<include refid="BaseIpCfg_Column_List_with_id" />
|
||||
FROM ${tableName}
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<select id="get" resultMap="BaseIpMap" >
|
||||
SELECT
|
||||
<include refid="BaseIpCfg_Column_List_with_id" />
|
||||
FROM ${tableName}
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="cfgId != null">
|
||||
CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="cfgDesc != null">
|
||||
CFG_DESC=#{cfgDesc,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="ipType != null">
|
||||
IP_TYPE=#{ipType,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="srcIp != null">
|
||||
SRC_IP=#{srcIp,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="srcIpMask != null">
|
||||
SRC_IP_MASK=#{srcIpMask,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="srcPort != null">
|
||||
SRC_PORT=#{srcPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="srcPortMask != null">
|
||||
SRC_PORT_MASK=#{srcPortMask,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="dstIp != null">
|
||||
DST_IP=#{dstIp,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="dstIpMask != null">
|
||||
DST_IP_MASK=#{dstIpMask,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="dstPort != null">
|
||||
DST_PORT=#{dstPort,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="dstPortMask != null">
|
||||
DST_PORT_MASK=#{dstPortMask,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="direction != null">
|
||||
DIRECTION=#{direction,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocol != null">
|
||||
PROTOCOL=#{protocol,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="protocolId != null">
|
||||
PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
|
||||
</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="creatorId != null">
|
||||
CREATOR_ID=#{creatorId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="editorId != null">
|
||||
EDITOR_ID=#{editorId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="editTime != null">
|
||||
EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="auditorId != null">
|
||||
AUDITOR_ID=#{auditorId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="auditTime != null">
|
||||
AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
<if test="serviceId != null">
|
||||
SERVICE_ID=#{serviceId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
REQUEST_ID=#{requestId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="compileId != null">
|
||||
COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isAreaEffective != null">
|
||||
IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="classify != null">
|
||||
classify=#{classify,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="attribute != null">
|
||||
attribute=#{attribute,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="lable != null">
|
||||
lable=#{lable,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null">
|
||||
AREA_EFFECTIVE_IDS=#{areaEffectiveIds,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
<select id="findList" resultMap="BaseIpMap">
|
||||
select
|
||||
<choose>
|
||||
<when test="page !=null and page.fields != null and page.fields != ''">
|
||||
${page.fields}
|
||||
</when>
|
||||
<otherwise>
|
||||
<include refid="BaseIpCfg_Column_List_with_id"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
from ${tableName}
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</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>
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into ${tableName} (
|
||||
<include refid="BaseIpCfg_Column_List" />
|
||||
)values (
|
||||
<include refid="BaseIpCfg_Value_List" />
|
||||
)
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
update ${tableName}
|
||||
<set >
|
||||
<if test="cfgDesc != null" >
|
||||
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="ipType != null" >
|
||||
ip_type = #{ipType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcIp != null" >
|
||||
src_ip = #{srcIp,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="srcIpMask != null" >
|
||||
src_ip_mask = #{srcIpMask,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="srcPort != null" >
|
||||
src_port = #{srcPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="srcPortMask != null" >
|
||||
src_port_mask = #{srcPortMask,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dstIp != null" >
|
||||
dst_ip = #{dstIp,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dstIpMask != null" >
|
||||
dst_ip_mask = #{dstIpMask,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dstPort != null" >
|
||||
dst_port = #{dstPort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="srcPortMask != null" >
|
||||
dst_port_mask = #{srcPortMask,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="direction != null" >
|
||||
direction = #{direction,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="protocol != null" >
|
||||
protocol = #{protocol,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="protocolId != null" >
|
||||
protocol_id = #{protocolId,jdbcType=INTEGER},
|
||||
</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="creatorId != null" >
|
||||
creator_id = #{creatorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
auditor_id = #{auditorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="auditTime != null" >
|
||||
audit_time = #{auditTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="serviceId != null" >
|
||||
service_id = #{serviceId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="requestId != null" >
|
||||
request_id = #{requestId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="compileId != null" >
|
||||
compile_id = #{compileId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isAreaEffective != null" >
|
||||
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="classify != null" >
|
||||
classify = #{classify,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="attribute != null" >
|
||||
attribute = #{attribute,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="lable != null" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</set>
|
||||
where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -1,5 +1,11 @@
|
||||
package com.nis.web.dao.systemService;
|
||||
|
||||
public interface ServiceConfigInfoDao {
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
@MyBatisDao
|
||||
public interface ServiceConfigInfoDao extends CrudDao<ServiceConfigInfo>{
|
||||
public ServiceConfigInfo findSysServiceConfigInfo(@Param("service_id")int serviceId);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.nis.web.dao.systemService;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.SystemServiceInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface SystemServiceInfoDao extends CrudDao<SystemServiceInfo> {
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.SysRole;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -142,8 +143,32 @@ public abstract class BaseService {
|
||||
|
||||
return scopeSql.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* getTableName(获取Class对应的表名)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param clazz
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public String getTableName(String clazz){
|
||||
return Configurations.getStringProperty(clazz, null);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getTableName(获取表名对应的Class)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param clazz
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public String getClassName(String tableName){
|
||||
return Configurations.getStringProperty(tableName, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
package com.nis.web.service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
@@ -13,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,88 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* IP相关配置事务类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class IpCfgService {
|
||||
|
||||
public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
@Autowired
|
||||
protected IpCfgDao ipCfgDao;
|
||||
/**
|
||||
*
|
||||
* addIpCfg(新增IP类配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param baseIpCfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int addIpCfg(BaseIpCfg baseIpCfg){
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("save "+tableName);
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* updateIpCfg(更新IP类配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param baseIpCfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg){
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("update "+tableName);
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getIpCfg(根据IP与类名获取IP配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
*BaseIpCfg
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public BaseIpCfg getIpCfgById(Class<?> clazz,long id){
|
||||
String tableName=getTableName(clazz.getSimpleName());
|
||||
logger.info("get "+tableName);
|
||||
return ipCfgDao.getById(tableName, id);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getIpCfg(根据IP与类名获取IP配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
*BaseIpCfg
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public BaseIpCfg getIpCfgById(BaseIpCfg baseIpCfg){
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("get "+tableName);
|
||||
return ipCfgDao.get(baseIpCfg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.nis.web.service.systemService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.web.dao.systemService.ServiceConfigInfoDao;
|
||||
|
||||
@Service
|
||||
public class ServiceConfigInfoService {
|
||||
@Autowired
|
||||
protected ServiceConfigInfoDao serviceConfigInfoDao;
|
||||
public ServiceConfigInfo findSysServiceConfigInfo(int serviceId){
|
||||
return serviceConfigInfoDao.findSysServiceConfigInfo(serviceId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user