|
@@ -377,25 +377,26 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs |
|
@@ -377,25 +377,26 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs |
377
|
department *models.Department
|
377
|
department *models.Department
|
378
|
err error
|
378
|
err error
|
379
|
)
|
379
|
)
|
|
|
380
|
+ var (
|
|
|
381
|
+ returnData []protocol.DepartUserBase
|
|
|
382
|
+ )
|
380
|
department, err = models.GetDepartmentById(departmentid)
|
383
|
department, err = models.GetDepartmentById(departmentid)
|
381
|
if err != nil {
|
384
|
if err != nil {
|
382
|
log.Error("获取部门失败:%s", err)
|
385
|
log.Error("获取部门失败:%s", err)
|
383
|
- return nil, nil
|
386
|
+ return returnData, nil
|
384
|
}
|
387
|
}
|
385
|
if department.CompanyId != companyid {
|
388
|
if department.CompanyId != companyid {
|
386
|
log.Error("deparment.CompanyId err")
|
389
|
log.Error("deparment.CompanyId err")
|
387
|
- return nil, protocol.NewErrWithMessage("1")
|
390
|
+ return returnData, protocol.NewErrWithMessage("1")
|
388
|
}
|
391
|
}
|
389
|
const dataSql string = `SELECT b.nick_name,a.user_company_id FROM user_department AS a
|
392
|
const dataSql string = `SELECT b.nick_name,a.user_company_id FROM user_department AS a
|
390
|
JOIN user_company AS b ON a.user_company_id = b.id
|
393
|
JOIN user_company AS b ON a.user_company_id = b.id
|
391
|
WHERE a.department_id=? AND b.delete_at=0 AND a.enable_status = 1 `
|
394
|
WHERE a.department_id=? AND b.delete_at=0 AND a.enable_status = 1 `
|
392
|
- var (
|
|
|
393
|
- returnData []protocol.DepartUserBase
|
|
|
394
|
- )
|
395
|
+
|
395
|
err = utils.ExecuteQueryAll(&returnData, dataSql, department.Id)
|
396
|
err = utils.ExecuteQueryAll(&returnData, dataSql, department.Id)
|
396
|
if err != nil {
|
397
|
if err != nil {
|
397
|
log.Error("EXECUTE SQL err:%s", err)
|
398
|
log.Error("EXECUTE SQL err:%s", err)
|
398
|
- return nil, protocol.NewErrWithMessage("1")
|
399
|
+ return returnData, protocol.NewErrWithMessage("1")
|
399
|
}
|
400
|
}
|
400
|
return returnData, nil
|
401
|
return returnData, nil
|
401
|
} |
402
|
} |