feat: 体系树增加层级字段
This commit is contained in:
+1
-1
@@ -161,7 +161,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
List<SarBussStandMenu> esStandMenu = sarBussStandMenuService.list().stream().filter(sarBussStandMenu -> sarBussStandMenu.getMenuId().length() > 30).collect(Collectors.toList());
|
||||
List<StandMenuRelation> esRelations = BeanCopyUtils.copyBeanList(esStandMenu, StandMenuRelation.class);
|
||||
// 计算每个节点的数值
|
||||
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations);
|
||||
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations, 0);
|
||||
// 拼接返回
|
||||
return TsResources;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,10 @@ public class SarMenuStandard extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private String treeType;
|
||||
|
||||
@ApiModelProperty(value = "树层级")
|
||||
@TableField(exist = false)
|
||||
private Integer level;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer gbStandCount;
|
||||
|
||||
@@ -118,13 +122,14 @@ public class SarMenuStandard extends BaseEntity {
|
||||
|
||||
// 添加用于计算和设置关联关系数量的方法
|
||||
// 添加用于计算和设置关联关系数量的方法
|
||||
public void calculateAndSetCounts(List<StandMenuRelation> gbStandMenu, List<StandMenuRelation> fbStandMenu, List<StandMenuRelation> esStandMenu) {
|
||||
public void calculateAndSetCounts(List<StandMenuRelation> gbStandMenu, List<StandMenuRelation> fbStandMenu, List<StandMenuRelation> esStandMenu, Integer curLevel) {
|
||||
this.level = curLevel;
|
||||
this.gbStandCount = countMatches(gbStandMenu, this.id);
|
||||
this.fbStandCount = countMatches(fbStandMenu, this.id);
|
||||
this.esStandCount = countMatches(esStandMenu, this.id);
|
||||
|
||||
for (SarMenuStandard child : children) {
|
||||
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu);
|
||||
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu, curLevel + 1);
|
||||
this.gbStandCount += child.gbStandCount;
|
||||
this.fbStandCount += child.fbStandCount;
|
||||
this.esStandCount += child.esStandCount;
|
||||
|
||||
Reference in New Issue
Block a user