From 99616905a9c0097c0247166e2c9e663f7d9fac4d Mon Sep 17 00:00:00 2001 From: imhansai Date: Sat, 31 Dec 2022 16:19:56 +0800 Subject: [PATCH 1/5] =?UTF-8?q?spring-data-jpa=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=88=B0=203.0.0;hibernate-core=20=E5=8D=87=E7=BA=A7=E5=88=B0?= =?UTF-8?q?=206.1.6.Final=EF=BC=9B=E4=BB=A5=E5=8F=8A=E9=9A=8F=E4=B9=8B?= =?UTF-8?q?=E8=80=8C=E6=9D=A5=E7=9A=84=E6=94=B9=E5=8A=A8[WIP]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- src/main/java/com/blinkfox/fenix/EnableFenix.java | 2 +- .../java/com/blinkfox/fenix/ar/repo/JpaModel.java | 5 +++-- .../fenix/ar/repo/PagingAndSortingModel.java | 4 ++-- .../com/blinkfox/fenix/ar/spec/FenixSpecModel.java | 10 +++++----- .../blinkfox/fenix/helper/ClassMethodInvoker.java | 2 +- .../fenix/jpa/AbstractResultTransformer.java | 4 ++-- .../java/com/blinkfox/fenix/jpa/FenixJpaQuery.java | 6 +++--- .../fenix/jpa/FenixJpaRepositoryFactory.java | 2 +- .../fenix/jpa/FenixJpaRepositoryFactoryBean.java | 2 +- .../fenix/jpa/FenixQueryLookupStrategy.java | 6 ++++-- .../blinkfox/fenix/jpa/FenixResultTransformer.java | 4 ++-- .../fenix/jpa/FenixSimpleJpaRepository.java | 4 ++-- .../com/blinkfox/fenix/jpa/QueryResultContext.java | 2 +- .../transformer/ColumnAnnotationTransformer.java | 2 +- .../fenix/specification/FenixSpecification.java | 6 +++--- .../fenix/specification/annotation/Join.java | 2 +- .../handler/AbstractPredicateHandler.java | 13 ++++++------- .../specification/handler/PredicateHandler.java | 6 +++--- .../handler/impl/BetweenPredicateHandler.java | 6 +++--- .../handler/impl/EndsWithPredicateHandler.java | 6 +++--- .../handler/impl/EqualsPredicateHandler.java | 6 +++--- .../impl/GreaterThanEqualPredicateHandler.java | 6 +++--- .../handler/impl/GreaterThanPredicateHandler.java | 6 +++--- .../handler/impl/InPredicateHandler.java | 6 +++--- .../handler/impl/IsNotNullPredicateHandler.java | 6 +++--- .../handler/impl/IsNullPredicateHandler.java | 6 +++--- .../handler/impl/JoinPredicateHandler.java | 8 ++++---- .../handler/impl/LessThanEqualPredicateHandler.java | 6 +++--- .../handler/impl/LessThanPredicateHandler.java | 6 +++--- .../handler/impl/LikeInPredicateHandler.java | 6 +++--- .../handler/impl/LikeOrLikePredicateHandler.java | 6 +++--- .../handler/impl/LikePatternPredicateHandler.java | 6 +++--- .../handler/impl/LikePredicateHandler.java | 6 +++--- .../handler/impl/NotBetweenPredicateHandler.java | 6 +++--- .../handler/impl/NotEndsWithPredicateHandler.java | 6 +++--- .../handler/impl/NotEqualsPredicateHandler.java | 6 +++--- .../handler/impl/NotInPredicateHandler.java | 9 +++++---- .../impl/NotLikePatternPredicateHandler.java | 6 +++--- .../handler/impl/NotLikePredicateHandler.java | 6 +++--- .../handler/impl/NotStartsWithPredicateHandler.java | 6 +++--- .../handler/impl/OrBetweenPredicateHandler.java | 6 +++--- .../handler/impl/OrEndsWithPredicateHandler.java | 6 +++--- .../handler/impl/OrEqualsPredicateHandler.java | 6 +++--- .../impl/OrGreaterThanEqualPredicateHandler.java | 6 +++--- .../handler/impl/OrGreaterThanPredicateHandler.java | 6 +++--- .../handler/impl/OrInPredicateHandler.java | 6 +++--- .../handler/impl/OrIsNotNullPredicateHandler.java | 6 +++--- .../handler/impl/OrIsNullPredicateHandler.java | 6 +++--- .../impl/OrLessThanEqualPredicateHandler.java | 6 +++--- .../handler/impl/OrLessThanPredicateHandler.java | 6 +++--- .../handler/impl/OrLikeOrLikePredicateHandler.java | 6 +++--- .../handler/impl/OrLikePatternPredicateHandler.java | 6 +++--- .../handler/impl/OrLikePredicateHandler.java | 6 +++--- .../handler/impl/OrNotBetweenPredicateHandler.java | 6 +++--- .../handler/impl/OrNotEndsWithPredicateHandler.java | 6 +++--- .../handler/impl/OrNotEqualsPredicateHandler.java | 6 +++--- .../handler/impl/OrNotInPredicateHandler.java | 6 +++--- .../impl/OrNotLikePatternPredicateHandler.java | 6 +++--- .../handler/impl/OrNotLikePredicateHandler.java | 6 +++--- .../impl/OrNotStartsWithPredicateHandler.java | 6 +++--- .../handler/impl/OrStartsWithPredicateHandler.java | 6 +++--- .../handler/impl/StartsWithPredicateHandler.java | 6 +++--- .../predicate/FenixBooleanStaticPredicate.java | 9 +++------ .../specification/predicate/FenixPredicate.java | 2 +- .../predicate/FenixPredicateBuilder.java | 8 ++++---- .../com/blinkfox/fenix/FenixTestApplication.java | 2 +- src/test/java/com/blinkfox/fenix/entity/Blog.java | 8 ++++---- src/test/java/com/blinkfox/fenix/entity/Book.java | 8 ++++---- .../java/com/blinkfox/fenix/entity/EntityOne.java | 10 +++++----- .../java/com/blinkfox/fenix/entity/EntityThree.java | 10 +++++----- .../java/com/blinkfox/fenix/entity/EntityTwo.java | 10 +++++----- src/test/java/com/blinkfox/fenix/entity/School.java | 8 ++++---- src/test/java/com/blinkfox/fenix/entity/User.java | 8 ++++---- .../java/com/blinkfox/fenix/entity/ar/ArCrud.java | 10 +++++----- .../com/blinkfox/fenix/entity/ar/ArFenixJpa.java | 10 +++++----- .../com/blinkfox/fenix/entity/ar/ArFenixSpec.java | 8 ++++---- .../java/com/blinkfox/fenix/entity/ar/ArJpa.java | 10 +++++----- .../com/blinkfox/fenix/entity/ar/ArPageSort.java | 13 ++++++------- .../fenix/entity/transformer/PrefixUnderscore.java | 10 +++++----- .../fenix/entity/transformer/UnderscoreEntity.java | 10 +++++----- .../fenix/repository/BlogRepositoryTest.java | 4 ++-- .../fenix/repository/BookRepositoryMatchTest.java | 2 +- .../repository/BookRepositoryPredicateTest.java | 4 ++-- .../fenix/repository/BookRepositoryTest.java | 2 +- .../fenix/repository/BookRepositoryUnitTest.java | 2 +- .../fenix/repository/EntityOneRepositoryTest.java | 2 +- .../fenix/repository/EntityThreeRepositoryTest.java | 2 +- .../fenix/repository/EntityTwoRepositoryTest.java | 2 +- .../fenix/repository/FenixBookRepositoryTest.java | 2 +- .../fenix/repository/FenixSchoolRepositoryTest.java | 2 +- .../fenix/repository/UnitTestRepositoryTest.java | 2 +- .../fenix/repository/UserRepositoryTest.java | 2 +- .../fenix/repository/ar/ArCrudRepository.java | 6 ++++++ .../fenix/repository/ar/ArCrudRepositoryTest.java | 4 ++-- .../repository/ar/ArFenixJpaRepositoryTest.java | 4 ++-- .../repository/ar/ArFenixSpecRepositoryTest.java | 4 ++-- .../fenix/repository/ar/ArJpaRepositoryTest.java | 4 ++-- .../fenix/repository/ar/ArPageSortRepository.java | 4 ++-- .../repository/ar/ArPageSortRepositoryTest.java | 2 +- .../fenix/repository/ar/BaseRepositoryTest.java | 2 +- .../transformer/PrefixUnderscoreRepositoryTest.java | 6 +++--- .../transformer/UnderscoreEntityRepositoryTest.java | 6 +++--- .../fenix/vo/transformer/ParentColumnVo.java | 2 +- .../fenix/vo/transformer/UnderscoreColumnVo.java | 2 +- 105 files changed, 294 insertions(+), 289 deletions(-) diff --git a/pom.xml b/pom.xml index d238e5d3..b1b5d553 100644 --- a/pom.xml +++ b/pom.xml @@ -46,13 +46,13 @@ org.springframework.data spring-data-jpa - 2.7.6 + 3.0.0 true org.hibernate hibernate-core - 5.6.14.Final + 6.1.6.Final true diff --git a/src/main/java/com/blinkfox/fenix/EnableFenix.java b/src/main/java/com/blinkfox/fenix/EnableFenix.java index b0b2f05a..2f3a5be5 100644 --- a/src/main/java/com/blinkfox/fenix/EnableFenix.java +++ b/src/main/java/com/blinkfox/fenix/EnableFenix.java @@ -4,10 +4,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; import com.blinkfox.fenix.jpa.FenixJpaRepositoryFactoryBean; +import jakarta.persistence.EntityManagerFactory; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.persistence.EntityManagerFactory; import org.springframework.beans.factory.FactoryBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; diff --git a/src/main/java/com/blinkfox/fenix/ar/repo/JpaModel.java b/src/main/java/com/blinkfox/fenix/ar/repo/JpaModel.java index 8337a994..7d1d17f3 100644 --- a/src/main/java/com/blinkfox/fenix/ar/repo/JpaModel.java +++ b/src/main/java/com/blinkfox/fenix/ar/repo/JpaModel.java @@ -18,7 +18,8 @@ * @author blinkfox on 2022-03-29. * @since v2.7.0 */ -public interface JpaModel> extends PagingAndSortingModel { +public interface JpaModel> extends PagingAndSortingModel, CrudModel { /** * 校验 Repository 接口是否是 {@link JpaRepository} 类型的接口. @@ -60,7 +61,7 @@ default S saveAndFlush() { * @return 实体对象 */ default T getById() { - return this.getRepository().getById(this.getId()); + return this.getRepository().getReferenceById(this.getId()); } } diff --git a/src/main/java/com/blinkfox/fenix/ar/repo/PagingAndSortingModel.java b/src/main/java/com/blinkfox/fenix/ar/repo/PagingAndSortingModel.java index bc07f65d..84c6d325 100644 --- a/src/main/java/com/blinkfox/fenix/ar/repo/PagingAndSortingModel.java +++ b/src/main/java/com/blinkfox/fenix/ar/repo/PagingAndSortingModel.java @@ -1,5 +1,6 @@ package com.blinkfox.fenix.ar.repo; +import com.blinkfox.fenix.ar.BaseModel; import com.blinkfox.fenix.exception.FenixException; import com.blinkfox.fenix.helper.StringHelper; import org.springframework.data.repository.PagingAndSortingRepository; @@ -17,8 +18,7 @@ * @author blinkfox on 2022-03-29. * @since v2.7.0 */ -public interface PagingAndSortingModel> - extends CrudModel { +public interface PagingAndSortingModel> extends BaseModel { /** * 校验 Repository 接口是否是 {@link PagingAndSortingRepository} 类型的接口. diff --git a/src/main/java/com/blinkfox/fenix/ar/spec/FenixSpecModel.java b/src/main/java/com/blinkfox/fenix/ar/spec/FenixSpecModel.java index dc1e52bc..dfc65140 100644 --- a/src/main/java/com/blinkfox/fenix/ar/spec/FenixSpecModel.java +++ b/src/main/java/com/blinkfox/fenix/ar/spec/FenixSpecModel.java @@ -41,7 +41,7 @@ default void validExecutor(Object repository) { /** * 基于 {@link FenixPredicate} 返回与之匹配的单个对象的 {@link Optional} 实例. * - * @param fenixPredicate Fenix 中用于动态构造 {@link javax.persistence.criteria.Predicate} 条件的接口 + * @param fenixPredicate Fenix 中用于动态构造 {@link jakarta.persistence.criteria.Predicate} 条件的接口 * @return 不可能是 {@literal null}. * @throws org.springframework.dao.IncorrectResultSizeDataAccessException 如果找到多个实例时抛出此异常. */ @@ -63,7 +63,7 @@ default Optional findOneOfBean(Object beanParam) { /** * 基于 {@link FenixPredicate} 返回与之匹配的所有对象实例的集合. * - * @param fenixPredicate Fenix 中用于动态构造 {@link javax.persistence.criteria.Predicate} 条件的接口 + * @param fenixPredicate Fenix 中用于动态构造 {@link jakarta.persistence.criteria.Predicate} 条件的接口 * @return 不可能是 {@literal null}. */ default List findAll(FenixPredicate fenixPredicate) { @@ -73,7 +73,7 @@ default List findAll(FenixPredicate fenixPredicate) { /** * 基于 {@link FenixPredicate} 和 {@link Pageable} 分页信息返回与之匹配的分页对象实例. * - * @param fenixPredicate Fenix 中用于动态构造 {@link javax.persistence.criteria.Predicate} 条件的接口 + * @param fenixPredicate Fenix 中用于动态构造 {@link jakarta.persistence.criteria.Predicate} 条件的接口 * @param pageable 分页信息,不能为 {@literal null}. * @return 分页结果,不可能是 {@literal null}. */ @@ -84,7 +84,7 @@ default Page findAll(FenixPredicate fenixPredicate, Pageable pageable) { /** * 基于 {@link FenixPredicate} 和 {@link Sort} 排序信息返回所有与之匹配的对象实例. * - * @param fenixPredicate Fenix 中用于动态构造 {@link javax.persistence.criteria.Predicate} 条件的接口 + * @param fenixPredicate Fenix 中用于动态构造 {@link jakarta.persistence.criteria.Predicate} 条件的接口 * @param sort 排序信息,不能为 {@literal null}. * @return 排序结果,不可能是 {@literal null}. */ @@ -127,7 +127,7 @@ default List findAllOfBean(Object beanParam, Sort sort) { /** * 基于 {@link FenixPredicate} 返回与之匹配的所有对象实例的总数量. * - * @param fenixPredicate Fenix 中用于动态构造 {@link javax.persistence.criteria.Predicate} 条件的接口 + * @param fenixPredicate Fenix 中用于动态构造 {@link jakarta.persistence.criteria.Predicate} 条件的接口 * @return 实例数量. */ default long count(FenixPredicate fenixPredicate) { diff --git a/src/main/java/com/blinkfox/fenix/helper/ClassMethodInvoker.java b/src/main/java/com/blinkfox/fenix/helper/ClassMethodInvoker.java index 999d5b71..0be7c767 100644 --- a/src/main/java/com/blinkfox/fenix/helper/ClassMethodInvoker.java +++ b/src/main/java/com/blinkfox/fenix/helper/ClassMethodInvoker.java @@ -13,7 +13,7 @@ import org.springframework.data.repository.query.Param; /** - * 通过仿射调用 class 方法中的指定方法的工具类. + * 通过反射调用 class 方法中的指定方法的工具类. * * @author blinkfox on 2019-08-11. * @since v1.0.0 diff --git a/src/main/java/com/blinkfox/fenix/jpa/AbstractResultTransformer.java b/src/main/java/com/blinkfox/fenix/jpa/AbstractResultTransformer.java index bce35ad7..f7fb6c1e 100644 --- a/src/main/java/com/blinkfox/fenix/jpa/AbstractResultTransformer.java +++ b/src/main/java/com/blinkfox/fenix/jpa/AbstractResultTransformer.java @@ -8,7 +8,7 @@ import java.util.List; import lombok.Setter; import org.hibernate.transform.ResultTransformer; -import org.hibernate.type.BlobType; +import org.hibernate.type.descriptor.java.BlobJavaType; import org.hibernate.type.descriptor.java.DataHelper; import org.springframework.beans.BeanWrapper; import org.springframework.beans.NotWritablePropertyException; @@ -130,7 +130,7 @@ protected enum BlobToStringConverter implements Converter { @Override public String convert(Blob source) { - return BlobType.INSTANCE.toString(source); + return BlobJavaType.INSTANCE.toString(source); } } diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java index 15e468ea..2f0b90b3 100644 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaQuery.java @@ -6,14 +6,14 @@ import com.blinkfox.fenix.helper.ClassMethodInvoker; import com.blinkfox.fenix.helper.QueryHelper; import com.blinkfox.fenix.helper.StringHelper; +import jakarta.persistence.EntityManager; +import jakarta.persistence.Query; +import jakarta.persistence.Tuple; import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.persistence.EntityManager; -import javax.persistence.Query; -import javax.persistence.Tuple; import lombok.Setter; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.query.AbstractJpaQuery; diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactory.java b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactory.java index a912c3c1..28f1b958 100755 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactory.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactory.java @@ -1,7 +1,7 @@ package com.blinkfox.fenix.jpa; +import jakarta.persistence.EntityManager; import java.util.Optional; -import javax.persistence.EntityManager; import lombok.extern.slf4j.Slf4j; import org.springframework.data.jpa.provider.PersistenceProvider; import org.springframework.data.jpa.provider.QueryExtractor; diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactoryBean.java b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactoryBean.java index 1afc3ebe..7023105f 100755 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactoryBean.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixJpaRepositoryFactoryBean.java @@ -1,6 +1,6 @@ package com.blinkfox.fenix.jpa; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean; import org.springframework.data.repository.Repository; import org.springframework.data.repository.core.support.RepositoryFactorySupport; diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java b/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java index 0468beec..c0d13ed9 100755 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java @@ -1,13 +1,14 @@ package com.blinkfox.fenix.jpa; +import jakarta.persistence.EntityManager; import java.lang.reflect.Method; -import javax.persistence.EntityManager; import lombok.extern.slf4j.Slf4j; import org.springframework.data.jpa.provider.QueryExtractor; import org.springframework.data.jpa.repository.query.DefaultJpaQueryMethodFactory; import org.springframework.data.jpa.repository.query.EscapeCharacter; import org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy; import org.springframework.data.jpa.repository.query.JpaQueryMethodFactory; +import org.springframework.data.jpa.repository.query.QueryRewriterProvider; import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.NamedQueries; import org.springframework.data.repository.core.RepositoryMetadata; @@ -75,7 +76,8 @@ private FenixQueryLookupStrategy(EntityManager entityManager, QueryLookupStrateg if (FenixJpaClassWriter.hasDefaultJpaQueryMethodFactoryClass()) { this.queryMethodFactory = new DefaultJpaQueryMethodFactory(extractor); this.jpaQueryLookupStrategy = JpaQueryLookupStrategy.create(entityManager, - (JpaQueryMethodFactory) this.queryMethodFactory, key, provider, EscapeCharacter.DEFAULT); + (JpaQueryMethodFactory) this.queryMethodFactory, key, provider, QueryRewriterProvider.simple(), + EscapeCharacter.DEFAULT); } else { // 为了兼容 Spring Data JPA v2.3.0 之前的版本,此处使用 Javassist 来重写下面方法的中的字节码,来解决老版本的编译错误. this.jpaQueryLookupStrategy = this.createOldJpaQueryLookupStrategy(entityManager, key, extractor, provider, diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixResultTransformer.java b/src/main/java/com/blinkfox/fenix/jpa/FenixResultTransformer.java index fea5d6c2..d13e0101 100644 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixResultTransformer.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixResultTransformer.java @@ -11,7 +11,7 @@ import org.springframework.beans.BeanWrapper; import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.DefaultConversionService; -import org.springframework.data.convert.JodaTimeConverters; +import org.springframework.data.convert.Jsr310Converters; /** * 自定义查询结果的转换器. @@ -45,7 +45,7 @@ public class FenixResultTransformer extends AbstractResultTransformer { static { // 添加一些默认的 ConversionService. - Collection> convertersToRegister = JodaTimeConverters.getConvertersToRegister(); + Collection> convertersToRegister = Jsr310Converters.getConvertersToRegister(); for (Converter converter : convertersToRegister) { oldConversionService.addConverter(converter); } diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixSimpleJpaRepository.java b/src/main/java/com/blinkfox/fenix/jpa/FenixSimpleJpaRepository.java index 4e8cd6a6..403f0fa8 100644 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixSimpleJpaRepository.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixSimpleJpaRepository.java @@ -2,12 +2,12 @@ import com.blinkfox.fenix.consts.Const; import com.blinkfox.fenix.helper.StringHelper; +import jakarta.persistence.EntityManager; +import jakarta.persistence.metamodel.SingularAttribute; import java.beans.PropertyDescriptor; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import javax.persistence.EntityManager; -import javax.persistence.metamodel.SingularAttribute; import org.hibernate.Session; import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanWrapper; diff --git a/src/main/java/com/blinkfox/fenix/jpa/QueryResultContext.java b/src/main/java/com/blinkfox/fenix/jpa/QueryResultContext.java index ed25dc35..a63529d9 100644 --- a/src/main/java/com/blinkfox/fenix/jpa/QueryResultContext.java +++ b/src/main/java/com/blinkfox/fenix/jpa/QueryResultContext.java @@ -5,11 +5,11 @@ import com.blinkfox.fenix.jpa.transformer.ColumnAnnotationTransformer; import com.blinkfox.fenix.jpa.transformer.PrefixUnderscoreTransformer; import com.blinkfox.fenix.jpa.transformer.UnderscoreTransformer; +import jakarta.persistence.Query; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import java.util.function.Supplier; -import javax.persistence.Query; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.hibernate.query.NativeQuery; diff --git a/src/main/java/com/blinkfox/fenix/jpa/transformer/ColumnAnnotationTransformer.java b/src/main/java/com/blinkfox/fenix/jpa/transformer/ColumnAnnotationTransformer.java index d2c794c2..f65a5983 100644 --- a/src/main/java/com/blinkfox/fenix/jpa/transformer/ColumnAnnotationTransformer.java +++ b/src/main/java/com/blinkfox/fenix/jpa/transformer/ColumnAnnotationTransformer.java @@ -4,12 +4,12 @@ import com.blinkfox.fenix.helper.FieldHelper; import com.blinkfox.fenix.helper.StringHelper; import com.blinkfox.fenix.jpa.AbstractResultTransformer; +import jakarta.persistence.Column; import java.lang.reflect.Field; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import javax.persistence.Column; import org.springframework.beans.BeanWrapper; /** diff --git a/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java b/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java index 6f94cda4..c80b9605 100644 --- a/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java +++ b/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java @@ -10,6 +10,9 @@ import com.blinkfox.fenix.specification.predicate.FenixBooleanStaticPredicate; import com.blinkfox.fenix.specification.predicate.FenixPredicate; import com.blinkfox.fenix.specification.predicate.FenixPredicateBuilder; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.beans.PropertyDescriptor; import java.lang.annotation.Annotation; import java.lang.reflect.Field; @@ -19,9 +22,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.springframework.beans.BeanUtils; diff --git a/src/main/java/com/blinkfox/fenix/specification/annotation/Join.java b/src/main/java/com/blinkfox/fenix/specification/annotation/Join.java index 43cffe58..ad6ee597 100644 --- a/src/main/java/com/blinkfox/fenix/specification/annotation/Join.java +++ b/src/main/java/com/blinkfox/fenix/specification/annotation/Join.java @@ -3,10 +3,10 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.RetentionPolicy.RUNTIME; +import jakarta.persistence.criteria.JoinType; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.persistence.criteria.JoinType; /** * 用于“连接”({@code JOIN})查询场景的注解. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java index cbe68cc5..6897e649 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java @@ -3,19 +3,18 @@ import com.blinkfox.fenix.exception.BuildSpecificationException; import com.blinkfox.fenix.specification.handler.bean.BetweenValue; import com.blinkfox.fenix.specification.predicate.FenixBooleanStaticPredicate; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Path; +import jakarta.persistence.criteria.Predicate; +import jakarta.persistence.criteria.Predicate.BooleanOperator; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Path; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Predicate.BooleanOperator; import lombok.extern.slf4j.Slf4j; -import org.hibernate.query.criteria.internal.CriteriaBuilderImpl; /** * 用来动态构造 JPA 中 {@link Predicate} 的抽象类. @@ -252,7 +251,7 @@ protected boolean isAllowNull(Object annotation) { try { return (boolean) this.getAnnotation().getMethod("allowNull").invoke(annotation); } catch (IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { + | InvocationTargetException | NoSuchMethodException | SecurityException e) { log.error("【Fenix 错误提示】获取【@In】、【@OrIn】、【@NotIn】、【@OrNotIn】相关注解中的【allowNull】的值失败,将默认返回 false 的值.", e); return false; } diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/PredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/PredicateHandler.java index 9668d1a6..0d92f258 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/PredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/PredicateHandler.java @@ -1,8 +1,8 @@ package com.blinkfox.fenix.specification.handler; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; /** * Fenix 中用来动态构造 {@link Predicate} 条件的函数式接口. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/BetweenPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/BetweenPredicateHandler.java index 9c260b69..862117be 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/BetweenPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/BetweenPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.Between; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“区间匹配条件”({@code AND field BETWEEN ... AND ...})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/EndsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/EndsWithPredicateHandler.java index c937d288..8b220132 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/EndsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/EndsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.EndsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“按后缀模糊匹配”({@code AND field LIKE '%xx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/EqualsPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/EqualsPredicateHandler.java index 8fa74e64..3703d7af 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/EqualsPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/EqualsPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.Equals; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; 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} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanEqualPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanEqualPredicateHandler.java index 8378cbc7..b2f74702 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanEqualPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanEqualPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.GreaterThanEqual; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; 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} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanPredicateHandler.java index 3fe0ce2a..91127193 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/GreaterThanPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.GreaterThan; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; 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} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/InPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/InPredicateHandler.java index f41c3fab..d726c485 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/InPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/InPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.In; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“范围匹配条件”({@code field IN ('xxx', 'yyy')})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNotNullPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNotNullPredicateHandler.java index 0757d0e5..acaad6e6 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNotNullPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNotNullPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.IsNotNull; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“不是 NULL 条件”({@code field IS NOT NULL})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNullPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNullPredicateHandler.java index 9ab2dd25..0462b257 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNullPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/IsNullPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.IsNull; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“是 NULL 条件”({@code field IS NULL})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/JoinPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/JoinPredicateHandler.java index 8a383ccc..9166e240 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/JoinPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/JoinPredicateHandler.java @@ -3,11 +3,11 @@ import com.blinkfox.fenix.exception.BuildSpecificationException; import com.blinkfox.fenix.specification.FenixSpecification; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Join; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Join; -import javax.persistence.criteria.Predicate; /** * 构建“实体连接条件”({@code JOIN})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanEqualPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanEqualPredicateHandler.java index 2694a134..9eaa98f6 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanEqualPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanEqualPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.LessThanEqual; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; 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} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanPredicateHandler.java index f914c4ea..3720c424 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LessThanPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.LessThan; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; 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} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeInPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeInPredicateHandler.java index 09682deb..2e51d9d2 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeInPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeInPredicateHandler.java @@ -3,11 +3,11 @@ import com.blinkfox.fenix.helper.CollectionHelper; import com.blinkfox.fenix.specification.annotation.LikeIn; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“模糊条件”({@code field LIKE '%xx%' OR field LIKE '%yyy%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeOrLikePredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeOrLikePredicateHandler.java index ac78950b..8f0e9588 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeOrLikePredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikeOrLikePredicateHandler.java @@ -3,12 +3,12 @@ import com.blinkfox.fenix.exception.BuildSpecificationException; import com.blinkfox.fenix.specification.annotation.LikeOrLike; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“多种模糊条件”({@code field1 LIKE '%xx%' OR field2 LIKE '%yyy%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePatternPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePatternPredicateHandler.java index 4acc0bb6..5062b00e 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePatternPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePatternPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.LikePattern; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“按指定模式匹配”({@code field LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePredicateHandler.java index da7a4742..b0683e55 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/LikePredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.Like; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“模糊条件”({@code field LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotBetweenPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotBetweenPredicateHandler.java index ad6870b9..d6ee15dd 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotBetweenPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotBetweenPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.NotBetween; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“区间不匹配条件”({@code AND field NOT BETWEEN ... AND ...})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEndsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEndsWithPredicateHandler.java index 6d8ac5e2..6ed2af63 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEndsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEndsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.NotEndsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“按后缀模糊不匹配”({@code AND field NOT LIKE '%xx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEqualsPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEqualsPredicateHandler.java index e269b6fd..1a79aaee 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEqualsPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotEqualsPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.NotEquals; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; 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} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java index 9438aba2..4337a246 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java @@ -3,13 +3,14 @@ import com.blinkfox.fenix.specification.annotation.NotIn; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; import com.blinkfox.fenix.specification.predicate.FenixBooleanStaticPredicate; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.Collection; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; -import org.hibernate.query.criteria.internal.CriteriaBuilderImpl; +import org.hibernate.query.sqm.NodeBuilder; +import org.hibernate.query.sqm.tree.predicate.SqmBooleanExpressionPredicate; /** * 构建“范围不匹配条件”({@code field NOT IN ('xxx', 'yyy')})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePatternPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePatternPredicateHandler.java index 925289ff..696be1a6 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePatternPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePatternPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.NotLikePattern; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“按指定模式不匹配”({@code field LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePredicateHandler.java index 67de3245..4fc8a685 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotLikePredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.NotLike; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“模糊不匹配条件”({@code field NOT LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotStartsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotStartsWithPredicateHandler.java index bc7c6755..923305cc 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotStartsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotStartsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.NotStartsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“按前缀模糊不匹配”({@code AND field NOT LIKE 'xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrBetweenPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrBetweenPredicateHandler.java index 5a358c18..b4d96165 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrBetweenPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrBetweenPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrBetween; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句区间匹配条件”({@code AND field BETWEEN ... AND ...})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEndsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEndsWithPredicateHandler.java index 27b0c339..edc6d82c 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEndsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEndsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrEndsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句按后缀模糊匹配”({@code OR field LIKE '%xx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEqualsPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEqualsPredicateHandler.java index 85cdb599..a963c22a 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEqualsPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrEqualsPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrEquals; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者等于条件”({@code OR field = 'xxx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanEqualPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanEqualPredicateHandler.java index 772716e1..d6db3cfa 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanEqualPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanEqualPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrGreaterThanEqual; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者大于等于条件”({@code OR field >= 'xxx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanPredicateHandler.java index 7ef0cc67..1fa24c75 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrGreaterThanPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrGreaterThan; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者大于条件”({@code OR field > 'xxx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrInPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrInPredicateHandler.java index 6bf0730f..bae339f9 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrInPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrInPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrIn; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者范围匹配条件”({@code OR field IN ('xxx', 'yyy')})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNotNullPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNotNullPredicateHandler.java index 7ee86a61..9118d2e7 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNotNullPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNotNullPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrIsNotNull; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者不是 NULL 条件”({@code OR field IS NOT NULL})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNullPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNullPredicateHandler.java index 3a4f7b06..f2faa2b3 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNullPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrIsNullPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrIsNull; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者是 NULL 条件”({@code OR field IS NULL})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanEqualPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanEqualPredicateHandler.java index 84ba3e74..23c02dbe 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanEqualPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanEqualPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrLessThanEqual; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者小于等于条件”({@code OR field <= 'xxx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanPredicateHandler.java index c2841b9f..007c50fb 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLessThanPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrLessThan; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者小于条件”({@code OR field < 'xxx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikeOrLikePredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikeOrLikePredicateHandler.java index 23b901af..cb7e7ae0 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikeOrLikePredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikeOrLikePredicateHandler.java @@ -3,12 +3,12 @@ import com.blinkfox.fenix.exception.BuildSpecificationException; import com.blinkfox.fenix.specification.annotation.OrLikeOrLike; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者多种模糊条件”({@code OR (field1 LIKE '%xx%' OR field2 LIKE '%yyy%')})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePatternPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePatternPredicateHandler.java index 48e4b437..3bd6fe80 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePatternPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePatternPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrLikePattern; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句按指定模式匹配”({@code field LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePredicateHandler.java index 4b02dc7b..7cd84390 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrLikePredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrLike; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者模糊条件”({@code OR field LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotBetweenPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotBetweenPredicateHandler.java index 8d8d9af4..9090ccf8 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotBetweenPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotBetweenPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrNotBetween; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句区间不匹配条件”({@code AND field NOT BETWEEN ... AND ...})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEndsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEndsWithPredicateHandler.java index c59c42dd..7803a343 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEndsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEndsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrNotEndsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句按后缀模糊匹配”({@code OR field NOT LIKE '%xx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEqualsPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEqualsPredicateHandler.java index 91e74b75..317628d6 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEqualsPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotEqualsPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrNotEquals; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者不等于条件”({@code OR field <> 'xxx'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotInPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotInPredicateHandler.java index cb482cc2..8c4208da 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotInPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotInPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrNotIn; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者不匹配范围条件”({@code OR field NOT IN ('xxx', 'yyy')})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePatternPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePatternPredicateHandler.java index 46b1a73a..530e0e30 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePatternPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePatternPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrNotLikePattern; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句按指定模式不匹配”({@code field LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePredicateHandler.java index 23b5f18e..f459c48b 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotLikePredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrNotLike; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或者模糊不匹配条件”({@code OR field NOT LIKE '%xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotStartsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotStartsWithPredicateHandler.java index f2272d7c..e5883fd1 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotStartsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrNotStartsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrNotStartsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句按前缀模糊不匹配”({@code OR field LIKE 'xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrStartsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrStartsWithPredicateHandler.java index d9241343..20f16128 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrStartsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/OrStartsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.OrStartsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“或语句按前缀模糊匹配”({@code OR field LIKE 'xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/StartsWithPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/StartsWithPredicateHandler.java index 8cd28ed4..fb2355b4 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/StartsWithPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/StartsWithPredicateHandler.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.specification.annotation.StartsWith; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; /** * 构建“按前缀模糊匹配”({@code AND field LIKE 'xx%'})场景的 {@link Predicate} 处理器. diff --git a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java b/src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java index e7b03245..6233de70 100644 --- a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java +++ b/src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java @@ -1,12 +1,9 @@ package com.blinkfox.fenix.specification.predicate; +import jakarta.persistence.criteria.Predicate; +import jakarta.persistence.criteria.Predicate.BooleanOperator; import lombok.Getter; import lombok.Setter; -import org.hibernate.query.criteria.internal.CriteriaBuilderImpl; -import org.hibernate.query.criteria.internal.ParameterRegistry; -import org.hibernate.query.criteria.internal.compile.RenderingContext; -import org.hibernate.query.criteria.internal.predicate.AbstractSimplePredicate; -import org.hibernate.query.criteria.internal.predicate.BooleanStaticAssertionPredicate; /** * {@link BooleanStaticAssertionPredicate} 的装饰类,主要用来返回永真和永假条件. @@ -27,7 +24,7 @@ public class FenixBooleanStaticPredicate extends AbstractSimplePredicate { @Getter @Setter - private BooleanOperator operator; + private Predicate.BooleanOperator operator; /** * 构造方法. diff --git a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicate.java b/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicate.java index 24e59445..dcffe735 100644 --- a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicate.java +++ b/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicate.java @@ -1,7 +1,7 @@ package com.blinkfox.fenix.specification.predicate; +import jakarta.persistence.criteria.Predicate; import java.util.List; -import javax.persistence.criteria.Predicate; /** * Fenix 中使用 {@link FenixPredicateBuilder} 构建器来动态构造多个 {@link Predicate} 条件的函数式接口. diff --git a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicateBuilder.java b/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicateBuilder.java index 4cdd955d..1186b0ee 100644 --- a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicateBuilder.java +++ b/src/main/java/com/blinkfox/fenix/specification/predicate/FenixPredicateBuilder.java @@ -42,13 +42,13 @@ import com.blinkfox.fenix.specification.handler.impl.OrNotStartsWithPredicateHandler; import com.blinkfox.fenix.specification.handler.impl.OrStartsWithPredicateHandler; import com.blinkfox.fenix.specification.handler.impl.StartsWithPredicateHandler; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Predicate; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Predicate; import lombok.Getter; /** diff --git a/src/test/java/com/blinkfox/fenix/FenixTestApplication.java b/src/test/java/com/blinkfox/fenix/FenixTestApplication.java index 9421b25a..4831c22a 100644 --- a/src/test/java/com/blinkfox/fenix/FenixTestApplication.java +++ b/src/test/java/com/blinkfox/fenix/FenixTestApplication.java @@ -1,7 +1,7 @@ package com.blinkfox.fenix; import com.blinkfox.fenix.jpa.FenixJpaRepositoryFactoryBean; -import javax.persistence.EntityManagerFactory; +import jakarta.persistence.EntityManagerFactory; import javax.sql.DataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; diff --git a/src/test/java/com/blinkfox/fenix/entity/Blog.java b/src/test/java/com/blinkfox/fenix/entity/Blog.java index 3a86ad7f..5dcb92dd 100755 --- a/src/test/java/com/blinkfox/fenix/entity/Blog.java +++ b/src/test/java/com/blinkfox/fenix/entity/Blog.java @@ -1,10 +1,10 @@ package com.blinkfox.fenix.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/src/test/java/com/blinkfox/fenix/entity/Book.java b/src/test/java/com/blinkfox/fenix/entity/Book.java index a8af4511..807a543e 100644 --- a/src/test/java/com/blinkfox/fenix/entity/Book.java +++ b/src/test/java/com/blinkfox/fenix/entity/Book.java @@ -1,10 +1,10 @@ package com.blinkfox.fenix.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/src/test/java/com/blinkfox/fenix/entity/EntityOne.java b/src/test/java/com/blinkfox/fenix/entity/EntityOne.java index 6d26afa4..d8d6bb3e 100644 --- a/src/test/java/com/blinkfox/fenix/entity/EntityOne.java +++ b/src/test/java/com/blinkfox/fenix/entity/EntityOne.java @@ -1,10 +1,10 @@ package com.blinkfox.fenix.entity; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/src/test/java/com/blinkfox/fenix/entity/EntityThree.java b/src/test/java/com/blinkfox/fenix/entity/EntityThree.java index 8c66a0d4..636331fb 100644 --- a/src/test/java/com/blinkfox/fenix/entity/EntityThree.java +++ b/src/test/java/com/blinkfox/fenix/entity/EntityThree.java @@ -1,10 +1,10 @@ package com.blinkfox.fenix.entity; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/src/test/java/com/blinkfox/fenix/entity/EntityTwo.java b/src/test/java/com/blinkfox/fenix/entity/EntityTwo.java index 078f1c70..4e61828d 100644 --- a/src/test/java/com/blinkfox/fenix/entity/EntityTwo.java +++ b/src/test/java/com/blinkfox/fenix/entity/EntityTwo.java @@ -1,10 +1,10 @@ package com.blinkfox.fenix.entity; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/src/test/java/com/blinkfox/fenix/entity/School.java b/src/test/java/com/blinkfox/fenix/entity/School.java index aab830eb..01aa37bc 100644 --- a/src/test/java/com/blinkfox/fenix/entity/School.java +++ b/src/test/java/com/blinkfox/fenix/entity/School.java @@ -1,10 +1,10 @@ package com.blinkfox.fenix.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; diff --git a/src/test/java/com/blinkfox/fenix/entity/User.java b/src/test/java/com/blinkfox/fenix/entity/User.java index fd016cfd..b10157ca 100644 --- a/src/test/java/com/blinkfox/fenix/entity/User.java +++ b/src/test/java/com/blinkfox/fenix/entity/User.java @@ -1,10 +1,10 @@ package com.blinkfox.fenix.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/entity/ar/ArCrud.java b/src/test/java/com/blinkfox/fenix/entity/ar/ArCrud.java index 77dd3f2e..f4fb8d1a 100644 --- a/src/test/java/com/blinkfox/fenix/entity/ar/ArCrud.java +++ b/src/test/java/com/blinkfox/fenix/entity/ar/ArCrud.java @@ -3,13 +3,13 @@ import com.blinkfox.fenix.ar.repo.CrudModel; import com.blinkfox.fenix.enums.StatusEnum; import com.blinkfox.fenix.repository.ar.ArCrudRepository; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.time.LocalDateTime; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixJpa.java b/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixJpa.java index 3150db12..b55ac84f 100644 --- a/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixJpa.java +++ b/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixJpa.java @@ -3,11 +3,11 @@ import com.blinkfox.fenix.ar.repo.FenixJpaModel; import com.blinkfox.fenix.ar.repo.JpaModel; import com.blinkfox.fenix.repository.ar.ArFenixJpaRepository; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixSpec.java b/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixSpec.java index d27478ae..2e86110c 100644 --- a/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixSpec.java +++ b/src/test/java/com/blinkfox/fenix/entity/ar/ArFenixSpec.java @@ -3,10 +3,10 @@ import com.blinkfox.fenix.ar.repo.JpaModel; import com.blinkfox.fenix.ar.spec.FenixSpecModel; import com.blinkfox.fenix.repository.ar.ArFenixSpecRepository; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/entity/ar/ArJpa.java b/src/test/java/com/blinkfox/fenix/entity/ar/ArJpa.java index 3976ee9b..5c90c4ea 100644 --- a/src/test/java/com/blinkfox/fenix/entity/ar/ArJpa.java +++ b/src/test/java/com/blinkfox/fenix/entity/ar/ArJpa.java @@ -2,11 +2,11 @@ import com.blinkfox.fenix.ar.repo.JpaModel; import com.blinkfox.fenix.repository.ar.ArJpaRepository; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/entity/ar/ArPageSort.java b/src/test/java/com/blinkfox/fenix/entity/ar/ArPageSort.java index 7a2418b3..efc62a3f 100644 --- a/src/test/java/com/blinkfox/fenix/entity/ar/ArPageSort.java +++ b/src/test/java/com/blinkfox/fenix/entity/ar/ArPageSort.java @@ -1,13 +1,12 @@ package com.blinkfox.fenix.entity.ar; import com.blinkfox.fenix.ar.repo.JpaModel; -import com.blinkfox.fenix.ar.repo.PagingAndSortingModel; import com.blinkfox.fenix.repository.ar.ArPageSortRepository; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; @@ -26,7 +25,7 @@ @Entity @Proxy(lazy = false) @Table(name = "t_ar_page_sort") -public class ArPageSort implements PagingAndSortingModel { +public class ArPageSort implements JpaModel { /** * ID. diff --git a/src/test/java/com/blinkfox/fenix/entity/transformer/PrefixUnderscore.java b/src/test/java/com/blinkfox/fenix/entity/transformer/PrefixUnderscore.java index afe5149f..e0472b5c 100644 --- a/src/test/java/com/blinkfox/fenix/entity/transformer/PrefixUnderscore.java +++ b/src/test/java/com/blinkfox/fenix/entity/transformer/PrefixUnderscore.java @@ -1,12 +1,12 @@ package com.blinkfox.fenix.entity.transformer; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.time.LocalDateTime; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/entity/transformer/UnderscoreEntity.java b/src/test/java/com/blinkfox/fenix/entity/transformer/UnderscoreEntity.java index 7ae33660..e4d062ab 100644 --- a/src/test/java/com/blinkfox/fenix/entity/transformer/UnderscoreEntity.java +++ b/src/test/java/com/blinkfox/fenix/entity/transformer/UnderscoreEntity.java @@ -1,12 +1,12 @@ package com.blinkfox.fenix.entity.transformer; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.time.LocalDateTime; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/repository/BlogRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/BlogRepositoryTest.java index 70ec0d73..8996b3ce 100644 --- a/src/test/java/com/blinkfox/fenix/repository/BlogRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/BlogRepositoryTest.java @@ -12,13 +12,13 @@ import com.blinkfox.fenix.vo.UserBlogDto; import com.blinkfox.fenix.vo.UserBlogInfo; import com.blinkfox.fenix.vo.UserBlogProjection; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import java.io.IOException; import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; diff --git a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryMatchTest.java b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryMatchTest.java index 11054a72..38d6ace0 100644 --- a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryMatchTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryMatchTest.java @@ -5,9 +5,9 @@ import com.blinkfox.fenix.entity.Book; import com.blinkfox.fenix.specification.handler.bean.BetweenValue; import com.blinkfox.fenix.vo.param.BookMatch; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.List; -import javax.annotation.PostConstruct; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryPredicateTest.java b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryPredicateTest.java index e679380b..a9c1d21f 100644 --- a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryPredicateTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryPredicateTest.java @@ -6,12 +6,12 @@ import com.blinkfox.fenix.helper.CollectionHelper; import com.blinkfox.fenix.helper.StringHelper; import com.blinkfox.fenix.specification.FenixSpecification; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.PostConstruct; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -57,7 +57,7 @@ public class BookRepositoryPredicateTest { private BookRepository bookRepository; /** - * 从资源文件的中读取数据,初始化保存起来,便于后续读取或操作. + * 从资源文件中读取数据,初始化保存起来,便于后续读取或操作. */ @PostConstruct public void init() throws IOException { diff --git a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryTest.java index 676a3124..d166f484 100644 --- a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryTest.java @@ -6,9 +6,9 @@ import com.blinkfox.fenix.helper.StringHelper; import com.blinkfox.fenix.specification.FenixSpecification; import com.blinkfox.fenix.vo.param.BookParam; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.List; -import javax.annotation.PostConstruct; import lombok.Setter; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryUnitTest.java b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryUnitTest.java index 28847ce2..5f1f3fc0 100644 --- a/src/test/java/com/blinkfox/fenix/repository/BookRepositoryUnitTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/BookRepositoryUnitTest.java @@ -9,6 +9,7 @@ import com.blinkfox.fenix.vo.param.BookParam; import com.blinkfox.fenix.vo.param.BookParam2; import com.blinkfox.fenix.vo.param.BookParam3; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -16,7 +17,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.annotation.PostConstruct; import lombok.Setter; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/EntityOneRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/EntityOneRepositoryTest.java index 69257821..875648bf 100644 --- a/src/test/java/com/blinkfox/fenix/repository/EntityOneRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/EntityOneRepositoryTest.java @@ -2,9 +2,9 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.EntityOne; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import javax.annotation.Resource; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/com/blinkfox/fenix/repository/EntityThreeRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/EntityThreeRepositoryTest.java index f41acbc5..5b6289fe 100644 --- a/src/test/java/com/blinkfox/fenix/repository/EntityThreeRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/EntityThreeRepositoryTest.java @@ -2,9 +2,9 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.EntityThree; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import javax.annotation.Resource; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/com/blinkfox/fenix/repository/EntityTwoRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/EntityTwoRepositoryTest.java index ae015cab..aaa4c54c 100644 --- a/src/test/java/com/blinkfox/fenix/repository/EntityTwoRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/EntityTwoRepositoryTest.java @@ -2,9 +2,9 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.EntityTwo; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import javax.annotation.Resource; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/com/blinkfox/fenix/repository/FenixBookRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/FenixBookRepositoryTest.java index 2ff6d67a..64aef20f 100644 --- a/src/test/java/com/blinkfox/fenix/repository/FenixBookRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/FenixBookRepositoryTest.java @@ -5,13 +5,13 @@ import com.blinkfox.fenix.entity.Book; import com.blinkfox.fenix.specification.handler.bean.BetweenValue; import com.blinkfox.fenix.vo.param.BookSearch; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import javax.annotation.PostConstruct; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/src/test/java/com/blinkfox/fenix/repository/FenixSchoolRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/FenixSchoolRepositoryTest.java index c3174fb2..b7448347 100644 --- a/src/test/java/com/blinkfox/fenix/repository/FenixSchoolRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/FenixSchoolRepositoryTest.java @@ -3,6 +3,7 @@ import com.alibaba.fastjson.JSON; import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.School; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.ArrayList; import java.util.Date; @@ -11,7 +12,6 @@ import java.util.Map; import java.util.Optional; import java.util.UUID; -import javax.annotation.PostConstruct; import org.junit.After; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/src/test/java/com/blinkfox/fenix/repository/UnitTestRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/UnitTestRepositoryTest.java index 072dca21..86f13fd2 100644 --- a/src/test/java/com/blinkfox/fenix/repository/UnitTestRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/UnitTestRepositoryTest.java @@ -4,6 +4,7 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.config.FenixConfigManager; import com.blinkfox.fenix.entity.User; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; @@ -13,7 +14,6 @@ import java.util.Map; import java.util.Optional; import java.util.Set; -import javax.annotation.PostConstruct; import lombok.Setter; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/UserRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/UserRepositoryTest.java index d94ac496..bcafef88 100644 --- a/src/test/java/com/blinkfox/fenix/repository/UserRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/UserRepositoryTest.java @@ -6,11 +6,11 @@ import com.blinkfox.fenix.config.FenixConfigManager; import com.blinkfox.fenix.entity.User; import com.blinkfox.fenix.jpa.QueryFenix; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.PostConstruct; import lombok.Setter; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepository.java b/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepository.java index 32c84afb..a001c9ea 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepository.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepository.java @@ -16,6 +16,12 @@ @Repository public interface ArCrudRepository extends CrudRepository { + /** + * 使用 Fenix 根据 id 查询. + * + * @param id 主键 + * @return 数据 + */ @QueryFenix ArCrud findByIdWithFenix(@Param("id") String id); diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepositoryTest.java index 3b9111e9..34a42a00 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/ArCrudRepositoryTest.java @@ -3,13 +3,13 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.ar.ArCrud; import com.blinkfox.fenix.enums.StatusEnum; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.Resource; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Optional; -import javax.annotation.PostConstruct; -import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixJpaRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixJpaRepositoryTest.java index 3336c35e..f16e7975 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixJpaRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixJpaRepositoryTest.java @@ -2,11 +2,11 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.ar.ArFenixJpa; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import javax.annotation.PostConstruct; -import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixSpecRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixSpecRepositoryTest.java index f4aa0928..a38306f6 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixSpecRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/ArFenixSpecRepositoryTest.java @@ -6,12 +6,12 @@ import com.blinkfox.fenix.id.IdWorker; import com.blinkfox.fenix.specification.handler.bean.BetweenValue; import com.blinkfox.fenix.vo.param.ArSpecParam; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; -import javax.annotation.PostConstruct; -import javax.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/ArJpaRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/ar/ArJpaRepositoryTest.java index 913f6c62..de414750 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/ArJpaRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/ArJpaRepositoryTest.java @@ -2,10 +2,10 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.ar.ArJpa; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import javax.annotation.PostConstruct; -import javax.annotation.Resource; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepository.java b/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepository.java index db69c299..60252b29 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepository.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepository.java @@ -1,7 +1,7 @@ package com.blinkfox.fenix.repository.ar; import com.blinkfox.fenix.entity.ar.ArPageSort; -import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** @@ -11,6 +11,6 @@ * @since 2.7.0 */ @Repository -public interface ArPageSortRepository extends PagingAndSortingRepository { +public interface ArPageSortRepository extends JpaRepository { } diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepositoryTest.java index 309c9e5e..d5b382bb 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/ArPageSortRepositoryTest.java @@ -2,8 +2,8 @@ import com.blinkfox.fenix.FenixTestApplication; import com.blinkfox.fenix.entity.ar.ArPageSort; +import jakarta.annotation.PostConstruct; import java.util.Optional; -import javax.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/blinkfox/fenix/repository/ar/BaseRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/ar/BaseRepositoryTest.java index 6f2c803e..ed4338c0 100644 --- a/src/test/java/com/blinkfox/fenix/repository/ar/BaseRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/ar/BaseRepositoryTest.java @@ -3,7 +3,7 @@ import com.blinkfox.fenix.ar.RepositoryModelContext; import com.blinkfox.fenix.config.FenixConfigManager; import com.blinkfox.fenix.exception.FenixException; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import lombok.Setter; import org.springframework.context.ApplicationContext; diff --git a/src/test/java/com/blinkfox/fenix/repository/transformer/PrefixUnderscoreRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/transformer/PrefixUnderscoreRepositoryTest.java index 797858cd..6277535a 100644 --- a/src/test/java/com/blinkfox/fenix/repository/transformer/PrefixUnderscoreRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/transformer/PrefixUnderscoreRepositoryTest.java @@ -4,13 +4,13 @@ import com.blinkfox.fenix.config.FenixConfigManager; import com.blinkfox.fenix.entity.transformer.PrefixUnderscore; import com.blinkfox.fenix.vo.transformer.PrefixUnderscoreVo; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.annotation.Resource; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; import java.util.List; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.annotation.Resource; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; diff --git a/src/test/java/com/blinkfox/fenix/repository/transformer/UnderscoreEntityRepositoryTest.java b/src/test/java/com/blinkfox/fenix/repository/transformer/UnderscoreEntityRepositoryTest.java index a6a8b726..3b43c1dc 100644 --- a/src/test/java/com/blinkfox/fenix/repository/transformer/UnderscoreEntityRepositoryTest.java +++ b/src/test/java/com/blinkfox/fenix/repository/transformer/UnderscoreEntityRepositoryTest.java @@ -5,13 +5,13 @@ import com.blinkfox.fenix.entity.transformer.UnderscoreEntity; import com.blinkfox.fenix.vo.transformer.UnderscoreColumnVo; import com.blinkfox.fenix.vo.transformer.UnderscoreVo; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.annotation.Resource; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; import java.util.List; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.annotation.Resource; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; diff --git a/src/test/java/com/blinkfox/fenix/vo/transformer/ParentColumnVo.java b/src/test/java/com/blinkfox/fenix/vo/transformer/ParentColumnVo.java index 52d5911b..2b7bf630 100644 --- a/src/test/java/com/blinkfox/fenix/vo/transformer/ParentColumnVo.java +++ b/src/test/java/com/blinkfox/fenix/vo/transformer/ParentColumnVo.java @@ -1,7 +1,7 @@ package com.blinkfox.fenix.vo.transformer; +import jakarta.persistence.Column; import java.time.LocalDateTime; -import javax.persistence.Column; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; diff --git a/src/test/java/com/blinkfox/fenix/vo/transformer/UnderscoreColumnVo.java b/src/test/java/com/blinkfox/fenix/vo/transformer/UnderscoreColumnVo.java index 3b221275..4128e829 100644 --- a/src/test/java/com/blinkfox/fenix/vo/transformer/UnderscoreColumnVo.java +++ b/src/test/java/com/blinkfox/fenix/vo/transformer/UnderscoreColumnVo.java @@ -1,7 +1,7 @@ package com.blinkfox.fenix.vo.transformer; +import jakarta.persistence.Column; import java.util.Date; -import javax.persistence.Column; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; From f351aa0a95155105142d6cf17547e13bd468d28b Mon Sep 17 00:00:00 2001 From: imhansai Date: Mon, 2 Jan 2023 11:31:55 +0800 Subject: [PATCH 2/5] =?UTF-8?q?spring-data-jpa=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=88=B0=203.0.0;hibernate-core=20=E5=8D=87=E7=BA=A7=E5=88=B0?= =?UTF-8?q?=206.1.6.Final=EF=BC=9B=E4=BB=A5=E5=8F=8A=E9=9A=8F=E4=B9=8B?= =?UTF-8?q?=E8=80=8C=E6=9D=A5=E7=9A=84=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../specification/FenixSpecification.java | 25 +------- .../handler/AbstractPredicateHandler.java | 9 +-- .../handler/impl/NotInPredicateHandler.java | 10 +-- .../FenixBooleanStaticPredicate.java | 62 ------------------- 5 files changed, 4 insertions(+), 104 deletions(-) delete mode 100644 src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java diff --git a/pom.xml b/pom.xml index b1b5d553..d2c58c55 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ true - org.hibernate + org.hibernate.orm hibernate-core 6.1.6.Final true diff --git a/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java b/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java index c80b9605..c9304cf9 100644 --- a/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java +++ b/src/main/java/com/blinkfox/fenix/specification/FenixSpecification.java @@ -7,7 +7,6 @@ import com.blinkfox.fenix.helper.StringHelper; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; import com.blinkfox.fenix.specification.handler.bean.Pair; -import com.blinkfox.fenix.specification.predicate.FenixBooleanStaticPredicate; import com.blinkfox.fenix.specification.predicate.FenixPredicate; import com.blinkfox.fenix.specification.predicate.FenixPredicateBuilder; import jakarta.persistence.criteria.CriteriaBuilder; @@ -126,7 +125,7 @@ public static List beanParamToPredicate( AbstractPredicateHandler handler = specificationHandlerMap.get(annotation.annotationType()); if (handler != null) { Predicate predicate = buildPredicate(beanParam, field, criteriaBuilder, from, handler); - if (predicate != null && isValid(predicate)) { + if (predicate != null) { predicates.add(predicate); } } @@ -250,26 +249,4 @@ private static Predicate buildDefaultPredicate(CriteriaBuilder criteriaBu } } - /** - * 校验 {@link Predicate} 是否有效,有的 {@code predicate} 可以不用解析. - * - * @param predicate {@link Predicate} 实例 - * @return 布尔值 - */ - private static boolean isValid(Predicate predicate) { - return !(predicate instanceof FenixBooleanStaticPredicate) || validateBooleanPredicate(predicate); - } - - /** - * 校验布尔类型的 {@link Predicate} 是否有效. - * - * @param predicate {@link Predicate} 实例 - * @return 布尔值 - */ - private static boolean validateBooleanPredicate(Predicate predicate) { - FenixBooleanStaticPredicate boolPredicate = (FenixBooleanStaticPredicate) predicate; - return !((boolPredicate.getAssertedValue() && predicate.getOperator() == Predicate.BooleanOperator.AND) - || (!boolPredicate.getAssertedValue() && predicate.getOperator() == Predicate.BooleanOperator.OR)); - } - } diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java index 6897e649..b9f54d06 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java @@ -2,12 +2,10 @@ import com.blinkfox.fenix.exception.BuildSpecificationException; import com.blinkfox.fenix.specification.handler.bean.BetweenValue; -import com.blinkfox.fenix.specification.predicate.FenixBooleanStaticPredicate; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.From; import jakarta.persistence.criteria.Path; import jakarta.persistence.criteria.Predicate; -import jakarta.persistence.criteria.Predicate.BooleanOperator; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; @@ -228,12 +226,7 @@ protected Predicate buildInPredicate( if (value instanceof Collection) { Collection list = (Collection) value; - if (list.isEmpty()) { - return new FenixBooleanStaticPredicate( - (CriteriaBuilderImpl) criteriaBuilder, true, BooleanOperator.AND); - } else { - list.forEach(in::value); - } + list.forEach(in::value); } else { in.value(value); } diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java index 4337a246..3cda3145 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java @@ -2,15 +2,12 @@ import com.blinkfox.fenix.specification.annotation.NotIn; import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; -import com.blinkfox.fenix.specification.predicate.FenixBooleanStaticPredicate; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.From; import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.Collection; -import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.tree.predicate.SqmBooleanExpressionPredicate; /** * 构建“范围不匹配条件”({@code field NOT IN ('xxx', 'yyy')})场景的 {@link Predicate} 处理器. @@ -40,12 +37,7 @@ public Predicate buildPredicate( if (value instanceof Collection) { Collection list = (Collection) value; - if (list.isEmpty()) { - return new FenixBooleanStaticPredicate( - (CriteriaBuilderImpl) criteriaBuilder, true, Predicate.BooleanOperator.AND); - } else { - list.forEach(in::value); - } + list.forEach(in::value); } else { in.value(value); } diff --git a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java b/src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java deleted file mode 100644 index 6233de70..00000000 --- a/src/main/java/com/blinkfox/fenix/specification/predicate/FenixBooleanStaticPredicate.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.blinkfox.fenix.specification.predicate; - -import jakarta.persistence.criteria.Predicate; -import jakarta.persistence.criteria.Predicate.BooleanOperator; -import lombok.Getter; -import lombok.Setter; - -/** - * {@link BooleanStaticAssertionPredicate} 的装饰类,主要用来返回永真和永假条件. - * - *

本库会根据该类的属性去除一些不必要的永真永假条件该类主要用于处理 {@code @In} 条件中传入了大小为 {@code 0} 的集合。 - * 建议使用者在调用框架之前对空集合进行过滤.

- * - * @author YangWenpeng on 2019-12-17 - * @author blinkfox 2020-01-14 - * @since v2.2.0 - */ -public class FenixBooleanStaticPredicate extends AbstractSimplePredicate { - - private static final long serialVersionUID = 3479513712737513954L; - - @Getter - private final BooleanStaticAssertionPredicate predicate; - - @Getter - @Setter - private Predicate.BooleanOperator operator; - - /** - * 构造方法. - * - * @param criteriaBuilder {@link CriteriaBuilderImpl} 实例 - * @param assertedValue 布尔值 - * @param operator {@link BooleanOperator} 实例 - */ - public FenixBooleanStaticPredicate( - CriteriaBuilderImpl criteriaBuilder, Boolean assertedValue, BooleanOperator operator) { - super(criteriaBuilder); - this.predicate = new BooleanStaticAssertionPredicate(criteriaBuilder, assertedValue); - this.operator = operator; - } - - @Override - public String render(boolean isNegated, RenderingContext renderingContext) { - return predicate.render(isNegated, renderingContext); - } - - @Override - public void registerParameters(ParameterRegistry registry) { - predicate.registerParameters(registry); - } - - /** - * 获取断言的布尔值结果值. - * - * @return 布尔值结果 - */ - public boolean getAssertedValue() { - return predicate.getAssertedValue(); - } - -} From 172b004d22518eb14b4197e20b35c704a99b3340 Mon Sep 17 00:00:00 2001 From: imhansai Date: Mon, 2 Jan 2023 21:23:16 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=A4=84=E7=90=86=20in=20=E9=9B=86?= =?UTF-8?q?=E5=90=88=E6=97=B6=E6=9D=A1=E4=BB=B6=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5;=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 兼容之前的代码意图.即如果集合为空,则应用永真条件 --- pom.xml | 14 +++++++------- .../handler/AbstractPredicateHandler.java | 6 +++++- .../handler/impl/NotInPredicateHandler.java | 7 ++++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index d2c58c55..8531ad0d 100644 --- a/pom.xml +++ b/pom.xml @@ -56,9 +56,9 @@ true
- org.slf4j - slf4j-simple - 1.7.36 + ch.qos.logback + logback-classic + 1.4.5 true @@ -78,7 +78,7 @@ org.javassist javassist - 3.28.0-GA + 3.29.2-GA xml-apis @@ -96,7 +96,7 @@ jaxen jaxen - 1.2.0 + 2.0.0 @@ -109,13 +109,13 @@ org.springframework spring-test - 5.3.23 + 6.0.0 test org.hsqldb hsqldb - 2.5.1 + 2.7.1 test diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java index b9f54d06..a878ff43 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/AbstractPredicateHandler.java @@ -226,7 +226,11 @@ protected Predicate buildInPredicate( if (value instanceof Collection) { Collection list = (Collection) value; - list.forEach(in::value); + if (list.isEmpty()) { + return criteriaBuilder.conjunction(); + } else { + list.forEach(in::value); + } } else { in.value(value); } diff --git a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java index 3cda3145..9fe91016 100644 --- a/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java +++ b/src/main/java/com/blinkfox/fenix/specification/handler/impl/NotInPredicateHandler.java @@ -4,6 +4,7 @@ import com.blinkfox.fenix.specification.handler.AbstractPredicateHandler; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.From; +import jakarta.persistence.criteria.Path; import jakarta.persistence.criteria.Predicate; import java.lang.annotation.Annotation; import java.util.Arrays; @@ -32,11 +33,15 @@ public Predicate buildPredicate( @Override public Predicate buildPredicate( CriteriaBuilder criteriaBuilder, From from, String fieldName, Object value) { - CriteriaBuilder.In in = criteriaBuilder.in(from.get(fieldName)); + Path path = from.get(fieldName); + CriteriaBuilder.In in = criteriaBuilder.in(path); value = value.getClass().isArray() ? Arrays.asList((Object[]) value) : value; if (value instanceof Collection) { Collection list = (Collection) value; + if (list.isEmpty()) { + return criteriaBuilder.conjunction(); + } list.forEach(in::value); } else { in.value(value); From 342a9f65f679b85dc35eb364b063ea1dd3108fe3 Mon Sep 17 00:00:00 2001 From: imhansai Date: Mon, 2 Jan 2023 21:37:27 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E4=B8=BA=203.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- docs/_coverpage.md | 2 +- docs/quick-install.md | 8 ++++---- pom.xml | 2 +- .../com/blinkfox/fenix/config/FenixConfigManager.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4a0b919d..182ec663 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
fenix logo
-[![Build Status](https://secure.travis-ci.org/blinkfox/fenix.svg)](https://travis-ci.org/blinkfox/fenix) [![Javadocs](http://www.javadoc.io/badge/com.blinkfox/fenix.svg)](http://www.javadoc.io/doc/com.blinkfox/fenix) [![GitHub license](https://img.shields.io/github/license/blinkfox/fenix.svg)](https://github.com/blinkfox/fenix/blob/develop/LICENSE) [![fenix](https://img.shields.io/badge/fenix-v2.7.0-blue)](https://search.maven.org/artifact/com.blinkfox/fenix/2.7.0/jar) [![fenix starter](https://img.shields.io/badge/fenix%20spring%20boot%20starter-v2.7.0-blue)](https://search.maven.org/artifact/com.blinkfox/fenix-spring-boot-starter/2.7.0/jar) [![codecov](https://codecov.io/gh/blinkfox/fenix/branch/develop/graph/badge.svg)](https://codecov.io/gh/blinkfox/fenix) +[![Build Status](https://secure.travis-ci.org/blinkfox/fenix.svg)](https://travis-ci.org/blinkfox/fenix) [![Javadocs](http://www.javadoc.io/badge/com.blinkfox/fenix.svg)](http://www.javadoc.io/doc/com.blinkfox/fenix) [![GitHub license](https://img.shields.io/github/license/blinkfox/fenix.svg)](https://github.com/blinkfox/fenix/blob/develop/LICENSE) [![fenix](https://img.shields.io/badge/fenix-v3.0.0-blue)](https://search.maven.org/artifact/com.blinkfox/fenix/3.0.0/jar) [![fenix starter](https://img.shields.io/badge/fenix%20spring%20boot%20starter-v3.0.0-blue)](https://search.maven.org/artifact/com.blinkfox/fenix-spring-boot-starter/3.0.0/jar) [![codecov](https://codecov.io/gh/blinkfox/fenix/branch/develop/graph/badge.svg)](https://codecov.io/gh/blinkfox/fenix) > [🔥 Fenix](https://github.com/blinkfox/fenix)(菲尼克斯)是一个为了解决复杂动态 SQL (`JPQL`) 而生的 `Spring Data JPA` 扩展库,能辅助开发者更方便快捷的书写复杂、动态且易于维护的 SQL,支持 ActiveRecord 模式和多种查询方式。 @@ -40,14 +40,14 @@ com.blinkfox fenix-spring-boot-starter - 2.7.0 + 3.0.0 ``` ### 🌵 2. Gradle ```bash -compile 'com.blinkfox:fenix-spring-boot-starter:2.7.0' +compile 'com.blinkfox:fenix-spring-boot-starter:3.0.0' ``` ### 🏕️ 3. 激活 Fenix (@EnableFenix) diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 1e9290c4..4b7b6560 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@ ![logo](assets/images/logo.png) -# Fenix 2.7.0 +# Fenix 3.0.0 > 为解决复杂动态 SQL 而生的 Spring Data JPA 扩展库 diff --git a/docs/quick-install.md b/docs/quick-install.md index 9b4e2d8c..3fa6a457 100644 --- a/docs/quick-install.md +++ b/docs/quick-install.md @@ -16,14 +16,14 @@ com.blinkfox fenix-spring-boot-starter - 2.7.0 + 3.0.0 ``` ### 🌵 2. Gradle :id=spring-boot-gradle ```bash -compile 'com.blinkfox:fenix-spring-boot-starter:2.7.0' +compile 'com.blinkfox:fenix-spring-boot-starter:3.0.0' ``` ### 🏕️ 3. 激活 Fenix (@EnableFenix) :id=enable-fenix @@ -100,14 +100,14 @@ fenix: com.blinkfox fenix - 2.7.0 + 3.0.0 ``` ### 🌻 2. Gradle :id=project-gradle ```bash -compile 'com.blinkfox:fenix:2.7.0' +compile 'com.blinkfox:fenix:3.0.0' ``` ### 🏔️ 3. 激活 Fenix :id=project-enable-fenix diff --git a/pom.xml b/pom.xml index 8531ad0d..1ba7e217 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.blinkfox fenix - 2.7.0 + 3.0.0 jar fenix diff --git a/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java b/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java index 8b12029f..792d1750 100644 --- a/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java +++ b/src/main/java/com/blinkfox/fenix/config/FenixConfigManager.java @@ -45,7 +45,7 @@ public final class FenixConfigManager { + " | __)/ __ \\ / \\| \\ \\/ /\n" + " | \\\\ ___/| | \\ |> < \n" + " \\___ / \\___ >___| /__/__/\\_ \\\n" - + " \\/ \\/ \\/ \\/ v2.7.0\n"; + + " \\/ \\/ \\/ \\/ v3.0.0\n"; /** * Fenix 配置信息实例. From 2a639cbb060b30117527d6ed1707e228f76db39e Mon Sep 17 00:00:00 2001 From: imhansai Date: Wed, 4 Jan 2023 17:09:58 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20jdk=2017?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 ++++---- .../com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 1ba7e217..b45129d7 100644 --- a/pom.xml +++ b/pom.xml @@ -145,8 +145,8 @@ maven-compiler-plugin 3.10.1 - 1.8 - 1.8 + 17 + 17 UTF-8 @@ -160,7 +160,7 @@ maven-pmd-plugin 3.16.0 - 1.8 + 17 true @@ -219,7 +219,7 @@ maven-pmd-plugin 3.16.0 - 1.8 + 17 true diff --git a/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java b/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java index c0d13ed9..4491c546 100755 --- a/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java +++ b/src/main/java/com/blinkfox/fenix/jpa/FenixQueryLookupStrategy.java @@ -79,7 +79,7 @@ private FenixQueryLookupStrategy(EntityManager entityManager, QueryLookupStrateg (JpaQueryMethodFactory) this.queryMethodFactory, key, provider, QueryRewriterProvider.simple(), EscapeCharacter.DEFAULT); } else { - // 为了兼容 Spring Data JPA v2.3.0 之前的版本,此处使用 Javassist 来重写下面方法的中的字节码,来解决老版本的编译错误. + // 为了兼容 Spring Data JPA v2.3.0 之前的版本,此处使用 Javassist 来重写下面方法中的字节码,来解决老版本的编译错误. this.jpaQueryLookupStrategy = this.createOldJpaQueryLookupStrategy(entityManager, key, extractor, provider, EscapeCharacter.DEFAULT); }