|
@@ -317,8 +317,8 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -317,8 +317,8 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
317
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
317
|
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
|
318
|
queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
|
318
|
queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
|
319
|
queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
|
319
|
queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
|
320
|
- queryWealth = queryWealth.Where(`e.status = ?`, 1) // 离职员工过滤
|
|
|
321
|
queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3, 6}))
|
320
|
queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3, 6}))
|
|
|
321
|
+ queryWealth = queryWealth.Where(`e.status = ?`, 1) // 离职员工过滤
|
322
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
322
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
323
|
queryWealth = queryWealth.Where("e.company_id = ?", companyId)
|
323
|
queryWealth = queryWealth.Where("e.company_id = ?", companyId)
|
324
|
}
|
324
|
}
|
|
@@ -385,7 +385,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -385,7 +385,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
385
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
385
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
386
|
queryContributionsDecrease = queryContributionsDecrease.Where("e.company_id = ?", companyId)
|
386
|
queryContributionsDecrease = queryContributionsDecrease.Where("e.company_id = ?", companyId)
|
387
|
}
|
387
|
}
|
388
|
- //queryContributionsDecrease = queryContributionsDecrease.Where(`e.status = ?`, 1)
|
388
|
+ queryContributionsDecrease = queryContributionsDecrease.Where(`e.status = ?`, 1)
|
389
|
queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.record_type = ?`, 4)
|
389
|
queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.record_type = ?`, 4)
|
390
|
if startTime, ok := queryOptions["startTime"]; ok {
|
390
|
if startTime, ok := queryOptions["startTime"]; ok {
|
391
|
queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.create_time > ?`, startTime)
|
391
|
queryContributionsDecrease = queryContributionsDecrease.Where(`su_money_transaction_record.create_time > ?`, startTime)
|
|
@@ -405,9 +405,9 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
|
@@ -405,9 +405,9 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter |
405
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
|
405
|
queryContributions = queryContributions.ColumnExpr("su_money_transaction_records.employee->>'employeeName' AS employee_name")
|
406
|
queryContributions = queryContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
|
406
|
queryContributions = queryContributions.ColumnExpr(`(sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease) AS employees_contributions`)
|
407
|
queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
|
407
|
queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking")
|
|
|
408
|
+ queryContributions = queryContributions.Where(`su_money_transaction_records.record_type IN (?)`, pg.In([]int{2, 3}))
|
408
|
queryContributions = queryContributions.Where(`e.status = ?`, 1)
|
409
|
queryContributions = queryContributions.Where(`e.status = ?`, 1)
|
409
|
queryContributions = queryContributions.Where("e.uid = t.uid::bigint")
|
410
|
queryContributions = queryContributions.Where("e.uid = t.uid::bigint")
|
410
|
- queryContributions = queryContributions.Where(`su_money_transaction_records.record_type IN (?)`, pg.In([]int{2, 3}))
|
|
|
411
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
411
|
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
|
412
|
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
|
412
|
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
|
413
|
}
|
413
|
}
|