作者 陈志颖

fix:贡献值、财富值排行榜统计离职人员

@@ -337,7 +337,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter @@ -337,7 +337,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
337 queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") 337 queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
338 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") 338 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")
339 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") 339 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")
340 - queryWealth = queryWealth.Where(`e.status = ?`, 1) 340 + //queryWealth = queryWealth.Where(`e.status = ?`, 1)
341 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { 341 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
342 queryWealth = queryWealth.Where("e.company_id = ?", companyId) 342 queryWealth = queryWealth.Where("e.company_id = ?", companyId)
343 } 343 }
@@ -399,7 +399,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter @@ -399,7 +399,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
399 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") 399 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")
400 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") 400 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")
401 queryContributions = queryContributions.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})) 401 queryContributions = queryContributions.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
402 - queryContributions = queryContributions.Where(`e.status = ?`, 1) 402 + //queryContributions = queryContributions.Where(`e.status = ?`, 1)
403 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { 403 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
404 queryContributions = queryContributions.Where("e.company_id = ?", companyId) 404 queryContributions = queryContributions.Where("e.company_id = ?", companyId)
405 } 405 }