Compare commits
No commits in common. "00c3ed537a17c43294845a17bd34b061905cdf33" and "ff4637535ac89862fb5e2d99aa26c3ba9665f9d3" have entirely different histories.
00c3ed537a
...
ff4637535a
@ -5,14 +5,14 @@
|
||||
<parent>
|
||||
<artifactId>fluent-sql</artifactId>
|
||||
<groupId>group.flyfish.framework</groupId>
|
||||
<version>1.0.0</version>
|
||||
<version>0.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>fluent-sql-annotations</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -5,15 +5,15 @@
|
||||
<parent>
|
||||
<artifactId>fluent-sql</artifactId>
|
||||
<groupId>group.flyfish.framework</groupId>
|
||||
<version>1.0.0</version>
|
||||
<version>0.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>fluent-sql-core</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -369,7 +369,7 @@ final class SQLImpl extends ConcatSegment<SQLImpl> implements SQLOperations, Pre
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Long> execute() {
|
||||
public Mono<Integer> execute() {
|
||||
return SHARED_REACTIVE_OPERATIONS.execute(entity);
|
||||
}
|
||||
}
|
||||
|
@ -44,5 +44,5 @@ public interface ReactiveBoundEntitySpec<T> {
|
||||
*
|
||||
* @return 更新行数
|
||||
*/
|
||||
Mono<Long> execute();
|
||||
Mono<Integer> execute();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package group.flyfish.fluent.operations;
|
||||
|
||||
import group.flyfish.fluent.entity.BoundSQLEntity;
|
||||
import group.flyfish.fluent.entity.DataPage;
|
||||
import group.flyfish.fluent.entity.SQLEntity;
|
||||
import org.springframework.lang.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
@ -49,5 +50,5 @@ public interface ReactiveFluentSQLOperations {
|
||||
* @param entity sql实体
|
||||
* @return 更新行数
|
||||
*/
|
||||
<T> Mono<Long> execute(BoundSQLEntity<T> entity);
|
||||
<T> Mono<Integer> execute(BoundSQLEntity<T> entity);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import group.flyfish.fluent.utils.cache.LRUCache;
|
||||
import group.flyfish.fluent.utils.context.AliasComposite;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.core.annotation.MergedAnnotations;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@ -28,9 +27,6 @@ import static group.flyfish.fluent.utils.sql.SqlNameUtils.wrap;
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class EntityNameUtils {
|
||||
|
||||
private static final String JPA_TABLE = "javax.persistence.Table";
|
||||
private static final String SPRING_DATA_TABLE = "org.springframework.data.relational.core.mapping.Table";
|
||||
|
||||
// SerializedLambda 反序列化缓存
|
||||
private static final Map<String, WeakReference<SerializedLambda>> FUNC_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
@ -61,18 +57,9 @@ public final class EntityNameUtils {
|
||||
*/
|
||||
public static String getTableName(Class<?> entityClass) {
|
||||
return TABLE_CACHE.computeIfAbsent(entityClass, k -> {
|
||||
MergedAnnotations annotations = MergedAnnotations.from(entityClass);
|
||||
if (annotations.isPresent(JPA_TABLE)) {
|
||||
String tableName = annotations.get(JPA_TABLE).getString("name");
|
||||
if (StringUtils.hasText(tableName)) {
|
||||
return tableName;
|
||||
}
|
||||
}
|
||||
if (annotations.isPresent(SPRING_DATA_TABLE)) {
|
||||
String tableName = annotations.get(SPRING_DATA_TABLE).getString("name");
|
||||
if (StringUtils.hasText(tableName)) {
|
||||
return tableName;
|
||||
}
|
||||
Table table = entityClass.getAnnotation(Table.class);
|
||||
if (null != table && StringUtils.hasText(table.name())) {
|
||||
return table.name();
|
||||
}
|
||||
return wrap(SqlNameUtils.camelToUnderline(entityClass.getSimpleName()));
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>fluent-sql</artifactId>
|
||||
<groupId>group.flyfish.framework</groupId>
|
||||
<version>1.0.0</version>
|
||||
<version>0.1.0</version>
|
||||
</parent>
|
||||
<description>spring boot 快速集成组件</description>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -13,8 +13,8 @@
|
||||
<artifactId>fluent-sql-spring-boot-starter</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -11,7 +11,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@ -24,11 +23,11 @@ import javax.sql.DataSource;
|
||||
*
|
||||
* @author wangyu
|
||||
*/
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
@Import({R2dbcFluentSqlAutoConfigure.class, JdbcFluentSqlAutoConfigure.class})
|
||||
public class FluentSqlAutoConfiguration {
|
||||
|
||||
@ConditionalOnClass(DatabaseClient.class)
|
||||
@AutoConfigureAfter(R2dbcAutoConfiguration.class)
|
||||
static class R2dbcFluentSqlAutoConfigure {
|
||||
|
||||
/**
|
||||
@ -45,7 +44,6 @@ public class FluentSqlAutoConfiguration {
|
||||
}
|
||||
|
||||
@ConditionalOnClass(DataSource.class)
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
static class JdbcFluentSqlAutoConfigure {
|
||||
|
||||
/**
|
||||
|
@ -5,15 +5,15 @@
|
||||
<parent>
|
||||
<artifactId>fluent-sql</artifactId>
|
||||
<groupId>group.flyfish.framework</groupId>
|
||||
<version>1.0.0</version>
|
||||
<version>0.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>fluent-sql-spring</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -49,6 +49,7 @@
|
||||
<dependency>
|
||||
<groupId>io.asyncer</groupId>
|
||||
<artifactId>r2dbc-mysql</artifactId>
|
||||
<version>0.9.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -1,6 +1,5 @@
|
||||
package group.flyfish.fluent.mapping;
|
||||
|
||||
import io.r2dbc.spi.ColumnMetadata;
|
||||
import io.r2dbc.spi.Row;
|
||||
import io.r2dbc.spi.RowMetadata;
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
@ -49,8 +48,7 @@ public class ReactiveSQLMappedRowMapper<T> implements BiFunction<Row, RowMetadat
|
||||
public T apply(Row row, RowMetadata rowMetadata) {
|
||||
MappingBean<T> bean = descriptor.create();
|
||||
|
||||
for (ColumnMetadata metadata : rowMetadata.getColumnMetadatas()) {
|
||||
String column = metadata.getName();
|
||||
for (String column : rowMetadata.getColumnNames()) {
|
||||
try {
|
||||
bean.setValue(column, type -> row.get(column, type));
|
||||
} catch (Exception ex) {
|
||||
|
@ -61,7 +61,7 @@ public class R2dbcFluentSQLOperations implements ReactiveFluentSQLOperations {
|
||||
* @return 更新行数
|
||||
*/
|
||||
@Override
|
||||
public <T> Mono<Long> execute(BoundSQLEntity<T> entity) {
|
||||
public <T> Mono<Integer> execute(BoundSQLEntity<T> entity) {
|
||||
return resolve(entity).fetch().rowsUpdated();
|
||||
}
|
||||
|
||||
|
18
pom.xml
18
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>group.flyfish.framework</groupId>
|
||||
<artifactId>fluent-sql</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0.0</version>
|
||||
<version>0.1.0</version>
|
||||
|
||||
<name>fluent-sql</name>
|
||||
<description>A very fast sql generation engine using fluent-style api. Help you start your work without mybatis!</description>
|
||||
@ -35,12 +35,12 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<lombok.version>1.18.24</lombok.version>
|
||||
<jackson.version>2.17.2</jackson.version>
|
||||
<spring-boot.version>3.3.1</spring-boot.version>
|
||||
<spring.version>6.1.10</spring.version>
|
||||
<spring-boot.version>2.7.18</spring-boot.version>
|
||||
<spring.version>5.3.22</spring.version>
|
||||
</properties>
|
||||
|
||||
<!-- 开发人员信息 -->
|
||||
@ -158,12 +158,6 @@
|
||||
<version>8.0.29</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.asyncer</groupId>
|
||||
<artifactId>r2dbc-mysql</artifactId>
|
||||
<version>1.1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-core</artifactId>
|
||||
@ -210,7 +204,7 @@
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.7.0</version>
|
||||
<version>1.6.7</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
|
Loading…
Reference in New Issue
Block a user