Skip to content

Latest commit

 

History

History
19 lines (18 loc) · 524 Bytes

240130.md

File metadata and controls

19 lines (18 loc) · 524 Bytes

QueryDSL에서 Integer, Double 범위 검색 처리로직 제네릭으로 통일하기

private static <T extends Number & Comparable<?>> BooleanExpression rangeBetween(
        NumberPath<T> target, 
        T minValue, 
        T maxValue) {
    if (minValue == null && maxValue == null) {
        return null;
    }
    if (minValue == null) {
        return target.loe(maxValue);
    }
    if (maxValue == null) {
        return target.goe(minValue);
    }
    return target.between(minValue, maxValue);
}