修改公共组管理删除校验
This commit is contained in:
@@ -83,12 +83,6 @@ public class CommonGroupManageController extends BaseController {
|
||||
return "redirect:" + adminPath + "/basics/commonGroup/list";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value="ajaxCheckGroupUse")
|
||||
public boolean ajaxCheckGroupUse(@RequestParam("groupIds")String groupIds){
|
||||
return commonGroupManageService.checkIsIssued(groupIds);
|
||||
}
|
||||
|
||||
// 数据导出
|
||||
@RequestMapping(value = "exportGroup")
|
||||
public void exportGroup(Model model,@ModelAttribute("cfg")CommonGroupInfo entity,String ids,RedirectAttributes redirectAttributes,
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
|
||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||
<result column="ud_flag" property="udFlag" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="CommonGroupInfoColumns">
|
||||
r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time,
|
||||
r.creator_id,r.editor_id,r.service_group_id,r.description
|
||||
r.creator_id,r.editor_id,r.service_group_id,r.description, ud_flag
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
|
||||
@@ -108,49 +108,6 @@ public class CommonGroupManageService extends BaseService{
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除时校验分组是否被引用,未被引用可删除
|
||||
* @param groupIds
|
||||
* @return false未被引用 / true已被引用
|
||||
*/
|
||||
public boolean checkIsIssued(String groupIds) {
|
||||
// 组织格式
|
||||
Map<Integer,Set<Integer>> map = new HashMap<Integer,Set<Integer>>();
|
||||
for(String str : groupIds.split(",")) {
|
||||
Integer id = Integer.valueOf(str.substring(0, str.indexOf("_")));
|
||||
Integer type = Integer.valueOf(str.substring(str.indexOf("_")+1));
|
||||
if(map.containsKey(type)) {
|
||||
Set<Integer> set = map.get(type);
|
||||
set.add(id);
|
||||
map.put(type, set);
|
||||
}else {
|
||||
Set<Integer> set = new HashSet<Integer>();
|
||||
set.add(id);
|
||||
map.put(type, set);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据类型去相应配置查询,若存在被引用的则限制操作
|
||||
Set<Integer> keySet = map.keySet();
|
||||
for (Integer type : keySet) {
|
||||
Set<Integer> set = map.get(type);
|
||||
String str = set.toString();
|
||||
String ids = str.substring(1, str.indexOf("]"));
|
||||
if(type == 5) {
|
||||
List<IpCommCfg> list = ipCommGroupCfgDao.getCfgInfoByGroupIds(ids);
|
||||
if(list.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
}else if(type == 7) {
|
||||
List<UrlCommCfg> list = urlCommGroupDao.getCfgInfoByGroupIds(ids);
|
||||
if(list.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分组状态 policy_group_info ud_flag:0(无有效的域配置) 1(存在有效的域配置)
|
||||
* @param serviceGroupId
|
||||
|
||||
Reference in New Issue
Block a user