作者 tangxvhui

修复 添加部门时发生的bug

@@ -57,11 +57,11 @@ func (t *Department) SetRelation(parent *Department) error { @@ -57,11 +57,11 @@ func (t *Department) SetRelation(parent *Department) error {
57 return errors.New("Id==0") 57 return errors.New("Id==0")
58 } 58 }
59 if parent == nil { 59 if parent == nil {
60 - t.Relation = fmt.Sprintf("%d/", t.Id) 60 + t.Relation = fmt.Sprintf(",%d,", t.Id)
61 } else if parent.Id == 0 { 61 } else if parent.Id == 0 {
62 - t.Relation = fmt.Sprintf("%d/", t.Id) 62 + t.Relation = fmt.Sprintf(",%d,", t.Id)
63 } else { 63 } else {
64 - t.Relation = fmt.Sprintf("%s%d/", parent.Relation, t.Id) 64 + t.Relation = fmt.Sprintf("%s%d,", parent.Relation, t.Id)
65 } 65 }
66 return nil 66 return nil
67 } 67 }
@@ -239,7 +239,7 @@ func AddDepartmentData(data []ModuleDeparmentData) error { @@ -239,7 +239,7 @@ func AddDepartmentData(data []ModuleDeparmentData) error {
239 err = o.QueryTable(&models.Department{}). 239 err = o.QueryTable(&models.Department{}).
240 Filter("business_department_id", v.ParentId). 240 Filter("business_department_id", v.ParentId).
241 Filter("delete_at", 0). 241 Filter("delete_at", 0).
242 - One(v) 242 + One(parentDepart)
243 if err != nil { 243 if err != nil {
244 log.Error("获取父级职位数据失败,business_admin_id=%d,err:%s", v.ParentId, err) 244 log.Error("获取父级职位数据失败,business_admin_id=%d,err:%s", v.ParentId, err)
245 return errors.New("获取父级职位数据失败") 245 return errors.New("获取父级职位数据失败")