|
|
|
@ -32,7 +32,6 @@ import org.springframework.data.mapping.PropertyPath; |
|
|
|
import org.springframework.data.mapping.PropertyReferenceException; |
|
|
|
import org.springframework.data.mapping.PropertyReferenceException; |
|
|
|
import org.springframework.data.mapping.context.InvalidPersistentPropertyPath; |
|
|
|
import org.springframework.data.mapping.context.InvalidPersistentPropertyPath; |
|
|
|
import org.springframework.data.mapping.context.MappingContext; |
|
|
|
import org.springframework.data.mapping.context.MappingContext; |
|
|
|
import org.springframework.data.relational.core.dialect.Dialect; |
|
|
|
|
|
|
|
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; |
|
|
|
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity; |
|
|
|
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; |
|
|
|
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; |
|
|
|
import org.springframework.data.relational.core.query.CriteriaDefinition; |
|
|
|
import org.springframework.data.relational.core.query.CriteriaDefinition; |
|
|
|
@ -66,7 +65,7 @@ public class QueryMapper { |
|
|
|
* |
|
|
|
* |
|
|
|
* @param converter must not be {@literal null}. |
|
|
|
* @param converter must not be {@literal null}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public QueryMapper( JdbcConverter converter) { |
|
|
|
public QueryMapper(JdbcConverter converter) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(converter, "JdbcConverter must not be null"); |
|
|
|
Assert.notNull(converter, "JdbcConverter must not be null"); |
|
|
|
|
|
|
|
|
|
|
|
@ -90,8 +89,7 @@ public class QueryMapper { |
|
|
|
SqlSort.validate(order); |
|
|
|
SqlSort.validate(order); |
|
|
|
|
|
|
|
|
|
|
|
OrderByField simpleOrderByField = createSimpleOrderByField(table, entity, order); |
|
|
|
OrderByField simpleOrderByField = createSimpleOrderByField(table, entity, order); |
|
|
|
OrderByField orderBy = simpleOrderByField |
|
|
|
OrderByField orderBy = simpleOrderByField.withNullHandling(order.getNullHandling()); |
|
|
|
.withNullHandling(order.getNullHandling()); |
|
|
|
|
|
|
|
mappedOrder.add(order.isAscending() ? orderBy.asc() : orderBy.desc()); |
|
|
|
mappedOrder.add(order.isAscending() ? orderBy.asc() : orderBy.desc()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -285,7 +283,7 @@ public class QueryMapper { |
|
|
|
SQLType sqlType; |
|
|
|
SQLType sqlType; |
|
|
|
Comparator comparator = criteria.getComparator(); |
|
|
|
Comparator comparator = criteria.getComparator(); |
|
|
|
|
|
|
|
|
|
|
|
if (criteria.getValue()instanceof JdbcValue settableValue) { |
|
|
|
if (criteria.getValue() instanceof JdbcValue settableValue) { |
|
|
|
|
|
|
|
|
|
|
|
mappedValue = convertValue(comparator, settableValue.getValue(), propertyField.getTypeHint()); |
|
|
|
mappedValue = convertValue(comparator, settableValue.getValue(), propertyField.getTypeHint()); |
|
|
|
sqlType = getTypeHint(mappedValue, actualType.getType(), settableValue); |
|
|
|
sqlType = getTypeHint(mappedValue, actualType.getType(), settableValue); |
|
|
|
@ -424,7 +422,8 @@ public class QueryMapper { |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private Object convertValue(Comparator comparator, @Nullable Object value, TypeInformation<?> typeHint) { |
|
|
|
private Object convertValue(Comparator comparator, @Nullable Object value, TypeInformation<?> typeHint) { |
|
|
|
|
|
|
|
|
|
|
|
if ((Comparator.IN.equals(comparator) || Comparator.NOT_IN.equals(comparator)) && value instanceof Collection<?> collection && !collection.isEmpty()) { |
|
|
|
if ((Comparator.IN.equals(comparator) || Comparator.NOT_IN.equals(comparator)) |
|
|
|
|
|
|
|
&& value instanceof Collection<?> collection && !collection.isEmpty()) { |
|
|
|
|
|
|
|
|
|
|
|
Collection<Object> mapped = new ArrayList<>(collection.size()); |
|
|
|
Collection<Object> mapped = new ArrayList<>(collection.size()); |
|
|
|
|
|
|
|
|
|
|
|
|