@@ -102,6 +102,8 @@ protected Specification<ENTITY> buildStringSpecification(StringFilter filter, Si
102102 protected Specification <ENTITY > buildSpecification (StringFilter filter , Function <Root <ENTITY >, Expression <String >> metaclassFunction ) {
103103 if (filter .getEquals () != null ) {
104104 return equalsSpecification (metaclassFunction , filter .getEquals ());
105+ } else if (filter .getEqualsIgnoreCase () != null ) {
106+ return equalsUpperSpecification (metaclassFunction , filter .getEqualsIgnoreCase ());
105107 } else if (filter .getIn () != null ) {
106108 return valueIn (metaclassFunction , filter .getIn ());
107109 } else if (filter .getNotIn () != null ) {
@@ -360,6 +362,17 @@ protected <X> Specification<ENTITY> equalsSpecification(Function<Root<ENTITY>, E
360362 return (root , query , builder ) -> builder .equal (metaclassFunction .apply (root ), value );
361363 }
362364
365+ /**
366+ * Generic method, which based on a Root<ENTITY> returns an Expression which type is the same as the given 'value' type, ignoring case.
367+ *
368+ * @param metaclassFunction function which returns the column which is used for filtering.
369+ * @param value the actual value to filter for.
370+ * @return a Specification.
371+ */
372+ protected Specification <ENTITY > equalsUpperSpecification (Function <Root <ENTITY >, Expression <String >> metaclassFunction , String value ) {
373+ return (root , query , builder ) -> builder .equal (builder .upper (metaclassFunction .apply (root ).as (String .class )), value .toUpperCase ());
374+ }
375+
363376 /**
364377 * Generic method, which based on a Root<ENTITY> returns an Expression which type is the same as the given 'value' type.
365378 *
@@ -379,9 +392,8 @@ protected <X> Specification<ENTITY> notEqualsSpecification(Function<Root<ENTITY>
379392 * @param value a {@link java.lang.String} object.
380393 * @return a {@link org.springframework.data.jpa.domain.Specification} object.
381394 */
382- protected Specification <ENTITY > likeUpperSpecification (Function <Root <ENTITY >, Expression <String >> metaclassFunction ,
383- String value ) {
384- return (root , query , builder ) -> builder .like (builder .upper (metaclassFunction .apply (root ).as (String .class )), wrapLikeQuery (value ));
395+ protected Specification <ENTITY > likeUpperSpecification (Function <Root <ENTITY >, Expression <String >> metaclassFunction , String value ) {
396+ return (root , query , builder ) -> builder .like (builder .upper (metaclassFunction .apply (root ).as (String .class )), wrapLikeQuery (value .toUpperCase ()));
385397 }
386398
387399 /**
@@ -391,9 +403,8 @@ protected Specification<ENTITY> likeUpperSpecification(Function<Root<ENTITY>, Ex
391403 * @param value a {@link java.lang.String} object.
392404 * @return a {@link org.springframework.data.jpa.domain.Specification} object.
393405 */
394- protected Specification <ENTITY > doesNotContainSpecification (Function <Root <ENTITY >, Expression <String >> metaclassFunction ,
395- String value ) {
396- return (root , query , builder ) -> builder .not (builder .like (builder .upper (metaclassFunction .apply (root ).as (String .class )), wrapLikeQuery (value )));
406+ protected Specification <ENTITY > doesNotContainSpecification (Function <Root <ENTITY >, Expression <String >> metaclassFunction , String value ) {
407+ return (root , query , builder ) -> builder .not (builder .like (builder .upper (metaclassFunction .apply (root ).as (String .class )), wrapLikeQuery (value .toUpperCase ())));
397408 }
398409
399410 /**
0 commit comments