...
|
...
|
@@ -75,6 +75,27 @@ func (t *Department) GetManages() []protocol.DepartmentManager { |
|
|
return managesdata
|
|
|
}
|
|
|
|
|
|
func (t *Department) GetMembers() []protocol.DepartmentMember {
|
|
|
ids, err := GetUserDepartmentIds(int(t.CompanyId), int(t.Id))
|
|
|
if err != nil {
|
|
|
log.Error(err.Error())
|
|
|
return nil
|
|
|
}
|
|
|
users, err := getUserNameByIds(ids)
|
|
|
if err != nil {
|
|
|
log.Error("GetUserNameByIds err :%s", err)
|
|
|
return nil
|
|
|
}
|
|
|
managesdata := []protocol.DepartmentMember{}
|
|
|
for _, v := range users {
|
|
|
m := protocol.DepartmentMember{
|
|
|
Id: v.Id, Name: v.NickName,
|
|
|
}
|
|
|
managesdata = append(managesdata, m)
|
|
|
}
|
|
|
return managesdata
|
|
|
}
|
|
|
|
|
|
// AddDepartment insert a new Department into database and returns
|
|
|
// last inserted Id on success.
|
|
|
func AddDepartment(m *Department, om ...orm.Ormer) (id int64, err error) {
|
...
|
...
|
|