|
@@ -282,31 +282,32 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank |
|
@@ -282,31 +282,32 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank |
282
|
}
|
282
|
}
|
283
|
switch rangeType {
|
283
|
switch rangeType {
|
284
|
case models.RANK_RANGE_TYPE_DEPARTMENT:
|
284
|
case models.RANK_RANGE_TYPE_DEPARTMENT:
|
285
|
- //员工
|
|
|
286
|
- users, err := models.GetUserCompanyByIds(relationIds)
|
285
|
+ //部门
|
|
|
286
|
+ departments, err := models.GetDepartmentByIds(relationIds)
|
287
|
if err != nil {
|
287
|
if err != nil {
|
288
|
- log.Error("获取员工数据失败")
|
288
|
+ log.Error("获取部门数据失败")
|
289
|
}
|
289
|
}
|
290
|
- for i := range users {
|
290
|
+ for i := range departments {
|
291
|
m := protocol.RankRangeRelation{
|
291
|
m := protocol.RankRangeRelation{
|
292
|
- Id: users[i].Id,
|
|
|
293
|
- Name: users[i].NickName,
|
292
|
+ Id: departments[i].Id,
|
|
|
293
|
+ Name: departments[i].Name,
|
294
|
}
|
294
|
}
|
295
|
datalist = append(datalist, m)
|
295
|
datalist = append(datalist, m)
|
296
|
}
|
296
|
}
|
297
|
case models.RANK_RANGE_TYPE_EMPLAYEE:
|
297
|
case models.RANK_RANGE_TYPE_EMPLAYEE:
|
298
|
- //部门
|
|
|
299
|
- departments, err := models.GetDepartmentByIds(relationIds)
|
298
|
+ //员工
|
|
|
299
|
+ users, err := models.GetUserCompanyByIds(relationIds)
|
300
|
if err != nil {
|
300
|
if err != nil {
|
301
|
- log.Error("获取部门数据失败")
|
301
|
+ log.Error("获取员工数据失败")
|
302
|
}
|
302
|
}
|
303
|
- for i := range departments {
|
303
|
+ for i := range users {
|
304
|
m := protocol.RankRangeRelation{
|
304
|
m := protocol.RankRangeRelation{
|
305
|
- Id: departments[i].Id,
|
|
|
306
|
- Name: departments[i].Name,
|
305
|
+ Id: users[i].Id,
|
|
|
306
|
+ Name: users[i].NickName,
|
307
|
}
|
307
|
}
|
308
|
datalist = append(datalist, m)
|
308
|
datalist = append(datalist, m)
|
309
|
}
|
309
|
}
|
|
|
310
|
+
|
310
|
}
|
311
|
}
|
311
|
return datalist
|
312
|
return datalist
|
312
|
}
|
313
|
}
|
|
@@ -473,31 +474,32 @@ func GetRankRangeInfo(id int64) protocol.ResponseRankRangeInfo { |
|
@@ -473,31 +474,32 @@ func GetRankRangeInfo(id int64) protocol.ResponseRankRangeInfo { |
473
|
}
|
474
|
}
|
474
|
switch rankRange.Type {
|
475
|
switch rankRange.Type {
|
475
|
case models.RANK_RANGE_TYPE_DEPARTMENT:
|
476
|
case models.RANK_RANGE_TYPE_DEPARTMENT:
|
476
|
- //员工
|
|
|
477
|
- users, err := models.GetUserCompanyByIds(relationIds)
|
477
|
+ //部门
|
|
|
478
|
+ departments, err := models.GetDepartmentByIds(relationIds)
|
478
|
if err != nil {
|
479
|
if err != nil {
|
479
|
- log.Error("获取员工数据失败")
|
480
|
+ log.Error("获取部门数据失败")
|
480
|
}
|
481
|
}
|
481
|
- for i := range users {
|
482
|
+ for i := range departments {
|
482
|
m := protocol.RankRangeRelation{
|
483
|
m := protocol.RankRangeRelation{
|
483
|
- Id: users[i].Id,
|
|
|
484
|
- Name: users[i].NickName,
|
484
|
+ Id: departments[i].Id,
|
|
|
485
|
+ Name: departments[i].Name,
|
485
|
}
|
486
|
}
|
486
|
rspdata.Relation = append(rspdata.Relation, m)
|
487
|
rspdata.Relation = append(rspdata.Relation, m)
|
487
|
}
|
488
|
}
|
488
|
case models.RANK_RANGE_TYPE_EMPLAYEE:
|
489
|
case models.RANK_RANGE_TYPE_EMPLAYEE:
|
489
|
- //部门
|
|
|
490
|
- departments, err := models.GetDepartmentByIds(relationIds)
|
490
|
+ //员工
|
|
|
491
|
+ users, err := models.GetUserCompanyByIds(relationIds)
|
491
|
if err != nil {
|
492
|
if err != nil {
|
492
|
- log.Error("获取部门数据失败")
|
493
|
+ log.Error("获取员工数据失败")
|
493
|
}
|
494
|
}
|
494
|
- for i := range departments {
|
495
|
+ for i := range users {
|
495
|
m := protocol.RankRangeRelation{
|
496
|
m := protocol.RankRangeRelation{
|
496
|
- Id: departments[i].Id,
|
|
|
497
|
- Name: departments[i].Name,
|
497
|
+ Id: users[i].Id,
|
|
|
498
|
+ Name: users[i].NickName,
|
498
|
}
|
499
|
}
|
499
|
rspdata.Relation = append(rspdata.Relation, m)
|
500
|
rspdata.Relation = append(rspdata.Relation, m)
|
500
|
}
|
501
|
}
|
|
|
502
|
+
|
501
|
}
|
503
|
}
|
502
|
return rspdata
|
504
|
return rspdata
|
503
|
}
|
505
|
}
|