使用 mysql 和弹簧靴 JPA,
我正在尝试使用JPA.在子句中实现参数列表传递给规范时,在编写如下manaul查询时获得预期结果。雇员 Id 是一个字符串列,其中既有大写字母,也有小写字母。虽然手动查询有效,但必须实现规范。
手动查询:
SELECT emp
FROM EmployeeEntitiy emp
WHERE LOWER(emp.employeeIdParam) IN(
SELECT LOWER(empRel.destinationssid)
FROM EmployeeRelationEntity empRel WHERE ((LOWER(empRel.employeeId)=:employeeIdParam
OR UPPER(empRel.employeeId)=:employeeIdParam)
OR empRel.employeeId=:employeeIdParam)
我怎么能检查列数据与大写和小,如手动查询在到预测覆盖方法。公积管规格:
private class ParentChildCISpecification implements Specification<EmployeeEntitiy> {
List<String> employeeIdParamsList = new ArrayList<String>();
public ParentChildCISpecification(List<String> employeeIdParamsList) {
this.employeeIdParamsList = employeeIdParamsList;
}
@Override
public Predicate toPredicate(Root<EmployeeEntitiy> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
return root.get("employeeId").in(employeeIdParamsList);
}
}
aluckdog
慕慕森
慕盖茨4494581
肥皂起泡泡
随时随地看视频慕课网APP
相关分类