Skip to content

Commit

Permalink
perf👌: correct attribute definition
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjianzhang committed Sep 5, 2024
1 parent 4aa0068 commit 8751f34
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/admin/service/sys_dept.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,16 @@ func (e *SysDept) SetDeptTree(c *dto.SysDeptGetPageReq) (m []dto.DeptLabel, err
// Call 递归构造组织数据
func deptTreeCall(deptList *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabel {
list := *deptList
min := make([]dto.DeptLabel, 0)
childrenList := make([]dto.DeptLabel, 0)
for j := 0; j < len(list); j++ {
if dept.Id != list[j].ParentId {
continue
}
mi := dto.DeptLabel{Id: list[j].DeptId, Label: list[j].DeptName, Children: []dto.DeptLabel{}}
ms := deptTreeCall(deptList, mi)
min = append(min, ms)
childrenList = append(childrenList, ms)
}
dept.Children = min
dept.Children = childrenList
return dept
}

Expand All @@ -212,7 +212,7 @@ func (e *SysDept) SetDeptPage(c *dto.SysDeptGetPageReq) (m []models.SysDept, err

func (e *SysDept) deptPageCall(deptlist *[]models.SysDept, menu models.SysDept) models.SysDept {
list := *deptlist
min := make([]models.SysDept, 0)
childrenList := make([]models.SysDept, 0)
for j := 0; j < len(list); j++ {
if menu.DeptId != list[j].ParentId {
continue
Expand All @@ -230,9 +230,9 @@ func (e *SysDept) deptPageCall(deptlist *[]models.SysDept, menu models.SysDept)
mi.CreatedAt = list[j].CreatedAt
mi.Children = []models.SysDept{}
ms := e.deptPageCall(deptlist, mi)
min = append(min, ms)
childrenList = append(childrenList, ms)
}
menu.Children = min
menu.Children = childrenList
return menu
}

Expand Down Expand Up @@ -280,15 +280,15 @@ func (e *SysDept) SetDeptLabel() (m []dto.DeptLabel, err error) {
func deptLabelCall(deptList *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabel {
list := *deptList
var mi dto.DeptLabel
min := make([]dto.DeptLabel, 0)
childrenList := make([]dto.DeptLabel, 0)
for j := 0; j < len(list); j++ {
if dept.Id != list[j].ParentId {
continue
}
mi = dto.DeptLabel{Id: list[j].DeptId, Label: list[j].DeptName, Children: []dto.DeptLabel{}}
ms := deptLabelCall(deptList, mi)
min = append(min, ms)
childrenList = append(childrenList, ms)
}
dept.Children = min
dept.Children = childrenList
return dept
}

0 comments on commit 8751f34

Please sign in to comment.