作者 tangxvhui

修复 添加部门时发生的bug

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