feat: 乱码问题遗留

This commit is contained in:
wangyu 2024-07-02 18:03:22 +08:00
parent ac3ac3b68d
commit 1a0adaa97b

View File

@ -115,6 +115,23 @@ public class FullMappingR2dbcConverter extends MappingR2dbcConverter {
} }
/**
* Returns given object as {@link Collection}. Will return the {@link Collection} as is if the source is a
* {@link Collection} already, will convert an array into a {@link Collection} or simply create a single element
* collection for everything else.
*
* @param source
* @return
*/
private static Collection<?> asCollection(Object source) {
if (source instanceof Collection) {
return (Collection<?>) source;
}
return source.getClass().isArray() ? CollectionUtils.arrayToList(source) : Collections.singleton(source);
}
/** /**
* Checks whether we have a custom conversion registered for the given value into an arbitrary simple type. Returns * Checks whether we have a custom conversion registered for the given value into an arbitrary simple type. Returns
* the converted value if so. If not, we perform special enum handling or simply return the value as is. * the converted value if so. If not, we perform special enum handling or simply return the value as is.
@ -145,6 +162,10 @@ public class FullMappingR2dbcConverter extends MappingR2dbcConverter {
return Enum.class.isAssignableFrom(value.getClass()) ? ((Enum<?>) value).name() : value; return Enum.class.isAssignableFrom(value.getClass()) ? ((Enum<?>) value).name() : value;
} }
private Object writeNestedObject(@NonNull Object object) {
return JacksonUtil.toJson(object).orElse(null);
}
private Class<?> getPotentiallyConvertedSimpleNullType(Class<?> type) { private Class<?> getPotentiallyConvertedSimpleNullType(Class<?> type) {
Optional<Class<?>> customTarget = getConversions().getCustomWriteTarget(type); Optional<Class<?>> customTarget = getConversions().getCustomWriteTarget(type);