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

View File

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

View File

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

View File

@ -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() {

View File

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

View File

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

View File

@ -60,6 +60,10 @@ public class JdbcTemplateFluentSQLOperations implements FluentSQLOperations {
*/
@Override
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());
}

View File

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