模板标题上移下移

This commit is contained in:
zhn
2022-09-22 18:40:24 +08:00
parent 54c7421776
commit 787fa17f61
@@ -48,6 +48,7 @@ public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<Law
List<LawsMonthlyReportTitleTemplateEO> children = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList());
int sort = 0;
if(StringUtils.isBlank(lawsMonthlyReportTitleTemplateEO.getParentId())){
//新增父级
if(parent.size() == 0){
lawsMonthlyReportTitleTemplateEO.setSort(0);
}else{
@@ -56,10 +57,15 @@ public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<Law
sort = sortList.get(sortList.size()-1) + 1;
}
}else{
if(children.size() == 0){
//判断该父级下是否有子级
List<LawsMonthlyReportTitleTemplateEO> childrenList = children.stream()
.filter(e -> lawsMonthlyReportTitleTemplateEO.getParentId().equals(e.getParentId()))
.collect(Collectors.toList());
if(childrenList.size() == 0){
lawsMonthlyReportTitleTemplateEO.setSort(0);
}else{
List<Integer> sortList = parent.stream().map(LawsMonthlyReportTitleTemplateEO::getSort).collect(Collectors.toList());
List<Integer> sortList = childrenList.stream().map(LawsMonthlyReportTitleTemplateEO::getSort).collect(Collectors.toList());
Collections.sort(sortList);
sort = sortList.get(sortList.size()-1) + 1;
}