feat:增加默认值的写入
This commit is contained in:
parent
c33cf2c38b
commit
25d00ec9bf
@ -259,14 +259,18 @@ public class BeanProperty {
|
||||
String pattern = annotations.get(JsonFormat.class).synthesize().pattern();
|
||||
// yyyy-MM-dd HH:mm:ss
|
||||
if (StringUtils.isNotBlank(pattern)) {
|
||||
if (pattern.length() == 7) {
|
||||
int length = pattern.length();
|
||||
if (length == 7) {
|
||||
property.prop("type", "month");
|
||||
} else if (pattern.length() == 10) {
|
||||
} else if (length == 10) {
|
||||
property.prop("type", "date");
|
||||
} else if (pattern.length() == 16) {
|
||||
} else if (length == 11) {
|
||||
property.prop("type", "date")
|
||||
.prop("format", "YYYY年MM月DD日");
|
||||
} else if (length == 16) {
|
||||
property.prop("type", "datetime");
|
||||
property.prop("format", "YYYY-MM-DD HH:mm");
|
||||
} else if (pattern.length() > 16) {
|
||||
} else if (length > 16) {
|
||||
property.prop("format", "YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ public enum BeanPropertyType {
|
||||
NUMBER("Number", "string", Number.class),
|
||||
BOOLEAN("Boolean", "boolean", Boolean.class),
|
||||
DATE("Date", "date", Date.class),
|
||||
ENUM("Enum", Enum.class),
|
||||
ENUM("Enum", "any", Enum.class),
|
||||
LIST("Array", "array", Collection.class),
|
||||
DB_REF("Ref", Po.class),
|
||||
DB_REF("Ref", "any", Po.class),
|
||||
OBJECT("Object", "object", Object.class);
|
||||
|
||||
private final BiPredicate<PropertyDescriptor, Class<?>> acceptor;
|
||||
|
Loading…
Reference in New Issue
Block a user