Skip to content
Merged

Dev #170

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-query/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-leave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-interface/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
</parent>

<artifactId>example-interface</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion example/example-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.25</version>
<version>3.4.26</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>

<artifactId>springboot-example</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>

<name>springboot-example</name>
<description>springboot-example project for Spring Boot</description>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>

<url>https://github.com/codingapi/springboot-framewrok</url>
<name>springboot-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-authorization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.4.25</version>
<version>3.4.26</version>
</parent>

<name>springboot-starter-data-authorization</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-fast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.25</version>
<version>3.4.26</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.Dialect;
import org.hibernate.tool.schema.SourceType;
import org.hibernate.tool.schema.TargetType;
import org.hibernate.tool.schema.internal.ExceptionHandlerCollectingImpl;
Expand All @@ -23,7 +22,7 @@ public class DynamicTableGenerator {
/**
* 数据库方言
*/
private final Dialect dialect;
private final Class<?> dialect;
private final StandardServiceRegistry serviceRegistry;
private final SchemaManagementTool managementTool;

Expand All @@ -32,14 +31,9 @@ public DynamicTableGenerator(Class<?> dialectClass, String jdbcUrl) {
}

public DynamicTableGenerator(Class<?> dialectClass, String jdbcUrl, String username, String password) {
try {
this.dialect = (Dialect) dialectClass.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException("Failed to instantiate dialect", e);
}

this.dialect = dialectClass;
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
.applySetting(AvailableSettings.DIALECT, dialect.getClass().getName())
.applySetting(AvailableSettings.DIALECT, dialect.getName())
.applySetting("hibernate.connection.url", jdbcUrl);
if (StringUtils.hasText(username)) {
builder.applySetting("hibernate.connection.username", username);
Expand All @@ -56,7 +50,7 @@ private class ExecutionOptionsImpl implements ExecutionOptions {
@Override
public Map<String, Object> getConfigurationValues() {
Map<String, Object> config = new HashMap<>();
config.put(AvailableSettings.DIALECT, dialect.getClass().getName());
config.put(AvailableSettings.DIALECT, dialect.getName());
return config;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.List;

@AllArgsConstructor
public class JPAQuery {
public class JpaQuery {

private final EntityManager entityManager;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.codingapi.springboot.fast.jpa;

import jakarta.persistence.EntityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class JpaQueryConfiguration {

@Bean
public JpaQuery dynamicQuery(EntityManager entityManager){
return new JpaQuery(entityManager);
}

@Bean
public JpaQueryContextRegister jpaQueryContextRegister(JpaQuery jpaQuery){
return new JpaQueryContextRegister(jpaQuery);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ private JpaQueryContext() {
}

@Getter
private JPAQuery JPAQuery;
private JpaQuery jpaQuery;

void setJPAQuery(JPAQuery JPAQuery) {
this.JPAQuery = JPAQuery;
void setJpaQuery(JpaQuery jpaQuery) {
this.jpaQuery = jpaQuery;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import org.springframework.beans.factory.InitializingBean;

@AllArgsConstructor
public class JPAQueryContextRegister implements InitializingBean {
public class JpaQueryContextRegister implements InitializingBean {

private JPAQuery JPAQuery;
private JpaQuery jpaQuery;

@Override
public void afterPropertiesSet() throws Exception {
JpaQueryContext.getInstance().setJPAQuery(JPAQuery);
JpaQueryContext.getInstance().setJpaQuery(jpaQuery);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,39 @@
public interface DynamicRepository<T, ID> extends BaseRepository<T, ID> {

default <V> List<V> dynamicListQuery(SQLBuilder<V> builder) {
return JpaQueryContext.getInstance().getJPAQuery().listQuery(builder);
return JpaQueryContext.getInstance().getJpaQuery().listQuery(builder);
}

default List<T> dynamicListQuery(String sql, Object... params) {
return JpaQueryContext.getInstance().getJPAQuery().listQuery(getEntityClass(), sql, params);
return JpaQueryContext.getInstance().getJpaQuery().listQuery(getEntityClass(), sql, params);
}

default <V> List<V> dynamicListQuery(Class<V> clazz, String sql, Object... params) {
return JpaQueryContext.getInstance().getJPAQuery().listQuery(clazz, sql, params);
return JpaQueryContext.getInstance().getJpaQuery().listQuery(clazz, sql, params);
}

default <V> Page<V> dynamicPageQuery(SQLBuilder<V> builder, PageRequest request) {
return JpaQueryContext.getInstance().getJPAQuery().pageQuery(builder, request);
return JpaQueryContext.getInstance().getJpaQuery().pageQuery(builder, request);
}

default Page<T> dynamicPageQuery(String sql, String countSql, PageRequest request, Object... params) {
return JpaQueryContext.getInstance().getJPAQuery().pageQuery(getEntityClass(), sql, countSql, request, params);
return JpaQueryContext.getInstance().getJpaQuery().pageQuery(getEntityClass(), sql, countSql, request, params);
}

default Page<T> dynamicPageQuery(String sql, PageRequest request, Object... params) {
return JpaQueryContext.getInstance().getJPAQuery().pageQuery(getEntityClass(), sql, request, params);
return JpaQueryContext.getInstance().getJpaQuery().pageQuery(getEntityClass(), sql, request, params);
}

default <V> Page<V> dynamicPageQuery(Class<V> clazz, String sql, String countSql, PageRequest request, Object... params) {
return JpaQueryContext.getInstance().getJPAQuery().pageQuery(clazz, sql, countSql, request, params);
return JpaQueryContext.getInstance().getJpaQuery().pageQuery(clazz, sql, countSql, request, params);
}

default Page<MapViewResult> dynamicMapPageQuery(QueryColumns columns, String sql, String countSql, PageRequest request, Object... params) {
return JpaQueryContext.getInstance().getJPAQuery().pageMapQuery(columns, sql, countSql, request, params);
return JpaQueryContext.getInstance().getJpaQuery().pageMapQuery(columns, sql, countSql, request, params);
}

default List<MapViewResult> dynamicMapListQuery(QueryColumns columns, String sql, Object... params) {
return JpaQueryContext.getInstance().getJPAQuery().listMapQuery(columns, sql, params);
return JpaQueryContext.getInstance().getJpaQuery().listMapQuery(columns, sql, params);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.codingapi.springboot.fast.jdbc.JdbcQuery;
import com.codingapi.springboot.fast.jdbc.JdbcQueryContext;
import com.codingapi.springboot.fast.jpa.JPAQuery;
import com.codingapi.springboot.fast.jpa.JpaQuery;
import com.codingapi.springboot.fast.jpa.JpaQueryContext;
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
Expand All @@ -18,7 +18,7 @@ static Object running(String script) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
ScriptRequest request = new ScriptRequest(attributes.getRequest());
JdbcQuery jdbcQuery = JdbcQueryContext.getInstance().getJdbcQuery();
JPAQuery jpaQuery = JpaQueryContext.getInstance().getJPAQuery();
JpaQuery jpaQuery = JpaQueryContext.getInstance().getJpaQuery();

binding.setVariable("$request", request);
binding.setVariable("$jpa", jpaQuery);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.codingapi.springboot.fast.DataFastConfiguration,\
com.codingapi.springboot.fast.jpa.JPAQueryConfiguration,\
com.codingapi.springboot.fast.jpa.JpaQueryConfiguration,\
com.codingapi.springboot.fast.jdbc.JdbcQueryConfiguration
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
com.codingapi.springboot.fast.DataFastConfiguration
com.codingapi.springboot.fast.jpa.JPAQueryConfiguration
com.codingapi.springboot.fast.jpa.JpaQueryConfiguration
com.codingapi.springboot.fast.jdbc.JdbcQueryConfiguration
Loading