(1)调整删除配置方法
(2)多域IP修改时取消勾选,后台直接删除
This commit is contained in:
@@ -721,6 +721,7 @@ public class MultipleCfgController extends BaseController{
|
||||
model.addAttribute("action",cfg.getAction());
|
||||
try{
|
||||
List<ServiceConfigInfo> serviceConfigInfos=serviceConfigInfoService.findList(cfg.getServiceId());
|
||||
List<BaseCfg> 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) {
|
||||
|
||||
@@ -417,6 +417,6 @@
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.ComplexkeywordCfg" >
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -554,9 +554,9 @@
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="delete" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
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>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -425,6 +425,6 @@
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.NumBoundaryCfg" >
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -403,7 +403,7 @@
|
||||
<if test="isHexbin != null">
|
||||
is_hexbin=#{isHexbin,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''" >
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
@@ -430,6 +430,6 @@
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.BaseStringCfg" >
|
||||
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}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -77,7 +77,7 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateCfg(MultipleCfg cfg){
|
||||
public int updateCfg(MultipleCfg cfg,List<BaseCfg> deleteCfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
@@ -104,6 +104,19 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
|
||||
complexStringCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(deleteCfg!=null&&deleteCfg.size()>0){
|
||||
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)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_type"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="ipType" class="selectpicker show-tick form-control required">
|
||||
<option value=""><spring:message code="select"/></option>
|
||||
<option value="4" <c:if test="${_cfg.ipType==4}">selected</c:if> >V4</option>
|
||||
<option value="6" <c:if test="${_cfg.ipType==6}">selected</c:if>>V6</option>
|
||||
</select>
|
||||
|
||||
@@ -34,14 +34,12 @@
|
||||
<c:choose>
|
||||
<c:when test="${mainTableType eq '1' and otherTable==null}">
|
||||
<select name="ipCfg[${mainTable}].ipType" class="ipType selectpicker show-tick form-control required">
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<option value="4" <c:if test="${_cfg.ipCfg[mainTable].ipType==4}">selected</c:if> >V4</option>
|
||||
<option value="6" <c:if test="${_cfg.ipCfg[mainTable].ipType==6}">selected</c:if>>V6</option>
|
||||
</select>
|
||||
</c:when>
|
||||
<c:when test="${otherTable!=null and otherTable.tableType eq '1'}">
|
||||
<select name="ipCfg[${otherTable.tableName}].ipType" class="ipType selectpicker show-tick form-control required" title=<spring:message code="select"/>>
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<option value="4" <c:if test="${_cfg.ipCfg[otherTable.tableName].ipType==4}">selected</c:if> >V4</option>
|
||||
<option value="6" <c:if test="${_cfg.ipCfg[otherTable.tableName].ipType==6}">selected</c:if>>V6</option>
|
||||
</select>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<link href="${pageContext.request.contextPath}/static/global/plugins/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet"/>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
switchIpType($("select[name$='ipType']"));
|
||||
if($("input[name='isAreaEffective']:checked").val()==1){
|
||||
$(".areaType").removeClass("hidden");
|
||||
if($("input[name='areaEffectiveIds']").val()){
|
||||
@@ -72,58 +73,6 @@ $(function(){
|
||||
errorContainer: "#messageBox",
|
||||
});
|
||||
});
|
||||
var switchIpType=function(obj){
|
||||
var type=$(obj).val();
|
||||
var row=$(obj).parents('.row');
|
||||
var srcIpMask=row.siblings().find("input[name$='srcIpMask']");
|
||||
var dstIpMask=row.siblings().find("input[name$='dstIpMask']");
|
||||
var srcIp=row.siblings().find("input[name$='srcIp']");
|
||||
var dstIp=row.siblings().find("input[name$='dstIp']");
|
||||
if(4==type){
|
||||
if(!$(srcIpMask).val()){
|
||||
$(srcIpMask).val("255.255.255.255");
|
||||
}else if($(srcIpMask).val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
|
||||
$(srcIpMask).val("255.255.255.255");
|
||||
}
|
||||
if(!$(dstIpMask).val()){
|
||||
$(dstIpMask).val("255.255.255.255");
|
||||
}else if($(dstIpMask).val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
|
||||
$(dstIpMask).val("255.255.255.255");
|
||||
}
|
||||
if(!$(srcIp).val()){
|
||||
$(srcIp).val("0.0.0.0");
|
||||
}else if($(srcIp).val()=="::"){
|
||||
$(srcIp).val("0.0.0.0");
|
||||
}
|
||||
if(!$(dstIp).val()){
|
||||
$(dstIp).val("0.0.0.0");
|
||||
}else if($(dstIp).val()=="::"){
|
||||
$(dstIp).val("0.0.0.0");
|
||||
}
|
||||
}
|
||||
if(6==type){
|
||||
if(!$(srcIpMask).val()){
|
||||
$(srcIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}else if($(srcIpMask).val()=="255.255.255.255"){
|
||||
$(srcIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
if(!$(dstIpMask).val()){
|
||||
$(dstIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}else if($(dstIpMask).val()=="255.255.255.255"){
|
||||
$(dstIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
if(!$(srcIp).val()){
|
||||
$(srcIp).val("::");
|
||||
}else if($(srcIp).val()=="0.0.0.0"){
|
||||
$(srcIp).val("::");
|
||||
}
|
||||
if(!$(dstIp).val()){
|
||||
$(dstIp).val("::");
|
||||
}else if($(dstIp).val()=="0.0.0.0"){
|
||||
$(dstIp).val("::");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user