feat: 完善代码
This commit is contained in:
parent
d191ec10e3
commit
80b050ed63
@ -9,11 +9,9 @@ import com.flyfish.framework.repository.DefaultReactiveRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||
import org.springframework.data.r2dbc.core.R2dbcEntityOperations;
|
||||
import org.springframework.data.r2dbc.core.StatementMapper;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
import org.springframework.data.relational.core.query.Criteria;
|
||||
import org.springframework.r2dbc.core.DatabaseClient;
|
||||
import org.springframework.r2dbc.core.Parameter;
|
||||
@ -31,19 +29,6 @@ class AssociationWriter implements MetadataHandler {
|
||||
|
||||
private final Supplier<R2dbcEntityOperations> operations;
|
||||
|
||||
/**
|
||||
* 通过持久化属性获取真实的列名
|
||||
*
|
||||
* @param property 属性
|
||||
* @return 结果
|
||||
*/
|
||||
private String getColumnName(PersistentProperty<?> property) {
|
||||
if (property instanceof RelationalPersistentProperty) {
|
||||
return ((RelationalPersistentProperty) property).getColumnName().getReference();
|
||||
}
|
||||
return property.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理association
|
||||
*
|
||||
@ -182,9 +167,8 @@ class AssociationWriter implements MetadataHandler {
|
||||
*/
|
||||
private Mono<Domain> execute(DatabaseClient databaseClient, PreparedOperation<?> operation, Domain entity) {
|
||||
return databaseClient.sql(operation)
|
||||
.map((row -> entity))
|
||||
.all()
|
||||
.defaultIfEmpty(entity)
|
||||
.last();
|
||||
.fetch()
|
||||
.rowsUpdated()
|
||||
.thenReturn(entity);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user