com.blinkfox.fenix.specification.handler.impl.GreaterThanPredicateHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fenix Show documentation
Show all versions of fenix Show documentation
This is an extension library to the Spring Data JPA complex or dynamic SQL query.
这是一个为了解决复杂动态 SQL (JPQL) 而生的 Spring Data JPA 扩展库,能辅助开发者更方便快捷的书写复杂、动态且易于维护的 SQL,支持 ActiveRecord 模式和多种查询方式。
package com.blinkfox.fenix.specification.handler.impl;
import com.blinkfox.fenix.specification.annotation.GreaterThan;
import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler;
import java.lang.annotation.Annotation;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.From;
import javax.persistence.criteria.Predicate;
/**
* 构建“大于条件”({@code field > 'xxx'})场景的 {@link Predicate} 处理器.
*
* @author YangWenpeng on 2019-12-17
* @author blinkfox on 2020-01-14
* @since v2.2.0
*/
public class GreaterThanPredicateHandler extends AbstractPredicateHandler {
@Override
public Class getAnnotation() {
return GreaterThan.class;
}
@Override
public Predicate buildPredicate(
CriteriaBuilder criteriaBuilder, From from, String fieldName, Object value, Annotation annotation) {
return criteriaBuilder.and(super.buildGreaterThanPredicate(criteriaBuilder, from, fieldName, value));
}
}