|
|
|
|
@@ -33,7 +33,6 @@ import org.springframework.data.r2dbc.dialect.R2dbcDialect;
|
|
|
|
|
import org.springframework.data.relational.core.dialect.Escaper;
|
|
|
|
|
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
|
|
|
|
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
|
|
|
|
import org.springframework.data.relational.core.query.Criteria;
|
|
|
|
|
import org.springframework.data.relational.core.query.CriteriaDefinition;
|
|
|
|
|
import org.springframework.data.relational.core.query.CriteriaDefinition.Comparator;
|
|
|
|
|
import org.springframework.data.relational.core.query.ValueFunction;
|
|
|
|
|
@@ -97,35 +96,6 @@ public class QueryMapper {
|
|
|
|
|
return identifier.toSql(this.dialect.getIdentifierProcessing());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Map the {@link Sort} object to apply field name mapping using {@link Class the type to read}.
|
|
|
|
|
*
|
|
|
|
|
* @param sort must not be {@literal null}.
|
|
|
|
|
* @param entity related {@link RelationalPersistentEntity}, can be {@literal null}.
|
|
|
|
|
* @return
|
|
|
|
|
* @deprecated without replacement.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated(since = "3.2", forRemoval = true)
|
|
|
|
|
public Sort getMappedObject(Sort sort, @Nullable RelationalPersistentEntity<?> entity) {
|
|
|
|
|
|
|
|
|
|
if (entity == null) {
|
|
|
|
|
return sort;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Sort.Order> mappedOrder = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for (Sort.Order order : sort) {
|
|
|
|
|
|
|
|
|
|
SqlSort.validate(order);
|
|
|
|
|
|
|
|
|
|
Field field = createPropertyField(entity, SqlIdentifier.unquoted(order.getProperty()), this.mappingContext);
|
|
|
|
|
mappedOrder.add(
|
|
|
|
|
Sort.Order.by(toSql(field.getMappedColumnName())).with(order.getNullHandling()).with(order.getDirection()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Sort.by(mappedOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Map the {@link Sort} object to apply field name mapping using {@link Class the type to read}.
|
|
|
|
|
*
|
|
|
|
|
@@ -229,35 +199,6 @@ public class QueryMapper {
|
|
|
|
|
return new BoundCondition(bindings, mapped);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Map a {@link Criteria} object into {@link Condition} and consider value/{@code NULL} {@link Bindings}.
|
|
|
|
|
*
|
|
|
|
|
* @param markers bind markers object, must not be {@literal null}.
|
|
|
|
|
* @param criteria criteria definition to map, must not be {@literal null}.
|
|
|
|
|
* @param table must not be {@literal null}.
|
|
|
|
|
* @param entity related {@link RelationalPersistentEntity}, can be {@literal null}.
|
|
|
|
|
* @return the mapped {@link BoundCondition}.
|
|
|
|
|
* @deprecated since 1.1.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public BoundCondition getMappedObject(BindMarkers markers, Criteria criteria, Table table,
|
|
|
|
|
@Nullable RelationalPersistentEntity<?> entity) {
|
|
|
|
|
|
|
|
|
|
Assert.notNull(markers, "BindMarkers must not be null");
|
|
|
|
|
Assert.notNull(criteria, "Criteria must not be null");
|
|
|
|
|
Assert.notNull(table, "Table must not be null");
|
|
|
|
|
|
|
|
|
|
MutableBindings bindings = new MutableBindings(markers);
|
|
|
|
|
|
|
|
|
|
if (criteria.isEmpty()) {
|
|
|
|
|
throw new IllegalArgumentException("Cannot map empty Criteria");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Condition mapped = unroll(criteria, table, entity, bindings);
|
|
|
|
|
|
|
|
|
|
return new BoundCondition(bindings, mapped);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Condition unroll(CriteriaDefinition criteria, Table table, @Nullable RelationalPersistentEntity<?> entity,
|
|
|
|
|
MutableBindings bindings) {
|
|
|
|
|
|
|
|
|
|
|