社交应用配置查询、新增、修改功能

This commit is contained in:
zhangwei
2018-03-29 17:24:21 +08:00
parent e64f7d5b22
commit 99175da3f2
11 changed files with 2287 additions and 15 deletions

View File

@@ -8,6 +8,8 @@
*/
package com.nis.domain.configuration;
import java.util.List;
/**
* @ClassName: AppIdConfig.java
* @Description: TODO
@@ -30,8 +32,64 @@ public class AppIdCfg extends BaseCfg<AppIdCfg> {
/**
* 应用协议id
*/
private String appId;
private Long appId;
/**
* 编译id
*/
private Integer compileId;
/**
* 协议字符串特征表信息列表
*/
private List<ComplexkeywordCfg> complexFeaturesList;
/**
* 协议增强字符串特征配置信息列表
*/
private List<BaseStringCfg> strFeaturesCfgList;
private List<AppFeaturesIndex> featuresList;
public static class AppFeaturesIndex{
private Long indexId;
private Integer appCompileId;
private String featuresTable;
private Integer featuresCompileId;
private Integer featuresTableType;
public Long getIndexId() {
return indexId;
}
public void setIndexId(Long indexId) {
this.indexId = indexId;
}
public String getFeaturesTable() {
return featuresTable;
}
public void setFeaturesTable(String featuresTable) {
this.featuresTable = featuresTable;
}
public Integer getFeaturesTableType() {
return featuresTableType;
}
public void setFeaturesTableType(Integer featuresTableType) {
this.featuresTableType = featuresTableType;
}
public Integer getAppCompileId() {
return appCompileId;
}
public void setAppCompileId(Integer appCompileId) {
this.appCompileId = appCompileId;
}
public Integer getFeaturesCompileId() {
return featuresCompileId;
}
public void setFeaturesCompileId(Integer featuresCompileId) {
this.featuresCompileId = featuresCompileId;
}
}
/**
* appName
* @return appName
@@ -53,17 +111,34 @@ public class AppIdCfg extends BaseCfg<AppIdCfg> {
* @return appId
*/
public String getAppId() {
public Long getAppId() {
return appId;
}
/**
* @param appId the appId to set
*/
public void setAppId(String appId) {
public void setAppId(Long appId) {
this.appId = appId;
}
/**
* compileId
* @return compileId
*/
public Integer getCompileId() {
return compileId;
}
/**
* @param compileId the compileId to set
*/
public void setCompileId(Integer compileId) {
this.compileId = compileId;
}
/* (non-Javadoc)
* @see com.nis.domain.configuration.BaseCfg#initDefaultValue()
*/
@@ -73,5 +148,29 @@ public class AppIdCfg extends BaseCfg<AppIdCfg> {
super.initDefaultValue();
}
public List<ComplexkeywordCfg> getComplexFeaturesList() {
return complexFeaturesList;
}
public void setComplexFeaturesList(List<ComplexkeywordCfg> complexFeaturesList) {
this.complexFeaturesList = complexFeaturesList;
}
public List<BaseStringCfg> getStrFeaturesCfgList() {
return strFeaturesCfgList;
}
public void setStrFeaturesCfgList(List<BaseStringCfg> strFeaturesCfgList) {
this.strFeaturesCfgList = strFeaturesCfgList;
}
public List<AppFeaturesIndex> getFeaturesList() {
return featuresList;
}
public void setFeaturesList(List<AppFeaturesIndex> featuresList) {
this.featuresList = featuresList;
}
}

View File

@@ -22,6 +22,10 @@ public final class Constants {
* 词典数据key
*/
public static final String CACHE_DICT_MAP = "dictMap";
/**
* 特征域字典key
*/
public static final String CACHE_FEATURES_DICT_MAP = "featuresDictMap";
/**
* 词典数据分类
*/

View File

@@ -1,5 +1,6 @@
package com.nis.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -9,7 +10,9 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.SysDataDictionaryName;
import com.nis.domain.basics.SysDictInfo;
import com.nis.web.dao.SysDictDao;
import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.service.SpringContextHolder;
@@ -24,7 +27,7 @@ import com.nis.web.service.SpringContextHolder;
public class DictUtils {
private final static SysDictDao dictDao = SpringContextHolder.getBean(SysDictDao.class);
private final static SysDictInfoDao sysDictInfoDao = SpringContextHolder.getBean(SysDictInfoDao.class);
public static Map<String, List<SysDataDictionaryItem>> getDictData() {
@@ -139,8 +142,32 @@ public class DictUtils {
public static String getDictListJson(String key){
return JsonMapper.toJsonString(getDictList(key));
}
/**
* 增强字符串配置特征域字典
* @return
*/
public static List<SysDictInfo> getFeaturesDictData(String itemCode) {
Map<String, List<SysDictInfo>> dictMap = (Map<String, List<SysDictInfo>>)CacheUtils.get(Constants.CACHE_FEATURES_DICT_MAP);
if(StringUtil.isEmpty(dictMap)){
dictMap = Maps.newHashMap();
SysDictInfo dict = new SysDictInfo();
dict.setItemType(3);
dict.setItemCode(itemCode);
List<SysDictInfo> dicList = sysDictInfoDao.findAllSysDictInfo(dict,"");
dictMap.put(itemCode, dicList);
CacheUtils.put(Constants.CACHE_FEATURES_DICT_MAP, dictMap);
}else{
if(StringUtil.isEmpty(dictMap.get(itemCode))){
SysDictInfo dict = new SysDictInfo();
dict.setItemType(3);
dict.setItemCode(itemCode);
List<SysDictInfo> dicList = sysDictInfoDao.findAllSysDictInfo(dict,"");
dictMap.put(itemCode, dicList);
CacheUtils.put(Constants.CACHE_FEATURES_DICT_MAP, dictMap);
}
}
return dictMap.get(itemCode);
}
}

View File

@@ -1,13 +1,300 @@
package com.nis.web.controller.configuration;
import java.util.Date;
import java.util.List;
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 com.nis.domain.Page;
import com.nis.domain.ServiceConfigInfo;
import com.nis.domain.SystemServiceInfo;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.AppIdCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.util.Constants;
import com.nis.web.controller.BaseController;
/**
* 特定协议相关配置控制类
* @author dell
* @author zhangwei
*
*/
@Controller
public class AppCfgController {
@RequestMapping("${adminPath}/cfg/app")
public class AppCfgController extends BaseController {
@RequestMapping(value = {"list"})
public String cfgList(Model model,Integer audit,String cfgName,@ModelAttribute("cfg")AppIdCfg cfg,HttpServletRequest request,HttpServletResponse response) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("audit", audit);
if(cfg!=null){
Integer serviceId=cfg.getServiceId();
logger.info("servcice id is "+serviceId);
if(serviceId!=null){
model.addAttribute("serviceId", serviceId);
List<ServiceConfigInfo> serviceList=serviceConfigInfoService.findList(serviceId);
if(serviceList!=null){
for(ServiceConfigInfo s:serviceList){
if(s.getTableType()==2 || s.getTableType()==4){
model.addAttribute("isContainFeaturesCfg", true);
break;
}
}
Page<AppIdCfg> page = appCfgService.findPage(new Page<AppIdCfg>(request, response,"r"), cfg);
model.addAttribute("page", page);
model.addAttribute("action", cfg.getAction());
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
model.addAttribute("requestInfos", requestInfos);
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
model.addAttribute("fls", fls);
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
model.addAttribute("xzs", xzs);
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
model.addAttribute("lables", lables);
SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg();
specificServiceCfg.setIsValid(1);
model.addAttribute("protocolList",specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,"spec_service_id DESC"));
}else{
logger.error("未获取到正确的serviceId");
}
}
}
return "/cfg/appCfgList";
}
@RequestMapping(value = {"form"})
public String cfgForm(int action,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
model.addAttribute("action", action);
model.addAttribute("serviceId", serviceId);
model.addAttribute("audit", Constants.CFG_PAGE);
model.addAttribute("cfgName", cfgName);
logger.info("sercice id is "+serviceId);
// SystemServiceInfo serviceInfo=systemServiceService.get(serviceId);
// model.addAttribute("serviceInfo", serviceInfo);
//来函信息
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
model.addAttribute("requestInfos", requestInfos);
//分类信息
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
model.addAttribute("fls", fls);
//性质信息
List<ServiceDictInfo> xzs=serviceDictInfoService.findXzDict();
model.addAttribute("xzs", xzs);
//标签信息
List<ServiceDictInfo> lables=serviceDictInfoService.findLableDict();
model.addAttribute("lables", lables);
//特定服务信息
SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg();
specificServiceCfg.setIsValid(1);
model.addAttribute("protocolList",specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,"spec_service_id DESC"));
//协议特征配置
List<ServiceConfigInfo> featuresList = serviceConfigInfoService.findList(serviceId);
model.addAttribute("featuresList",featuresList);
//特征作用域信息
/*SysDictInfo sysDictInfo = new SysDictInfo();
sysDictInfo.setItemType(3);
Integer[] itType = new Integer[0];
List<SysDictInfo> featuresAreaList = sysDictInfoService.findAllSysDictInfo(sysDictInfo,itType,null);
model.addAttribute("featuresAreaList", featuresAreaList);*/
AppIdCfg cfg = new AppIdCfg();
cfg.initDefaultValue();
cfg.setAction(action);
cfg.setServiceId(serviceId.intValue());
model.addAttribute("_cfg", cfg);
return "/cfg/appCfgForm";
}
@RequestMapping(value = {"updateForm"})
public String updateAppCfgForm(int action,long cfgId,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("serviceId", serviceId);
model.addAttribute("action", action);
model.addAttribute("audit", Constants.CFG_PAGE);
AppIdCfg searchBean=new AppIdCfg();
searchBean.setCfgId(cfgId);
AppIdCfg cfg=appCfgService.getAppCfgById(searchBean);
model.addAttribute("_cfg", cfg);
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
model.addAttribute("requestInfos", requestInfos);
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
model.addAttribute("fls", fls);
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
model.addAttribute("xzs", xzs);
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
model.addAttribute("lables", lables);
//特定服务信息
SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg();
specificServiceCfg.setIsValid(1);
model.addAttribute("protocolList",specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,"spec_service_id DESC"));
//协议特征配置
List<ServiceConfigInfo> featuresList = serviceConfigInfoService.findList(serviceId);
model.addAttribute("featuresList",featuresList);
return "/cfg/appCfgForm";
}
@RequestMapping(value = {"showFeaturesCfg"})
public String showFeaturesCfg(int action,long cfgId,Integer compileId,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response){
AppIdCfg cfg=new AppIdCfg();
cfg.setCfgId(cfgId);
cfg.setCompileId(compileId);
cfg = appCfgService.findAppIdCfg(cfg);
model.addAttribute("_cfg", cfg);
model.addAttribute("cfgName", cfgName);
model.addAttribute("serviceId", serviceId);
model.addAttribute("action", action);
//协议特征配置
List<ServiceConfigInfo> featuresList = serviceConfigInfoService.findList(serviceId);
model.addAttribute("featuresList",featuresList);
return "/cfg/appFeaturesCfg";
}
/**
*
* addAppCfg(新增IP配置)
* (这里描述这个方法适用条件 可选)
* @return
*String
* @exception
* @since 1.0.0
*/
@RequestMapping(value = {"saveOrUpdateCfg"})
public String saveOrUpdateAppCfg(String cfgName,Model model, AppIdCfg cfg) {
model.addAttribute("audit", Constants.CFG_PAGE);
model.addAttribute("cfgType","app");
model.addAttribute("cfgName",cfgName);
model.addAttribute("serviceId",cfg.getServiceId());
model.addAttribute("action",cfg.getAction());
logger.info("saveOrUpdateAppCfg loaded");
if(cfg==null){
logger.error("无法保存空的配置!");
addMessage(model,"保存失败!");
}else{
SpecificServiceCfg protocol = specificServiceCfgService.getBySpecServiceId(cfg.getAppId().intValue());
if(protocol!=null){
cfg.setAppName(protocol.getSpecServiceName());
int serviceId=cfg.getServiceId();
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
if(cfg.getCfgId()==null){
cfg.setCreatorId(cfg.getCurrentUser().getId());
cfg.setCreateTime(new Date());
try {
appCfgService.addAppCfg(cfg);
} catch (Exception e) {
e.printStackTrace();
logger.error("配置保存失败!"+e.getMessage());
addMessage(model,"保存失败!");
}
}else{
cfg.setEditorId(cfg.getCurrentUser().getId());
cfg.setEditTime(new Date());
try {
appCfgService.updateAppCfg(cfg);
} catch (Exception e) {
e.printStackTrace();
logger.error("配置保存失败!"+e.getMessage());
addMessage(model,"保存失败!");
}
}
model.addAttribute("serviceId",serviceId);
model.addAttribute("action",cfg.getAction());
addMessage(model,"保存成功,正在为您跳转页面...");
}else{
logger.error("所选协议信息无效!");
addMessage(model,"保存失败!");
}
}
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+cfg.getServiceId()+"&action="+cfg.getAction()+"&cfgName="+cfgName);
}
/**
*
* auditAppCfg(审核IP配置)
* (这里描述这个方法适用条件 可选)
* @return
*String
* @exception
* @since 1.0.0
*/
@RequestMapping(value = {"auditCfg"})
public String auditAppCfg(String cfgName,AppIdCfg cfg,Model model) {
model.addAttribute("cfgName", cfgName);
model.addAttribute("audit", Constants.AUDIT_PAGE);
if(cfg==null){
logger.error("无法审核空的配置!");
}else{
int audit=appCfgService.getIsAudit(cfg.getCfgId());
if(audit==Constants.AUDIT_YES&&cfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
logger.error("审核通过的配置只能取消审核通过!");
}else{
cfg.setAuditorId(cfg.getCurrentUser().getId());
cfg.setAuditTime(new Date());
if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过设置有效标志为0
cfg.setIsValid(Constants.VALID_NO);
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过设置有效标志为1
cfg.setIsValid(Constants.VALID_YES);
}
int result=appCfgService.auditAppCfg(cfg);
model.addAttribute("serviceId", cfg.getServiceId());
model.addAttribute("action", cfg.getAction());
}
}
return "redirect:" + adminPath + "/cfg/app/list";
}
/**
*
* auditAppCfg(删除IP配置逻辑删除)
* (这里描述这个方法适用条件 可选)
* @return
*String
* @exception
* @since 1.0.0
*/
@RequestMapping(value = {"deleteCfg"})
public String deleteAppCfg(int action,long cfgId,String cfgName,Integer serviceId,Model model) {
model.addAttribute("serviceId", serviceId);
model.addAttribute("cfgName", cfgName);
model.addAttribute("action", action);
model.addAttribute("cfgType","complex");
model.addAttribute("audit", Constants.CFG_PAGE);
int audit=appCfgService.getIsAudit(cfgId);
//未审核时可删除
if(audit!=Constants.AUDIT_YES){
AppIdCfg cfg=new AppIdCfg();
cfg.setCfgId(cfgId);
cfg.setEditorId(cfg.getCurrentUser().getId());
cfg.setEditTime(new Date());
cfg.setIsValid(Constants.VALID_DEL);
int result=appCfgService.deleteAppCfg(cfg);
addMessage(model,"删除成功,正在为您跳转页面...");
}else{
logger.error("通过审核的配置不能删除!");
}
return "/cfg/resultPage";
}
/**
*
* getCompileId(获取编译ID)
* (这里描述这个方法适用条件 可选)
* @return
*long
* @exception
* @since 1.0.0
*/
protected Integer getCompileId(BaseCfg cfg){
return 0;
}
}

