diff --git a/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java b/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java index 99cd117e9..9d6b2f3db 100644 --- a/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/MultipleCfgController.java @@ -721,6 +721,7 @@ public class MultipleCfgController extends BaseController{ model.addAttribute("action",cfg.getAction()); try{ List serviceConfigInfos=serviceConfigInfoService.findList(cfg.getServiceId()); + List deleteCfg=new ArrayList<>(); Integer compileId=0; if(operator.equals("save")){ compileId=new ConvertTool().getCompileId(); @@ -746,6 +747,15 @@ public class MultipleCfgController extends BaseController{ } } } + }else{//表单没有提交IP配置,但是根据编译ID却查到了IP配置,说明用户选择删除IP配置 + BaseIpCfg entity=new BaseIpCfg(); + entity.setTableName(info.getTableName()); + entity.setCompileId(compileId); + BaseIpCfg resultIp=ipCfgService.get(entity); + if(resultIp!=null){ + resultIp.setTableName(info.getTableName()); + deleteCfg.add(resultIp); + } } }else if(Constants.TABLE_TYPE_STRING==info.getTableType()){ if(cfg.getStringCfg()!=null){ @@ -810,7 +820,7 @@ public class MultipleCfgController extends BaseController{ if("save".equals(operator)){ multipleCfgService.addCfg(cfg); }else if("update".equals(operator)){ - multipleCfgService.updateCfg(cfg); + multipleCfgService.updateCfg(cfg,deleteCfg); } addMessage(model,"save_success"); }catch (Exception e) { diff --git a/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml index f4ce1570b..66cec2246 100644 --- a/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/ComplexStringCfgDao.xml @@ -417,6 +417,6 @@ WHERE CFG_ID = #{cfgId,jdbcType=BIGINT} - update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} + update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml index 36ca8bba7..4bff5a945 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpCfgDao.xml @@ -554,9 +554,9 @@ WHERE CFG_ID = #{cfgId,jdbcType=BIGINT} - update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT} + update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT} - update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} + update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/NumCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/NumCfgDao.xml index 08d4d42f8..60ab2d5bc 100644 --- a/src/main/java/com/nis/web/dao/configuration/NumCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/NumCfgDao.xml @@ -425,6 +425,6 @@ WHERE CFG_ID = #{cfgId,jdbcType=BIGINT} - update NUM_BOUNDARY_CFG set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} + update NUM_BOUNDARY_CFG set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml index c2d3017ba..635d6a0ae 100644 --- a/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/StringCfgDao.xml @@ -403,7 +403,7 @@ is_hexbin=#{isHexbin,jdbcType=INTEGER}, - + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, @@ -430,6 +430,6 @@ WHERE CFG_ID = #{cfgId,jdbcType=BIGINT} - update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} + update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER} \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java b/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java index 5dab64ead..f40fdb238 100644 --- a/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/MultipleCfgService.java @@ -77,7 +77,7 @@ public class MultipleCfgService extends CrudService deleteCfg){ if(cfg==null) return 0; if(cfg.getIpCfg()!=null){ for(BaseIpCfg _cfg:cfg.getIpCfg().values()){ @@ -104,6 +104,19 @@ public class MultipleCfgService extends CrudService0){ + for(BaseCfg _cfg:deleteCfg){ + if(_cfg instanceof BaseIpCfg){ + ipCfgDao.deleteByCompileId((BaseIpCfg)_cfg); + }else if(_cfg instanceof BaseStringCfg){ + stringCfgDao.deleteByCompileId((BaseStringCfg)_cfg); + }else if(_cfg instanceof NumBoundaryCfg){ + numCfgDao.deleteByCompileId((NumBoundaryCfg)_cfg); + }else if(_cfg instanceof ComplexkeywordCfg){ + complexStringCfgDao.deleteByCompileId((ComplexkeywordCfg)_cfg); + } + } + } return 1; } @Transactional(readOnly=false,rollbackFor=RuntimeException.class) diff --git a/src/main/webapp/WEB-INF/include/form/ipInfo.jsp b/src/main/webapp/WEB-INF/include/form/ipInfo.jsp index 25aae737f..b50a5fc04 100644 --- a/src/main/webapp/WEB-INF/include/form/ipInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/ipInfo.jsp @@ -16,7 +16,6 @@
diff --git a/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp b/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp index 86e65237b..cd0429784 100644 --- a/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/multiple/ipInfo.jsp @@ -34,14 +34,12 @@ - > diff --git a/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp index 261504e34..7fd90758f 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp @@ -6,6 +6,7 @@ diff --git a/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp index 0de09e29e..f0342564f 100644 --- a/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/multipleCfgForm.jsp @@ -13,30 +13,7 @@ $(function(){ $(".bootstrap-select button").removeClass("disabled"); $(".collapse").addClass("in"); } - //$("[name^='stringCfg']").attr("disabled",true); - //$("[name^='complexCfg']").attr("disabled",true); - //$("[name^='numCfg']").attr("disabled",true); - /* $(".glyphicon").on("click",function(){ - var className=$(this).attr("data-target"); - if($(this).hasClass("glyphicon-chevron-down")){ - $(this).removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up"); - }else if($(this).hasClass("glyphicon-chevron-up")){ - $(this).removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down"); - }else if($(this).hasClass("glyphicon-plus")){ - var targetName=className.substring(1,className.length); - $(this).attr("title","remove"); - $(this).removeClass("glyphicon-plus").addClass("glyphicon-remove"); - $("[name^='"+targetName+"']").removeAttr("disabled"); - //解决select插件disbale后无法恢复 - $(".bootstrap-select").removeClass("disabled"); - $(".bootstrap-select button").removeClass("disabled"); - }else if($(this).hasClass("glyphicon-remove")){ - var targetName=className.substring(1,className.length); - $(this).attr("title","add"); - $(this).removeClass("glyphicon-remove").addClass("glyphicon-plus"); - $("[name^='"+targetName+"']").attr("disabled",true); - } - }); */ + $("#cfgFrom").validate({ errorPlacement: function(error,element){ $(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error); @@ -46,7 +23,6 @@ $(function(){ }, errorContainer: "#messageBox" }); - $("#ipSelect").change(function(){ if($(this).prop("checked")){ $("[name^='ipCfg']").removeProp("disabled"); @@ -91,51 +67,7 @@ $(function(){ }); $(".ipType").on("change",function(){ var tableName=$(this).attr("name").replace(".ipType",""); - var type=$(this).val(); - if(4==type){ - if(!$("input[name='"+tableName+".srcIpMask']").val()){ - $("input[name='"+tableName+".srcIpMask']").val("255.255.255.255"); - }else if($("input[name='"+tableName+".srcIpMask']").val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){ - $("input[name='"+tableName+".srcIpMask']").val("255.255.255.255"); - } - if(!$("input[name='"+tableName+".dstIpMask']").val()){ - $("input[name='"+tableName+".dstIpMask']").val("255.255.255.255"); - }else if($("input[name='"+tableName+".dstIpMask']").val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){ - $("input[name='"+tableName+".dstIpMask']").val("255.255.255.255"); - } - if(!$("input[name='"+tableName+".srcIp']").val()){ - $("input[name='"+tableName+".srcIp']").val("0.0.0.0"); - }else if($("input[name='"+tableName+".srcIp']").val()=="::"){ - $("input[name='"+tableName+".srcIp']").val("0.0.0.0"); - } - if(!$("input[name='"+tableName+".dstIp']").val()){ - $("input[name='"+tableName+".dstIp']").val("0.0.0.0"); - }else if($("input[name='"+tableName+".dstIp']").val()=="::"){ - $("input[name='"+tableName+".dstIp']").val("0.0.0.0"); - } - } - if(6==type){ - if(!$("input[name='"+tableName+".srcIpMask']").val()){ - $("input[name='"+tableName+".srcIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); - }else if($("input[name='"+tableName+".srcIpMask']").val()=="255.255.255.255"){ - $("input[name='"+tableName+".srcIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); - } - if(!$("input[name='"+tableName+".dstIpMask']").val()){ - $("input[name='"+tableName+".dstIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); - }else if($("input[name='"+tableName+".dstIpMask']").val()=="255.255.255.255"){ - $("input[name='"+tableName+".dstIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); - } - if(!$("input[name='"+tableName+".srcIp']").val()){ - $("input[name='"+tableName+".srcIp']").val("::"); - }else if($("input[name='"+tableName+".srcIp']").val()=="0.0.0.0"){ - $("input[name='"+tableName+".srcIp']").val("::"); - } - if(!$("input[name='"+tableName+".dstIp']").val()){ - $("input[name='"+tableName+".dstIp']").val("::"); - }else if($("input[name='"+tableName+".dstIp']").val()=="0.0.0.0"){ - $("input[name='"+tableName+".dstIp']").val("::"); - } - } + switchIpType($(".ipType")); }); $("#cancel").on("click",function(){ window.history.back();