This commit is contained in:
2024-08-28 15:37:42 +08:00
parent cf58954f11
commit 1fc33cb4fc

View File

@@ -897,16 +897,16 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
private List<EmpSalaryEntity> queryHisSalary(List<String> employeesIds) {
em.createNativeQuery(
List ids = em.createNativeQuery(
"""
with tmp1 as (
with tmp1 as (
select s.id, rank() over (partition by employee_id order by batch_year_month desc ) rk from t_emp_salary s where s.employee_id in :ids
)
select s.id, rank() over (partition by employee_id order by batch_year_month desc ) rk from t_emp_salary s where s.employee_id in :ids
)
select id from tmp1 where rk = 1
select id from tmp1 where rk = 1
""",
""",
String.class)
.setParameter("ids", employeesIds)
.getResultList();
@@ -914,7 +914,7 @@ select id from tmp1 where rk = 1
return em.createQuery(
"select s from EmpSalaryEntity s where s.employee.id in :ids",
EmpSalaryEntity.class)
.setParameter("ids", employeesIds)
.setParameter("ids", ids)
.getResultList();
}