View File

@@ -1,11 +1,41 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.AppIdCfg;
import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
/**
* 特定协议相关配置数据处理类
* @author dell
*
*/
public class AppCfgDao {
@MyBatisDao
public interface AppCfgDao extends CrudDao<AppIdCfg> {
public AppIdCfg getById(@Param("cfgId")Long id) ;
public AppIdCfg get(AppIdCfg entity) ;
public List<AppIdCfg> findList(AppIdCfg entity) ;
public int insert(AppIdCfg entity) ;
public int updateByPrimaryKeySelective(AppIdCfg entity) ;
public int updateValid(AppIdCfg entity) ;
public int audit(AppIdCfg entity) ;
// public int getIsValid(@Param("tableName")String tableName,@Param("cfgId")Long id);
public int getIsValid(@Param("cfgId")Long id);
// public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id);
public int getIsAudit(@Param("cfgId")Long id);
public List<ComplexkeywordCfg> getComplexkeywordCfgList();
public List<AppFeaturesIndex> getFeaturesTableListByAppCompileId(@Param("appCompileId")Integer appCompileId) ;
public List<ComplexkeywordCfg> getFeaturesCfgListByCompileId(@Param("compileId")Integer compileId) ;
public int insertFeatures(AppFeaturesIndex entity) ;
public int updateFeaturesByAppId(AppFeaturesIndex entity) ;
public int deleteFeaturesByAppId(AppFeaturesIndex entity) ;
public List<ComplexkeywordCfg> getComplexkeywordFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId);
public List<BaseStringCfg> getStrFeaturesCfgListByCompileId(@Param("featuresTable") String featuresTable,@Param("compileId")Integer compileId);
}

