|
@@ -342,10 +342,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -342,10 +342,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
342
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
342
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
343
|
//queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
343
|
//queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
344
|
queryWealth = queryWealth.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) AS employee_su_money")
|
344
|
queryWealth = queryWealth.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) AS employee_su_money")
|
345
|
- queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking")
|
345
|
+ queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) DESC, e.create_time ASC) AS ranking")
|
346
|
queryWealth = queryWealth.Where(`e.status = ?`, 1)
|
346
|
queryWealth = queryWealth.Where(`e.status = ?`, 1)
|
347
|
//queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
347
|
//queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
348
|
- queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid'")
|
348
|
+ queryWealth = queryWealth.GroupExpr("su_money_transaction_record.employee->>'uid', e.create_time")
|
349
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
349
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
350
|
queryWealth = queryWealth.Where("e.company_id = ?", companyId)
|
350
|
queryWealth = queryWealth.Where("e.company_id = ?", companyId)
|
351
|
}
|
351
|
}
|
|
@@ -382,7 +382,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -382,7 +382,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
382
|
queryWealthWith = queryWealthWith.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
382
|
queryWealthWith = queryWealthWith.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
383
|
//queryWealthWith = queryWealthWith.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
383
|
//queryWealthWith = queryWealthWith.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
384
|
queryWealthWith = queryWealthWith.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) AS employee_su_money")
|
384
|
queryWealthWith = queryWealthWith.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) AS employee_su_money")
|
385
|
- queryWealthWith = queryWealthWith.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking")
|
385
|
+ queryWealthWith = queryWealthWith.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) DESC, e.create_time ASC) AS ranking")
|
386
|
queryWealthWith = queryWealthWith.Where(`e.status = ?`, 1)
|
386
|
queryWealthWith = queryWealthWith.Where(`e.status = ?`, 1)
|
387
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
387
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
388
|
queryWealthWith = queryWealthWith.Where("e.company_id = ?", companyId)
|
388
|
queryWealthWith = queryWealthWith.Where("e.company_id = ?", companyId)
|
|
@@ -394,7 +394,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -394,7 +394,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
394
|
queryWealthWith = queryWealthWith.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
394
|
queryWealthWith = queryWealthWith.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
395
|
}
|
395
|
}
|
396
|
//queryWealthRestoreWith := queryWealthWith.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName', e.create_time")
|
396
|
//queryWealthRestoreWith := queryWealthWith.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName', e.create_time")
|
397
|
- queryWealthRestoreWith := queryWealthWith.GroupExpr("su_money_transaction_record.employee->>'uid'")
|
397
|
+ queryWealthRestoreWith := queryWealthWith.GroupExpr("su_money_transaction_record.employee->>'uid', e.create_time")
|
398
|
querySelfWealth := tx.Model()
|
398
|
querySelfWealth := tx.Model()
|
399
|
querySelfWealth = querySelfWealth.With("t", queryWealthRestoreWith)
|
399
|
querySelfWealth = querySelfWealth.With("t", queryWealthRestoreWith)
|
400
|
querySelfWealth = querySelfWealth.Table("t")
|
400
|
querySelfWealth = querySelfWealth.Table("t")
|
|
@@ -421,10 +421,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -421,10 +421,10 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
421
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
421
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
422
|
//queryContributions = queryContributions.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
422
|
//queryContributions = queryContributions.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
423
|
queryContributions = queryContributions.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) AS employees_contributions")
|
423
|
queryContributions = queryContributions.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) AS employees_contributions")
|
424
|
- queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking")
|
424
|
+ queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) DESC, e.create_time ASC) AS ranking")
|
425
|
queryContributions = queryContributions.Where(`e.status = ?`, 1)
|
425
|
queryContributions = queryContributions.Where(`e.status = ?`, 1)
|
426
|
//queryContributions = queryContributions.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
426
|
//queryContributions = queryContributions.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName'")
|
427
|
- queryContributions = queryContributions.GroupExpr("su_money_transaction_record.employee->>'uid'")
|
427
|
+ queryContributions = queryContributions.GroupExpr("su_money_transaction_record.employee->>'uid', e.create_time")
|
428
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
428
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
429
|
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
|
429
|
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
|
430
|
}
|
430
|
}
|
|
@@ -460,7 +460,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -460,7 +460,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
460
|
queryContributionsWith = queryContributionsWith.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
460
|
queryContributionsWith = queryContributionsWith.ColumnExpr("su_money_transaction_record.employee->>'uid' AS uid")
|
461
|
//queryContributionsWith = queryContributionsWith.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
461
|
//queryContributionsWith = queryContributionsWith.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
462
|
queryContributionsWith = queryContributionsWith.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) AS employees_contributions")
|
462
|
queryContributionsWith = queryContributionsWith.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) AS employees_contributions")
|
463
|
- queryContributionsWith = queryContributionsWith.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking")
|
463
|
+ queryContributionsWith = queryContributionsWith.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) DESC, e.create_time ASC) AS ranking")
|
464
|
queryContributionsWith = queryContributionsWith.Where(`e.status = ?`, 1)
|
464
|
queryContributionsWith = queryContributionsWith.Where(`e.status = ?`, 1)
|
465
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
465
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
466
|
queryContributionsWith = queryContributionsWith.Where("e.company_id = ?", companyId)
|
466
|
queryContributionsWith = queryContributionsWith.Where("e.company_id = ?", companyId)
|
|
@@ -472,7 +472,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -472,7 +472,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
472
|
queryContributionsWith = queryContributionsWith.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
472
|
queryContributionsWith = queryContributionsWith.Where(`su_money_transaction_record.create_time < ?`, endTime)
|
473
|
}
|
473
|
}
|
474
|
//contributionsWith := queryContributionsWith.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName', e.create_time")
|
474
|
//contributionsWith := queryContributionsWith.GroupExpr("su_money_transaction_record.employee->>'uid',su_money_transaction_record.employee->>'employeeName', e.create_time")
|
475
|
- contributionsWith := queryContributionsWith.GroupExpr("su_money_transaction_record.employee->>'uid'")
|
475
|
+ contributionsWith := queryContributionsWith.GroupExpr("su_money_transaction_record.employee->>'uid', e.create_time")
|
476
|
querySelfContributions := tx.Model()
|
476
|
querySelfContributions := tx.Model()
|
477
|
querySelfContributions = querySelfContributions.With("t", contributionsWith)
|
477
|
querySelfContributions = querySelfContributions.With("t", contributionsWith)
|
478
|
querySelfContributions = querySelfContributions.Table("t")
|
478
|
querySelfContributions = querySelfContributions.Table("t")
|