From 25d00ec9bf44dccaa757bad135da11d5237baed2 Mon Sep 17 00:00:00 2001 From: wangyu <727842003@qq.com> Date: Sat, 2 Oct 2021 14:25:57 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC=E7=9A=84=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flyfish/framework/beans/meta/BeanProperty.java | 12 ++++++++---- .../framework/beans/meta/BeanPropertyType.java | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java index 4e70f7e..fc39dc2 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java @@ -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"); } } diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java index f3ec65b..2b309f7 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java @@ -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> acceptor;