View File

@@ -0,0 +1,562 @@
<?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.AppCfgDao" >
<resultMap id="AppCfgMap" type="com.nis.domain.configuration.AppIdCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="app_name" property="appName" jdbcType="VARCHAR" />
<result column="app_id" property="appId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<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="AppCfgMapWithUser" type="com.nis.domain.configuration.AppIdCfg" extends="AppCfgMap">
<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="AppFeaturesTableCfgMap" type="com.nis.domain.configuration.AppIdCfg$AppFeaturesIndex" >
<id column="index_id" property="indexId" jdbcType="BIGINT" />
<result column="APP_COMPILE_ID" property="appCompileId" jdbcType="INTEGER" />
<result column="FEATURES_TABLE" property="featuresTable" jdbcType="VARCHAR" />
<result column="FEATURES_COMPILE_ID" property="featuresCompileId" jdbcType="INTEGER" />
<result column="FEATURES_TABLE_TYPE" property="featuresTableType" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ComplexkeywordFeaturesCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="district" property="district" jdbcType="VARCHAR" />
<result column="keywords" property="keywords" jdbcType="VARCHAR" />
<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="expr_type " property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="BaseStringFeaturesCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<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="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<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>
<sql id="BaseStringFeaturesCfg_Column_List_with_id" >
CFG_ID, CFG_DESC, CFG_KEYWORDS,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,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN
</sql>
<sql id="ComplexkeywordFeaturesCfg_Column_List_with_id" >
CFG_ID, CFG_DESC,DISTRICT, KEYWORDS,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,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN
</sql>
<sql id="AppCfg_Column_List_with_id" >
CFG_ID, CFG_DESC,APP_NAME, APP_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="AppCfg_Column_List_with_id_alias" >
<choose>
<when test="page !=null and page.alias != null and page.alias != ''">
${page.alias}.CFG_ID as cfgId, ${page.alias}.CFG_DESC as cfgDesc,${page.alias}.APP_NAME as appName, ${page.alias}.APP_ID as appId, ${page.alias}.ACTION as action,${page.alias}.IS_VALID as isValid,${page.alias}.IS_AUDIT as isAudit,
${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime,
${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify,
${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable,
${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds
</when>
<otherwise>
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc,r.APP_NAME as appName, r.APP_ID as appId, 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
</otherwise>
</choose>
</sql>
<sql id="AppCfg_Column_List" >
CFG_DESC,APP_NAME,APP_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="AppCfg_Value_List" >
#{cfgDesc,jdbcType=VARCHAR},#{appName,jdbcType=VARCHAR},#{appId,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="AppCfgMap" parameterType="java.lang.Long" >
SELECT
<include refid="AppCfg_Column_List_with_id" />
FROM app_id_cfg
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
<select id="get" resultMap="AppCfgMap" >
SELECT
<include refid="AppCfg_Column_List_with_id" />
FROM app_id_cfg
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null">
AND CFG_DESC=#{cfgDesc,jdbcType=VARCHAR}
</if>
<if test="appName != null">
AND APP_NAME=#{appName,jdbcType=VARCHAR}
</if>
<if test="appId != null">
AND APP_ID=#{appId,jdbcType=BIGINT}
</if>
<if test="action != null">
AND ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isAudit != null">
AND IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorId != null">
AND CREATOR_ID=#{creatorId,jdbcType=INTEGER}
</if>
<if test="createTime != null">
AND CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorId != null">
AND EDITOR_ID=#{editorId,jdbcType=INTEGER}
</if>
<if test="editTime != null">
AND EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorId != null">
AND AUDITOR_ID=#{auditorId,jdbcType=INTEGER}
</if>
<if test="auditTime != null">
AND AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null">
AND classify=#{classify,jdbcType=VARCHAR}
</if>
<if test="attribute != null">
AND attribute=#{attribute,jdbcType=VARCHAR}
</if>
<if test="lable != null">
AND lable=#{lable,jdbcType=VARCHAR}
</if>
<if test="areaEffectiveIds != null">
AND AREA_EFFECTIVE_IDS=#{areaEffectiveIds,jdbcType=VARCHAR}
</if>
</trim>
</select>
<select id="findList" resultMap="AppCfgMapWithUser">
select
<include refid="AppCfg_Column_List_with_id_alias"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
from app_id_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
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_leaf=0
left join service_dict_info sdia on r.attribute=sdia.item_code and sdia.item_type=2 and sdia.is_leaf=0
left join service_dict_info sdil on r.lable=sdil.item_code and sdil.item_type=3 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>
<choose>
<when test="page !=null and page.alias != null and page.alias != ''">
<if test="cfgId != null">
AND ${page.alias}.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND ${page.alias}.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="appName != null and appName != ''">
AND ${page.alias}.APP_NAME like concat(concat('%',#{appName,jdbcType=VARCHAR}),'%')
</if>
<if test="appId != null">
AND ${page.alias}.APP_ID=#{appId,jdbcType=BIGINT}
</if>
<if test="action != null">
AND ${page.alias}.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND ${page.alias}.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND ${page.alias}.IS_VALID != -1
</if>
<if test="isAudit != null">
AND ${page.alias}.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 ${page.alias}.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 ${page.alias}.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 ${page.alias}.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND ${page.alias}.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND ${page.alias}.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND ${page.alias}.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND ${page.alias}.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND ${page.alias}.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND ${page.alias}.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND ${page.alias}.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND ${page.alias}.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
</when>
<otherwise>
<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="appName != null and appName != ''">
AND r.APP_NAME like concat(concat('%',#{appName,jdbcType=VARCHAR}),'%')
</if>
<if test="appId != null">
AND r.APP_ID=#{appId,jdbcType=BIGINT}
</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="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 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>
</otherwise>
</choose>
</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="AppCfgMap">
select
<choose>
<when test="page !=null and page.fields != null and page.fields != ''">
${page.fields}
</when>
<otherwise>
<include refid="AppCfg_Column_List_with_id"/>
</otherwise>
</choose>
from app_id_cfg
<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.AppIdCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into app_id_cfg (
<include refid="AppCfg_Column_List" />
)values (
<include refid="AppCfg_Value_List" />
)
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.nis.domain.configuration.AppIdCfg" >
update app_id_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="appName != null and appName != ''">
APP_NAME = #{appName,jdbcType=VARCHAR},
</if>
<if test="appId != null">
APP_ID = #{appId,jdbcType=BIGINT},
</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 and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</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="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 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 and areaEffectiveIds != ''" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<update id="updateValid" parameterType="com.nis.domain.configuration.AppIdCfg" >
update app_id_cfg 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.AppIdCfg" >
update app_id_cfg 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 app_id_cfg
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
<select id="getIsAudit" resultType="java.lang.Integer" parameterType="java.lang.Long" >
SELECT IS_AUDIT FROM app_id_cfg
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
</select>
<!-- 根据app_id_cfg表的compile_id查询协议特征配置表列表信息 -->
<select id="getFeaturesTableListByAppCompileId" resultMap="AppFeaturesTableCfgMap" parameterType="java.lang.Integer" >
SELECT INDEX_ID,app_compile_id,FEATURES_TABLE,features_compile_id,FEATURES_TABLE_TYPE FROM app_features_index f
WHERE f.app_compile_id = #{appCompileId,jdbcType=BIGINT}
</select>
<!-- 根据普通字符串配置特征表的compile_id查询配置信息 -->
<select id="getStrFeaturesCfgListByCompileId" resultMap="BaseStringFeaturesCfgMap" parameterType="java.lang.Integer" >
SELECT
<include refid="BaseStringFeaturesCfg_Column_List_with_id"/>
FROM ${featuresTable} c
WHERE c.COMPILE_ID =#{compileId,jdbcType=INTEGER}
</select>
<!-- 根据增强字符串配置特征表的compile_id查询配置信息 -->
<select id="getComplexkeywordFeaturesCfgListByCompileId" resultMap="ComplexkeywordFeaturesCfgMap" parameterType="java.lang.Integer" >
SELECT
<include refid="ComplexkeywordFeaturesCfg_Column_List_with_id"/>
FROM ${featuresTable} c
WHERE c.COMPILE_ID =#{compileId,jdbcType=INTEGER}
</select>
<insert id="insertFeatures" parameterType="com.nis.domain.configuration.AppIdCfg$AppFeaturesIndex" >
insert into app_features_index (INDEX_ID,APP_COMPILE_ID,FEATURES_TABLE,FEATURES_COMPILE_ID,FEATURES_TABLE_TYPE)
values
(#{indexId,jdbcType=BIGINT},#{appCompileId,jdbcType=INTEGER},#{featuresTable,jdbcType=VARCHAR},
#{featuresCompileId,jdbcType=INTEGER},#{featuresTableType,jdbcType=INTEGER}
)
</insert>
<!-- <update id="updateFeaturesByAppId" parameterType="com.nis.domain.configuration.AppIdCfg$AppFeaturesIndex" >
update app_features_index
<set >
<trim suffixOverrides=",">
<if test="featuresTable != null and featuresTable != ''" >
FEATURES_TABLE = #{featuresTable,jdbcType=VARCHAR},
</if>
<if test="featuresId != null ">
FEATURES_ID = #{featuresId,jdbcType=INTEGER},
</if>
</trim>
</set>
where APP_ID = #{appId,jdbcType=BIGINT}
</update>
<delete id="deleteFeaturesByAppId" parameterType="com.nis.domain.configuration.AppIdCfg$AppFeaturesIndex" >
delete app_features_index where APP_ID= #{appId,jdbcType=BIGINT}
</delete> -->
</mapper>

View File

@@ -1,6 +1,28 @@
package com.nis.web.service.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.Page;
import com.nis.domain.ServiceConfigInfo;
import com.nis.domain.configuration.AppIdCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.main.ConvertTool;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AppCfgDao;
import com.nis.web.dao.configuration.ComplexStringCfgDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.dao.systemService.ServiceConfigInfoDao;
import com.nis.web.service.CrudService;
/**
* 特定协议相关配置事务类
@@ -8,6 +30,296 @@ import org.springframework.stereotype.Service;
*
*/
@Service
public class AppCfgService {
public class AppCfgService extends CrudService<AppCfgDao,AppIdCfg> {
@Autowired
protected AppCfgDao appCfgDao;
@Autowired
protected ServiceConfigInfoDao serviceConfigInfoDao;
@Autowired
protected StringCfgDao stringCfgDao;
@Autowired
protected ComplexStringCfgDao complexStringCfgDao;
public Page<AppIdCfg> findPage(Page<AppIdCfg> page, AppIdCfg entity) {
entity.setPage(page);
List<AppIdCfg> list = dao.findList(entity);
page.setList(list);
return page;
}
public AppIdCfg findAppIdCfg(AppIdCfg entity) {
//查询协议关联特征表
List<AppFeaturesIndex> featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(entity.getCompileId());
List<ComplexkeywordCfg> complexList = new ArrayList();
List<BaseStringCfg> strList = new ArrayList();
if(!StringUtil.isEmpty(featuresTableList)){
for(AppFeaturesIndex features:featuresTableList){
if(features.getFeaturesTableType().equals(4)){//增强字符串特征配置
List<ComplexkeywordCfg> complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId(
features.getFeaturesTable(),features.getFeaturesCompileId());
complexList.addAll(complexFeaturesList);
}else if(features.getFeaturesTableType().equals(2)){//普通字符串特征配置
List<BaseStringCfg> strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId(
features.getFeaturesTable(),features.getFeaturesCompileId());
strList.addAll(strFeaturesCfgList);
}
}
}
entity.setComplexFeaturesList(complexList);
entity.setStrFeaturesCfgList(strList);
return entity;
}
/**
*
* addAppCfg(新增IP类配置)
* (继承AppIdCfg这个类方可使用)
* @param cfg
* @return
*int
* @throws Exception
* @exception
* @since 1.0.0
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public int addAppCfg(AppIdCfg cfg) throws Exception{
//通过配置转换工具获取compileId
Integer appCompileId = 0;
int cfgId = 0;
appCompileId = new ConvertTool().getCompileId();
cfg.setCompileId(appCompileId);
cfgId = appCfgDao.insert(cfg);
if(cfg.getComplexFeaturesList()!=null){
for(ComplexkeywordCfg c:cfg.getComplexFeaturesList()){
Integer featuresCompileId = new ConvertTool().getCompileId();
AppFeaturesIndex f = new AppFeaturesIndex();
f.setAppCompileId(cfg.getCompileId());
f.setFeaturesCompileId(featuresCompileId);
f.setFeaturesTableType(4);
f.setFeaturesTable(c.getTableName());
appCfgDao.insertFeatures(f);
c.setTableName(c.getTableName());
// c.initDefaultValue();
c.setAction(cfg.getAction());
c.setServiceId(cfg.getServiceId());
c.setCompileId(featuresCompileId);
c.setCreateTime(cfg.getCreateTime());
c.setCreatorId(cfg.getCreatorId());
c.setIsAudit(cfg.getIsAudit());
c.setIsValid(cfg.getIsValid());
c.setIsAreaEffective(cfg.getIsAreaEffective());
c.setAreaEffectiveIds(cfg.getAreaEffectiveIds());
c.setAttribute(cfg.getAttribute());
c.setLable(cfg.getLable());
c.setClassify(cfg.getClassify());
c.setRequestId(cfg.getRequestId());
c.setCfgDesc(cfg.getCfgDesc());
complexStringCfgDao.insert(c);
}
}
if(cfg.getStrFeaturesCfgList()!=null){
for(BaseStringCfg s:cfg.getStrFeaturesCfgList()){
Integer featuresCompileId = new ConvertTool().getCompileId();
AppFeaturesIndex f = new AppFeaturesIndex();
f.setAppCompileId(cfg.getCompileId());
f.setFeaturesCompileId(featuresCompileId);
f.setFeaturesTableType(2);
f.setFeaturesTable(s.getTableName());
appCfgDao.insertFeatures(f);
s.setTableName(s.getTableName());
// s.initDefaultValue();
s.setAction(cfg.getAction());
s.setServiceId(cfg.getServiceId());
s.setCompileId(featuresCompileId);
s.setCreateTime(cfg.getCreateTime());
s.setCreatorId(cfg.getCreatorId());
s.setIsAudit(cfg.getIsAudit());
s.setIsValid(cfg.getIsValid());
s.setIsAreaEffective(cfg.getIsAreaEffective());
s.setAreaEffectiveIds(cfg.getAreaEffectiveIds());
s.setAttribute(cfg.getAttribute());
s.setLable(cfg.getLable());
s.setClassify(cfg.getClassify());
s.setRequestId(cfg.getRequestId());
s.setCfgDesc(cfg.getCfgDesc());
stringCfgDao.insert(s);
}
}
return cfgId;
}
/**
*
* updateAppCfg(更新IP类配置)
* (继承AppIdCfg这个类方可使用)
* @param cfg
* @return
*int
* @throws Exception
* @exception
* @since 1.0.0
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public int updateAppCfg(AppIdCfg cfg) throws Exception{
if(cfg.getComplexFeaturesList()!=null){
for(ComplexkeywordCfg c:cfg.getComplexFeaturesList()){
Integer featuresCompileId = 0;
c.setIsAreaEffective(cfg.getIsAreaEffective());
c.setAreaEffectiveIds(cfg.getAreaEffectiveIds());
c.setAttribute(cfg.getAttribute());
c.setLable(cfg.getLable());
c.setClassify(cfg.getClassify());
c.setRequestId(cfg.getRequestId());
c.setCfgDesc(cfg.getCfgDesc());
c.setEditorId(cfg.getEditorId());
c.setEditTime(cfg.getEditTime());
if(c.getCompileId()==null){
featuresCompileId = new ConvertTool().getCompileId();
AppFeaturesIndex f = new AppFeaturesIndex();
f.setAppCompileId(cfg.getCompileId());
f.setFeaturesCompileId(featuresCompileId);
f.setFeaturesTableType(4);
f.setFeaturesTable(c.getTableName());
appCfgDao.insertFeatures(f);
c.setTableName(c.getTableName());
c.setAction(cfg.getAction());
c.setServiceId(cfg.getServiceId());
c.setCompileId(featuresCompileId);
c.setCreateTime(new Date());
c.setCreatorId(cfg.getCurrentUser().getId());
c.setIsAudit(cfg.getIsAudit());
c.setIsValid(cfg.getIsValid());
complexStringCfgDao.insert(c);
}else{
complexStringCfgDao.update(c);
}
}
}
if(cfg.getStrFeaturesCfgList()!=null){
for(BaseStringCfg s:cfg.getStrFeaturesCfgList()){
Integer featuresCompileId = 0;
s.setIsAreaEffective(cfg.getIsAreaEffective());
s.setAreaEffectiveIds(cfg.getAreaEffectiveIds());
s.setAttribute(cfg.getAttribute());
s.setLable(cfg.getLable());
s.setClassify(cfg.getClassify());
s.setRequestId(cfg.getRequestId());
s.setCfgDesc(cfg.getCfgDesc());
s.setEditorId(cfg.getEditorId());
s.setEditTime(cfg.getEditTime());
if(s.getCompileId()==null){
featuresCompileId = new ConvertTool().getCompileId();
AppFeaturesIndex f = new AppFeaturesIndex();
f.setAppCompileId(cfg.getCompileId());
f.setFeaturesCompileId(featuresCompileId);
f.setFeaturesTableType(2);
f.setFeaturesTable(s.getTableName());
appCfgDao.insertFeatures(f);
s.setTableName(s.getTableName());
s.setAction(cfg.getAction());
s.setServiceId(cfg.getServiceId());
s.setCompileId(featuresCompileId);
s.setCreateTime(new Date());
s.setCreatorId(cfg.getCurrentUser().getId());
s.setIsAudit(cfg.getIsAudit());
s.setIsValid(cfg.getIsValid());
stringCfgDao.insert(s);
}else{
stringCfgDao.update(s);
}
}
}
return appCfgDao.updateByPrimaryKeySelective(cfg);
}
/**
*
* auditAppCfg(审核IP类配置)
* (继承AppIdCfg这个类方可使用)
* @param cfg
* @return
*int
* @exception
* @since 1.0.0
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public int auditAppCfg(AppIdCfg cfg){
return appCfgDao.audit(cfg);
}
/**
*
* deleteAppCfg(删除IP类配置)
* (继承AppIdCfg这个类方可使用)
* @param cfg
* @return
*int
* @exception
* @since 1.0.0
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public int deleteAppCfg(AppIdCfg cfg){
return appCfgDao.updateValid(cfg);
}
/**
*
* getAppCfg(根据IP与类名获取IP配置)
* (继承AppIdCfg这个类方可使用)
* @param id
* @return
*AppIdCfg
* @exception
* @since 1.0.0
*/
public AppIdCfg getAppCfgById(long id){
return appCfgDao.getById(id);
}
/**
*
* getAppCfg(根据IP与类名获取IP配置)
* (继承AppIdCfg这个类方可使用)
* @param id
* @return
*AppIdCfg
* @exception
* @since 1.0.0
*/
public AppIdCfg getAppCfgById(AppIdCfg cfg){
cfg = appCfgDao.get(cfg);
List<AppFeaturesIndex> featuresTableList = appCfgDao.getFeaturesTableListByAppCompileId(cfg.getCompileId());
List<ComplexkeywordCfg> complexList = new ArrayList();
List<BaseStringCfg> strList = new ArrayList();
if(!StringUtil.isEmpty(featuresTableList)){
for(AppFeaturesIndex features:featuresTableList){
if(features.getFeaturesTableType().equals(4)){//增强字符串特征配置
List<ComplexkeywordCfg> complexFeaturesList = appCfgDao.getComplexkeywordFeaturesCfgListByCompileId(
features.getFeaturesTable(),features.getFeaturesCompileId());
complexList.addAll(complexFeaturesList);
}else if(features.getFeaturesTableType().equals(2)){//普通字符串特征配置
List<BaseStringCfg> strFeaturesCfgList = appCfgDao.getStrFeaturesCfgListByCompileId(
features.getFeaturesTable(),features.getFeaturesCompileId());
strList.addAll(strFeaturesCfgList);
}
}
}
cfg.setComplexFeaturesList(complexList);
cfg.setStrFeaturesCfgList(strList);
return cfg;
}
public Integer getIsValid(Long cfgId){
return appCfgDao.getIsValid(cfgId);
}
/*public Integer getIsValid(String tableName, long id){
return appCfgDao.getIsValid(tableName,id);
}*/
public Integer getIsAudit(Long cfgId){
return appCfgDao.getIsAudit(cfgId);
}
/*public Integer getIsAudit(String tableName, long id){
return appCfgDao.getIsAudit(tableName,id);
}*/
}