...
|
...
|
@@ -351,8 +351,7 @@ func DepartmentListAll(companyId int64) ([]protocol.ResponseDepartmentInfo, erro |
|
|
depart := protocol.ResponseDepartmentInfo{
|
|
|
ID: v.Id, CompanyID: v.CompanyId,
|
|
|
Name: v.Name, Member: cnt,
|
|
|
ParantID: v.ParentId,
|
|
|
ParentName: v.Name,
|
|
|
ParantID: v.ParentId,
|
|
|
}
|
|
|
var manage []protocol.DepartmentManager
|
|
|
manage = v.GetManages()
|
...
|
...
|
@@ -402,3 +401,35 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs |
|
|
}
|
|
|
return returnData, nil
|
|
|
}
|
|
|
|
|
|
func GetDepartmentDetail(companyid int64, departmentId int64) (*protocol.ResponseDepartmentDetail, error) {
|
|
|
var (
|
|
|
departinfo *models.Department
|
|
|
err error
|
|
|
parentDepart = &models.Department{}
|
|
|
)
|
|
|
|
|
|
departinfo, err = models.GetDepartmentById(departmentId)
|
|
|
if err != nil {
|
|
|
log.Error("获取部门失败:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if departinfo.CompanyId != companyid {
|
|
|
log.Error("部门所属的公司id不匹配")
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if departinfo.ParentId != 0 {
|
|
|
parentDepart, err = models.GetDepartmentById(departinfo.ParentId)
|
|
|
if err != nil {
|
|
|
log.Error("获取父级部门失败:%s", err)
|
|
|
}
|
|
|
}
|
|
|
rspData := &protocol.ResponseDepartmentDetail{
|
|
|
ID: departinfo.Id,
|
|
|
Name: departinfo.Name,
|
|
|
ParantID: departinfo.ParentId,
|
|
|
ParentName: parentDepart.Name,
|
|
|
Manages: departinfo.GetManages(),
|
|
|
}
|
|
|
return rspData, nil
|
|
|
} |
...
|
...
|
|