|
@@ -349,14 +349,14 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -349,14 +349,14 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
349
|
}
|
349
|
}
|
350
|
tx := dao.transactionContext.PgTx
|
350
|
tx := dao.transactionContext.PgTx
|
351
|
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
|
351
|
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
|
352
|
-
|
|
|
353
|
// 财富值榜单
|
352
|
// 财富值榜单
|
354
|
queryWealth := tx.Model(suMoneyTransactionRecordModel)
|
353
|
queryWealth := tx.Model(suMoneyTransactionRecordModel)
|
355
|
queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
354
|
queryWealth = queryWealth.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
356
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
355
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
357
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
356
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
358
|
queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
|
357
|
queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
|
359
|
- queryWealth = queryWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
|
358
|
+ //queryWealth = queryWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
|
|
|
359
|
+ queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
|
360
|
queryWealth = queryWealth.Where(`e.status = ?`, 1)
|
360
|
queryWealth = queryWealth.Where(`e.status = ?`, 1)
|
361
|
queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
|
361
|
queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
|
362
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
362
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
|
@@ -368,8 +368,12 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -368,8 +368,12 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
368
|
if endTime, ok := queryOptions["endTime"]; ok {
|
368
|
if endTime, ok := queryOptions["endTime"]; ok {
|
369
|
queryWealth = queryWealth.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
369
|
queryWealth = queryWealth.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
370
|
}
|
370
|
}
|
371
|
- queryWealth = queryWealth.Group("su_money_transaction_record.employee")
|
|
|
372
|
- queryWealth = queryWealth.Group("su_money_transaction_record.create_time")
|
371
|
+ //queryWealth = queryWealth.Group("su_money_transaction_record.employee")
|
|
|
372
|
+ //queryWealth = queryWealth.Group("su_money_transaction_record.employee #>> '{uid}'")
|
|
|
373
|
+
|
|
|
374
|
+ queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
|
|
375
|
+ //queryWealth = queryWealth.Group("su_money_transaction_record.create_time")
|
|
|
376
|
+ //queryWealth = queryWealth.Group(`su_money_transaction_record->'employee'->>'employeeName'`)
|
373
|
if offset, ok := queryOptions["offset"]; ok {
|
377
|
if offset, ok := queryOptions["offset"]; ok {
|
374
|
offset := offset.(int)
|
378
|
offset := offset.(int)
|
375
|
if offset > -1 {
|
379
|
if offset > -1 {
|
|
@@ -396,7 +400,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -396,7 +400,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
396
|
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
400
|
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
397
|
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
401
|
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
398
|
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
|
402
|
queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
|
399
|
- queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
|
403
|
+ queryEmployeeWealth = queryEmployeeWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
|
400
|
queryEmployeeWealth = queryEmployeeWealth.Where(`e.status = ?`, 1)
|
404
|
queryEmployeeWealth = queryEmployeeWealth.Where(`e.status = ?`, 1)
|
401
|
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
|
405
|
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
|
402
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
406
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
|
@@ -408,8 +412,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -408,8 +412,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
408
|
if endTime, ok := queryOptions["endTime"]; ok {
|
412
|
if endTime, ok := queryOptions["endTime"]; ok {
|
409
|
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
413
|
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
410
|
}
|
414
|
}
|
411
|
- queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee")
|
|
|
412
|
- queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.create_time")
|
415
|
+ //queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee")
|
|
|
416
|
+ //queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.employee #>> '{uid}' ")
|
|
|
417
|
+ //queryEmployeeWealth = queryEmployeeWealth.Group("su_money_transaction_record.create_time")
|
|
|
418
|
+ queryEmployeeWealth = queryEmployeeWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
413
|
if uid, ok := queryOptions["uid"]; ok {
|
419
|
if uid, ok := queryOptions["uid"]; ok {
|
414
|
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid)
|
420
|
queryEmployeeWealth = queryEmployeeWealth.Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid)
|
415
|
}
|
421
|
}
|
|
@@ -423,13 +429,13 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -423,13 +429,13 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
423
|
retCurrentEmployeeWealth = retEmployeeWealth[0]
|
429
|
retCurrentEmployeeWealth = retEmployeeWealth[0]
|
424
|
}
|
430
|
}
|
425
|
|
431
|
|
426
|
- // 贡献值榜单
|
432
|
+ // 贡献值榜单-减少的贡献致富
|
427
|
queryContributionsDecrease := tx.Model(suMoneyTransactionRecordModel)
|
433
|
queryContributionsDecrease := tx.Model(suMoneyTransactionRecordModel)
|
428
|
queryContributionsDecrease = queryContributionsDecrease.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
434
|
queryContributionsDecrease = queryContributionsDecrease.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
429
|
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
435
|
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
430
|
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
436
|
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
431
|
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease")
|
437
|
queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease")
|
432
|
- queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC, su_money_transaction_record.create_time) AS ranking")
|
438
|
+ queryContributionsDecrease = queryContributionsDecrease.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
|
433
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
439
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
434
|
queryContributionsDecrease = queryContributionsDecrease.Where("e.company_id = ?", companyId)
|
440
|
queryContributionsDecrease = queryContributionsDecrease.Where("e.company_id = ?", companyId)
|
435
|
}
|
441
|
}
|
|
@@ -441,8 +447,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -441,8 +447,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
441
|
if endTime, ok := queryOptions["endTime"]; ok {
|
447
|
if endTime, ok := queryOptions["endTime"]; ok {
|
442
|
queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
448
|
queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
443
|
}
|
449
|
}
|
444
|
- contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee").Group("su_money_transaction_record.create_time")
|
450
|
+ //contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee").Group("su_money_transaction_record.create_time")
|
|
|
451
|
+ //contributionsDecrease := queryContributionsDecrease.Group("su_money_transaction_record.employee #>> '{uid}'").Group("su_money_transaction_record.create_time")
|
|
|
452
|
+ contributionsDecrease := queryContributionsDecrease.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
445
|
|
453
|
|
|
|
454
|
+ // 贡献值排行榜
|
446
|
queryContributions := tx.Model()
|
455
|
queryContributions := tx.Model()
|
447
|
queryContributions = queryContributions.With("t", contributionsDecrease)
|
456
|
queryContributions = queryContributions.With("t", contributionsDecrease)
|
448
|
queryContributions = queryContributions.Table("t")
|
457
|
queryContributions = queryContributions.Table("t")
|
|
@@ -451,7 +460,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -451,7 +460,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
451
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid")
|
460
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid")
|
452
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
|
461
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
|
453
|
queryContributions = queryContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
|
462
|
queryContributions = queryContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
|
454
|
- queryContributions = queryContributions.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC,su_money_transaction_records.create_time) AS ranking")
|
463
|
+ queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
|
455
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
464
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
456
|
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
|
465
|
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
|
457
|
}
|
466
|
}
|
|
@@ -463,9 +472,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -463,9 +472,11 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
463
|
if endTime, ok := queryOptions["endTime"]; ok {
|
472
|
if endTime, ok := queryOptions["endTime"]; ok {
|
464
|
queryContributions = queryContributions.Where(`su_money_transaction_records.create_time < ?`, endTime)
|
473
|
queryContributions = queryContributions.Where(`su_money_transaction_records.create_time < ?`, endTime)
|
465
|
}
|
474
|
}
|
466
|
- queryContributions = queryContributions.Group("su_money_transaction_records.employee")
|
|
|
467
|
- queryContributions = queryContributions.Group("t.employee_contributions_decrease")
|
|
|
468
|
- queryContributions = queryContributions.Group("su_money_transaction_records.create_time")
|
475
|
+ //queryContributions = queryContributions.Group("su_money_transaction_records.employee")
|
|
|
476
|
+ //queryContributions = queryContributions.Group("su_money_transaction_records.employee #>> '{uid}'")
|
|
|
477
|
+ //queryContributions = queryContributions.Group("t.employee_contributions_decrease")
|
|
|
478
|
+ //queryContributions = queryContributions.Group("su_money_transaction_records.create_time")
|
|
|
479
|
+ queryContributions = queryContributions.GroupExpr("su_money_transaction_records.employee->>'uid',su_money_transaction_records.employee->>'employeeName',t.employee_contributions_decrease")
|
469
|
if offset, ok := queryOptions["offset"]; ok {
|
480
|
if offset, ok := queryOptions["offset"]; ok {
|
470
|
offset := offset.(int)
|
481
|
offset := offset.(int)
|
471
|
if offset > -1 {
|
482
|
if offset > -1 {
|
|
@@ -486,13 +497,13 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -486,13 +497,13 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
486
|
return nil, err
|
497
|
return nil, err
|
487
|
}
|
498
|
}
|
488
|
|
499
|
|
489
|
- // 当前员工贡献值排名
|
500
|
+ // 当前员工贡献值-减少的贡献值排名
|
490
|
queryEmployeeContributionsDecrease := tx.Model(suMoneyTransactionRecordModel)
|
501
|
queryEmployeeContributionsDecrease := tx.Model(suMoneyTransactionRecordModel)
|
491
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
502
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint")
|
492
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
503
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
493
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
504
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
494
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease")
|
505
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_contributions_decrease")
|
495
|
- queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
|
506
|
+ queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
|
496
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
507
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
497
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Where("e.company_id = ?", companyId)
|
508
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Where("e.company_id = ?", companyId)
|
498
|
}
|
509
|
}
|
|
@@ -504,8 +515,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -504,8 +515,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
504
|
if endTime, ok := queryOptions["endTime"]; ok {
|
515
|
if endTime, ok := queryOptions["endTime"]; ok {
|
505
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
516
|
queryEmployeeContributionsDecrease = queryEmployeeContributionsDecrease.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
506
|
}
|
517
|
}
|
507
|
- employeeContributionsDecrease := queryEmployeeContributionsDecrease.Group("su_money_transaction_record.employee")
|
518
|
+ //employeeContributionsDecrease := queryEmployeeContributionsDecrease.Group("su_money_transaction_record.employee")
|
|
|
519
|
+ employeeContributionsDecrease := queryEmployeeContributionsDecrease.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
508
|
|
520
|
|
|
|
521
|
+ // 当前员工贡献值排名
|
509
|
queryEmployeeContributions := tx.Model()
|
522
|
queryEmployeeContributions := tx.Model()
|
510
|
queryEmployeeContributions = queryEmployeeContributions.With("t", employeeContributionsDecrease)
|
523
|
queryEmployeeContributions = queryEmployeeContributions.With("t", employeeContributionsDecrease)
|
511
|
queryEmployeeContributions = queryEmployeeContributions.Table("t")
|
524
|
queryEmployeeContributions = queryEmployeeContributions.Table("t")
|
|
@@ -514,7 +527,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -514,7 +527,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
514
|
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid")
|
527
|
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("su_money_transaction_records.employee->>'uid' AS uid")
|
515
|
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
|
528
|
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
|
516
|
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
|
529
|
queryEmployeeContributions = queryEmployeeContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
|
517
|
- queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("RANK() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
|
530
|
+ queryEmployeeContributions = queryEmployeeContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
|
518
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
531
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
519
|
queryEmployeeContributions = queryContributions.Where("e.company_id = ?", companyId)
|
532
|
queryEmployeeContributions = queryContributions.Where("e.company_id = ?", companyId)
|
520
|
}
|
533
|
}
|
|
@@ -529,8 +542,9 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -529,8 +542,9 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
529
|
if uid, ok := queryOptions["uid"]; ok {
|
542
|
if uid, ok := queryOptions["uid"]; ok {
|
530
|
queryEmployeeContributions = queryEmployeeContributions.Where(`su_money_transaction_records.employee @> '{"uid":?}'`, uid)
|
543
|
queryEmployeeContributions = queryEmployeeContributions.Where(`su_money_transaction_records.employee @> '{"uid":?}'`, uid)
|
531
|
}
|
544
|
}
|
532
|
- queryEmployeeContributions = queryEmployeeContributions.Group("su_money_transaction_records.employee")
|
|
|
533
|
- queryEmployeeContributions = queryEmployeeContributions.Group("t.employee_contributions_decrease")
|
545
|
+ //queryEmployeeContributions = queryEmployeeContributions.Group("su_money_transaction_records.employee")
|
|
|
546
|
+ queryEmployeeContributions = queryEmployeeContributions.GroupExpr("su_money_transaction_records.employee->>'uid',su_money_transaction_records.employee->>'employeeName',t.employee_contributions_decrease")
|
|
|
547
|
+ //queryEmployeeContributions = queryEmployeeContributions.Group("t.employee_contributions_decrease")
|
534
|
if err := queryEmployeeContributions.Order("employees_contributions DESC").Select(&retEmployeeContributions); err != nil {
|
548
|
if err := queryEmployeeContributions.Order("employees_contributions DESC").Select(&retEmployeeContributions); err != nil {
|
535
|
return nil, err
|
549
|
return nil, err
|
536
|
}
|
550
|
}
|