|
|
@ -256,19 +256,19 @@ func getDepartmentParent(departmentID string, dbConn *gorm.DB) (*db.Department,
|
|
|
|
return &department, err
|
|
|
|
return &department, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func GetDepartmentParent(departmentID string, dbConn *gorm.DB, parentIDList []string) (*db.Department, error) {
|
|
|
|
func GetDepartmentParent(departmentID string, dbConn *gorm.DB, parentIDList *[]string) error {
|
|
|
|
department, err := getDepartmentParent(departmentID, dbConn)
|
|
|
|
department, err := getDepartmentParent(departmentID, dbConn)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if department.ParentID != "" {
|
|
|
|
if department.ParentID != "" {
|
|
|
|
parentIDList = append(parentIDList, department.ParentID)
|
|
|
|
*parentIDList = append(*parentIDList, department.ParentID)
|
|
|
|
_, err = GetDepartmentParent(departmentID, dbConn, parentIDList)
|
|
|
|
err = GetDepartmentParent(departmentID, dbConn, parentIDList)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, nil
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil, nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func GetDepartmentParentIDList(departmentID string) ([]string, error) {
|
|
|
|
func GetDepartmentParentIDList(departmentID string) ([]string, error) {
|
|
|
@ -277,6 +277,6 @@ func GetDepartmentParentIDList(departmentID string) ([]string, error) {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var parentIDList []string
|
|
|
|
var parentIDList []string
|
|
|
|
_, err = GetDepartmentParent(departmentID, dbConn, parentIDList)
|
|
|
|
err = GetDepartmentParent(departmentID, dbConn, &parentIDList)
|
|
|
|
return parentIDList, err
|
|
|
|
return parentIDList, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|