正在显示
4 个修改的文件
包含
15 行增加
和
5 行删除
@@ -44,6 +44,7 @@ type PositionBase struct { | @@ -44,6 +44,7 @@ type PositionBase struct { | ||
44 | type DepartUserBase struct { | 44 | type DepartUserBase struct { |
45 | UserCompanyId int64 `json:"id" orm:"column(user_company_id)"` | 45 | UserCompanyId int64 `json:"id" orm:"column(user_company_id)"` |
46 | NickName string `json:"name" orm:"column(nick_name)"` | 46 | NickName string `json:"name" orm:"column(nick_name)"` |
47 | + UserId int64 `json:"-" orm:"column(user_id)"` | ||
47 | } | 48 | } |
48 | 49 | ||
49 | //部门和人员混合 | 50 | //部门和人员混合 |
@@ -380,8 +380,9 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs | @@ -380,8 +380,9 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs | ||
380 | log.Error("deparment.CompanyId err") | 380 | log.Error("deparment.CompanyId err") |
381 | return returnData, protocol.NewErrWithMessage("1") | 381 | return returnData, protocol.NewErrWithMessage("1") |
382 | } | 382 | } |
383 | - const dataSql string = `SELECT b.nick_name,a.user_company_id FROM user_department AS a | ||
384 | - JOIN user_company AS b ON a.user_company_id = b.id | 383 | + const dataSql string = `SELECT a.user_company_id,b.user_id |
384 | + FROM user_department AS a | ||
385 | + LEFT JOIN user_company AS b ON a.user_company_id = b.id | ||
385 | WHERE a.department_id=? AND b.delete_at=0 AND a.enable_status = 1 ` | 386 | WHERE a.department_id=? AND b.delete_at=0 AND a.enable_status = 1 ` |
386 | 387 | ||
387 | err = utils.ExecuteQueryAll(&returnData, dataSql, department.Id) | 388 | err = utils.ExecuteQueryAll(&returnData, dataSql, department.Id) |
@@ -389,5 +390,13 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs | @@ -389,5 +390,13 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs | ||
389 | log.Error("EXECUTE SQL err:%s", err) | 390 | log.Error("EXECUTE SQL err:%s", err) |
390 | return returnData, protocol.NewErrWithMessage("1") | 391 | return returnData, protocol.NewErrWithMessage("1") |
391 | } | 392 | } |
393 | + for i := range returnData { | ||
394 | + uInfo, err := models.GetUserById(returnData[i].UserId) | ||
395 | + if err == nil { | ||
396 | + returnData[i].NickName = uInfo.NickName | ||
397 | + } else { | ||
398 | + log.Error("GetUserById(%d) err:%s", returnData[i].UserId, err) | ||
399 | + } | ||
400 | + } | ||
392 | return returnData, nil | 401 | return returnData, nil |
393 | } | 402 | } |
@@ -272,7 +272,7 @@ func PositionDelete(param protocol.RequestPositionDelete) error { | @@ -272,7 +272,7 @@ func PositionDelete(param protocol.RequestPositionDelete) error { | ||
272 | log.Error(e.Error()) | 272 | log.Error(e.Error()) |
273 | return protocol.NewErrWithMessage("10011", e) | 273 | return protocol.NewErrWithMessage("10011", e) |
274 | } | 274 | } |
275 | - if _, ok := toDelete[subset.Id]; ok { | 275 | + if _, ok := toDelete[subset.Id]; ok && subset.Id != pos.Id { |
276 | delete(toDelete, subset.Id) | 276 | delete(toDelete, subset.Id) |
277 | } | 277 | } |
278 | } | 278 | } |
@@ -503,7 +503,7 @@ func UserDelete(userCompanyids []int64, companyid int64) error { | @@ -503,7 +503,7 @@ func UserDelete(userCompanyids []int64, companyid int64) error { | ||
503 | 503 | ||
504 | func UserList(param protocol.RequestUserList) (protocol.ResponseUserList, error) { | 504 | func UserList(param protocol.RequestUserList) (protocol.ResponseUserList, error) { |
505 | 505 | ||
506 | - datasql := `SELECT a.id as user_company_id,a.enable, b.phone,a.nick_name | 506 | + datasql := `SELECT a.id as user_company_id,a.enable, b.phone,b.nick_name |
507 | FROM user_company AS a | 507 | FROM user_company AS a |
508 | LEFT JOIN user AS b ON a.user_id = b.id | 508 | LEFT JOIN user AS b ON a.user_id = b.id |
509 | WHERE a.company_id=? AND a.delete_at = 0 ` | 509 | WHERE a.company_id=? AND a.delete_at = 0 ` |
@@ -517,7 +517,7 @@ func UserList(param protocol.RequestUserList) (protocol.ResponseUserList, error) | @@ -517,7 +517,7 @@ func UserList(param protocol.RequestUserList) (protocol.ResponseUserList, error) | ||
517 | ) | 517 | ) |
518 | cond = append(cond, param.Companyid) | 518 | cond = append(cond, param.Companyid) |
519 | if len(param.NickName) > 0 { | 519 | if len(param.NickName) > 0 { |
520 | - whereString += ` AND a.nick_name LIKE ? ` | 520 | + whereString += ` AND b.nick_name LIKE ? ` |
521 | likeCond := "%" + param.NickName + "%" | 521 | likeCond := "%" + param.NickName + "%" |
522 | cond = append(cond, likeCond) | 522 | cond = append(cond, likeCond) |
523 | } | 523 | } |
-
请 注册 或 登录 后发表评论