融合代码 提交本地
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -396,14 +397,42 @@ public class ServiceDictInfoController extends BaseController {
|
||||
}
|
||||
}else{
|
||||
ServiceDictInfo c = serviceDictInfoService.getDictById(currentId);
|
||||
if((p.getLevelNo()+c.getLevelNo())<(max+1)){
|
||||
return true;
|
||||
if(p.getLevelNo()<max){
|
||||
//查出该类所有下级的层级数之和
|
||||
List<ServiceDictInfo> list = serviceDictInfoService.getDictByParentId(currentId);
|
||||
if(list==null||list.size()==0){
|
||||
return true;
|
||||
}
|
||||
List<ServiceDictInfo> resultList = Lists.newArrayList();
|
||||
List<Integer> intList = Lists.newArrayList();
|
||||
allTreeNode(1,list,resultList);
|
||||
for(ServiceDictInfo se:resultList){
|
||||
intList.add(se.getLevelNo());
|
||||
}
|
||||
int x = Collections.max(intList);
|
||||
if((p.getLevelNo()+x)<(max+1)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查出所该节点下有树形子节点
|
||||
*/
|
||||
|
||||
void allTreeNode(Integer levelNo, List<ServiceDictInfo> list,List<ServiceDictInfo> resultList){
|
||||
if(list!=null&&list.size()>0){
|
||||
for(ServiceDictInfo se:list){
|
||||
se.setLevelNo(levelNo+1);
|
||||
resultList.add(se);
|
||||
List<ServiceDictInfo> newList = serviceDictInfoService.getDictByParentId(se.getServiceDictId());
|
||||
allTreeNode(se.getLevelNo(),newList,resultList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -185,10 +185,10 @@ public class SysDictInfoController extends BaseController {
|
||||
|
||||
try {
|
||||
sysDictInfoService.saveOrUpdate(sysDictInfo);
|
||||
addMessage(redirectAttributes, "保存成功");
|
||||
addMessage(redirectAttributes, "save_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "保存失败!");
|
||||
addMessage(redirectAttributes, "save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath + "/basics/sysDictInfo/list?itType="+itType;
|
||||
@@ -205,10 +205,10 @@ public class SysDictInfoController extends BaseController {
|
||||
public String delete(SysDictInfo sysDictInfo, RedirectAttributes redirectAttributes, String itType, String mulitId) {
|
||||
try {
|
||||
sysDictInfoService.deleteDict(mulitId);
|
||||
addMessage(redirectAttributes, "删除成功");
|
||||
addMessage(redirectAttributes, "delete_success");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes, "删除失败!");
|
||||
addMessage(redirectAttributes, "delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/sysDictInfo/list?itType="+itType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user