From 659bbee81d67a0c8f1babb6dcec3272c285d96e5 Mon Sep 17 00:00:00 2001 From: wangyu <727842003@qq.com> Date: Tue, 27 Sep 2022 10:50:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=87=E7=BA=A70.0.4=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E6=88=90objectMapper=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- fluent-sql-annotations/pom.xml | 2 +- fluent-sql-core/pom.xml | 2 +- .../group/flyfish/fluent/utils/data/ObjectMappers.java | 10 ++++++---- fluent-sql-spring-boot-starter/pom.xml | 2 +- fluent-sql-spring-jdbc/pom.xml | 2 +- .../operations/JdbcTemplateFluentSQLOperations.java | 4 ++++ pom.xml | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f6747ac..adba114 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ fluent-sql-spring-boot-starter group.flyfish.framework - 0.0.3 + 0.0.4 ``` @@ -30,7 +30,7 @@ fluent-sql-spring-jdbc group.flyfish.framework - 0.0.3 + 0.0.4 ``` diff --git a/fluent-sql-annotations/pom.xml b/fluent-sql-annotations/pom.xml index 458c002..f2e3db7 100644 --- a/fluent-sql-annotations/pom.xml +++ b/fluent-sql-annotations/pom.xml @@ -5,7 +5,7 @@ fluent-sql group.flyfish.framework - 0.0.3 + 0.0.4 4.0.0 diff --git a/fluent-sql-core/pom.xml b/fluent-sql-core/pom.xml index beff5f5..01708af 100644 --- a/fluent-sql-core/pom.xml +++ b/fluent-sql-core/pom.xml @@ -5,7 +5,7 @@ fluent-sql group.flyfish.framework - 0.0.3 + 0.0.4 4.0.0 diff --git a/fluent-sql-core/src/main/java/group/flyfish/fluent/utils/data/ObjectMappers.java b/fluent-sql-core/src/main/java/group/flyfish/fluent/utils/data/ObjectMappers.java index ac32041..e1eac50 100644 --- a/fluent-sql-core/src/main/java/group/flyfish/fluent/utils/data/ObjectMappers.java +++ b/fluent-sql-core/src/main/java/group/flyfish/fluent/utils/data/ObjectMappers.java @@ -1,6 +1,7 @@ package group.flyfish.fluent.utils.data; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -16,10 +17,11 @@ public final class ObjectMappers { private static final ObjectMapper objectMapper; static { - objectMapper = new ObjectMapper(); - objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); + objectMapper = new ObjectMapper() + .setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + .enable(JsonGenerator.Feature.IGNORE_UNKNOWN) + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); } private ObjectMappers() { diff --git a/fluent-sql-spring-boot-starter/pom.xml b/fluent-sql-spring-boot-starter/pom.xml index 1775298..50e7eef 100644 --- a/fluent-sql-spring-boot-starter/pom.xml +++ b/fluent-sql-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ fluent-sql group.flyfish.framework - 0.0.3 + 0.0.4 spring boot 快速集成组件 4.0.0 diff --git a/fluent-sql-spring-jdbc/pom.xml b/fluent-sql-spring-jdbc/pom.xml index 4322421..583166a 100644 --- a/fluent-sql-spring-jdbc/pom.xml +++ b/fluent-sql-spring-jdbc/pom.xml @@ -5,7 +5,7 @@ fluent-sql group.flyfish.framework - 0.0.3 + 0.0.4 4.0.0 diff --git a/fluent-sql-spring-jdbc/src/main/java/group/flyfish/fluent/operations/JdbcTemplateFluentSQLOperations.java b/fluent-sql-spring-jdbc/src/main/java/group/flyfish/fluent/operations/JdbcTemplateFluentSQLOperations.java index d916ea7..1c211f6 100644 --- a/fluent-sql-spring-jdbc/src/main/java/group/flyfish/fluent/operations/JdbcTemplateFluentSQLOperations.java +++ b/fluent-sql-spring-jdbc/src/main/java/group/flyfish/fluent/operations/JdbcTemplateFluentSQLOperations.java @@ -60,6 +60,10 @@ public class JdbcTemplateFluentSQLOperations implements FluentSQLOperations { */ @Override public List select(SQLEntity entity, Class clazz) { + String sql = entity.getSql(); + if (ClassUtils.isPrimitiveOrWrapper(clazz)) { + return jdbcOperations.queryForList(sql, clazz, entity.getParameters()); + } return jdbcOperations.query(entity.getSql(), new SQLMappedRowMapper<>(clazz), entity.getParameters()); } diff --git a/pom.xml b/pom.xml index 76f243f..bda4118 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ group.flyfish.framework fluent-sql pom - 0.0.3 + 0.0.4 fluent-sql A very fast sql generation engine using fluent-style api. Help you start your work without mybatis!