feat: 升级0.0.4,完成objectMapper优化,查询优化

This commit is contained in:
wangyu 2022-09-27 10:50:03 +08:00
parent 36c8b7d97a
commit 659bbee81d
8 changed files with 17 additions and 11 deletions

View File

@ -20,7 +20,7 @@
<dependency> <dependency>
<artifactId>fluent-sql-spring-boot-starter</artifactId> <artifactId>fluent-sql-spring-boot-starter</artifactId>
<groupId>group.flyfish.framework</groupId> <groupId>group.flyfish.framework</groupId>
<version>0.0.3</version> <version>0.0.4</version>
</dependency> </dependency>
``` ```
@ -30,7 +30,7 @@
<dependency> <dependency>
<artifactId>fluent-sql-spring-jdbc</artifactId> <artifactId>fluent-sql-spring-jdbc</artifactId>
<groupId>group.flyfish.framework</groupId> <groupId>group.flyfish.framework</groupId>
<version>0.0.3</version> <version>0.0.4</version>
</dependency> </dependency>
``` ```

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fluent-sql</artifactId> <artifactId>fluent-sql</artifactId>
<groupId>group.flyfish.framework</groupId> <groupId>group.flyfish.framework</groupId>
<version>0.0.3</version> <version>0.0.4</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fluent-sql</artifactId> <artifactId>fluent-sql</artifactId>
<groupId>group.flyfish.framework</groupId> <groupId>group.flyfish.framework</groupId>
<version>0.0.3</version> <version>0.0.4</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -1,6 +1,7 @@
package group.flyfish.fluent.utils.data; package group.flyfish.fluent.utils.data;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
@ -16,10 +17,11 @@ public final class ObjectMappers {
private static final ObjectMapper objectMapper; private static final ObjectMapper objectMapper;
static { static {
objectMapper = new ObjectMapper(); objectMapper = new ObjectMapper()
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); .setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); .setSerializationInclusion(JsonInclude.Include.NON_NULL)
objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); .enable(JsonGenerator.Feature.IGNORE_UNKNOWN)
.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
} }
private ObjectMappers() { private ObjectMappers() {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fluent-sql</artifactId> <artifactId>fluent-sql</artifactId>
<groupId>group.flyfish.framework</groupId> <groupId>group.flyfish.framework</groupId>
<version>0.0.3</version> <version>0.0.4</version>
</parent> </parent>
<description>spring boot 快速集成组件</description> <description>spring boot 快速集成组件</description>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fluent-sql</artifactId> <artifactId>fluent-sql</artifactId>
<groupId>group.flyfish.framework</groupId> <groupId>group.flyfish.framework</groupId>
<version>0.0.3</version> <version>0.0.4</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -60,6 +60,10 @@ public class JdbcTemplateFluentSQLOperations implements FluentSQLOperations {
*/ */
@Override @Override
public <T> List<T> select(SQLEntity entity, Class<T> clazz) { public <T> List<T> select(SQLEntity entity, Class<T> 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()); return jdbcOperations.query(entity.getSql(), new SQLMappedRowMapper<>(clazz), entity.getParameters());
} }

View File

@ -7,7 +7,7 @@
<groupId>group.flyfish.framework</groupId> <groupId>group.flyfish.framework</groupId>
<artifactId>fluent-sql</artifactId> <artifactId>fluent-sql</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>0.0.3</version> <version>0.0.4</version>
<name>fluent-sql</name> <name>fluent-sql</name>
<description>A very fast sql generation engine using fluent-style api. Help you start your work without mybatis</description> <description>A very fast sql generation engine using fluent-style api. Help you start your work without mybatis</description>