فهرست منبع

Merge pull request #124 from hs-web/3.0.x

3.0.x
zhōuhào 6 سال پیش
والد
کامیت
c7ff97e248
100فایلهای تغییر یافته به همراه482 افزوده شده و 159 حذف شده
  1. 1 1
      hsweb-authorization/hsweb-authorization-api/pom.xml
  2. 1 1
      hsweb-authorization/hsweb-authorization-basic/pom.xml
  3. 1 1
      hsweb-authorization/hsweb-authorization-jwt/pom.xml
  4. 1 1
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/pom.xml
  5. 1 1
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml
  6. 1 1
      hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/pom.xml
  7. 1 1
      hsweb-authorization/hsweb-authorization-oauth2/pom.xml
  8. 1 1
      hsweb-authorization/pom.xml
  9. 1 1
      hsweb-boost/hsweb-boost-aop/pom.xml
  10. 1 1
      hsweb-boost/hsweb-boost-excel/pom.xml
  11. 1 1
      hsweb-boost/hsweb-boost-ftp/pom.xml
  12. 1 1
      hsweb-boost/pom.xml
  13. 3 1
      hsweb-commons/create-crud.md
  14. 1 1
      hsweb-commons/hsweb-commons-bean/pom.xml
  15. 1 1
      hsweb-commons/hsweb-commons-controller/pom.xml
  16. 1 1
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml
  17. 1 1
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/pom.xml
  18. 46 7
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/java/org/hswebframework/web/dao/mybatis/builder/EasyOrmSqlBuilder.java
  19. 6 1
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/java/org/hswebframework/web/dao/mybatis/builder/InsertSqlBuilder.java
  20. 7 1
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/java/org/hswebframework/web/dao/mybatis/builder/UpdateSqlBuilder.java
  21. 31 4
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/basic/BasicMapper.xml
  22. 16 6
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/test/java/org/hswebframework/web/dao/crud/TestCrud.java
  23. 7 4
      hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/test/resources/org/hswebframework/web/dao/test/TestDao.xml
  24. 1 1
      hsweb-commons/hsweb-commons-dao/pom.xml
  25. 1 1
      hsweb-commons/hsweb-commons-entity/pom.xml
  26. 1 1
      hsweb-commons/hsweb-commons-model/pom.xml
  27. 1 1
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/pom.xml
  28. 1 1
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/pom.xml
  29. 1 1
      hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/pom.xml
  30. 1 1
      hsweb-commons/hsweb-commons-service/pom.xml
  31. 1 1
      hsweb-commons/hsweb-commons-utils/pom.xml
  32. 1 1
      hsweb-commons/pom.xml
  33. 1 1
      hsweb-concurrent/hsweb-concurrent-async-job/pom.xml
  34. 1 1
      hsweb-concurrent/hsweb-concurrent-cache/pom.xml
  35. 1 1
      hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-api/pom.xml
  36. 1 1
      hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-redis/pom.xml
  37. 1 1
      hsweb-concurrent/hsweb-concurrent-counter/pom.xml
  38. 1 1
      hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-api/pom.xml
  39. 1 1
      hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-redis/pom.xml
  40. 1 1
      hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-starter/pom.xml
  41. 1 1
      hsweb-concurrent/hsweb-concurrent-lock/pom.xml
  42. 1 1
      hsweb-concurrent/hsweb-concurrent-rate-limiter/hsweb-concurrent-rate-limiter-api/pom.xml
  43. 1 1
      hsweb-concurrent/hsweb-concurrent-rate-limiter/hsweb-concurrent-rate-limiter-starter/pom.xml
  44. 1 1
      hsweb-concurrent/hsweb-concurrent-rate-limiter/pom.xml
  45. 1 1
      hsweb-concurrent/pom.xml
  46. 1 1
      hsweb-core/pom.xml
  47. 3 1
      hsweb-datasource/README.md
  48. 1 1
      hsweb-datasource/hsweb-datasource-api/pom.xml
  49. 27 14
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/AopDataSourceSwitcherAutoConfiguration.java
  50. 14 4
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DataSourceHolder.java
  51. 5 1
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DynamicDataSourceAutoConfiguration.java
  52. 8 1
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/annotation/UseDataSource.java
  53. 6 0
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/strategy/AnnotationDataSourceSwitchStrategyMatcher.java
  54. 6 0
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/strategy/DataSourceSwitchStrategyMatcher.java
  55. 7 6
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/strategy/ExpressionDataSourceSwitchStrategyMatcher.java
  56. 28 0
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/switcher/DatabaseSwitcher.java
  57. 5 5
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/switcher/DefaultDataSourceSwitcher.java
  58. 83 0
      hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/switcher/DefaultDatabaseSwitcher.java
  59. 9 8
      hsweb-datasource/hsweb-datasource-jta/README.md
  60. 1 1
      hsweb-datasource/hsweb-datasource-jta/pom.xml
  61. 2 2
      hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceAutoConfiguration.java
  62. 1 1
      hsweb-datasource/hsweb-datasource-web/pom.xml
  63. 1 1
      hsweb-datasource/pom.xml
  64. 1 1
      hsweb-logging/hsweb-access-logging-aop/pom.xml
  65. 1 1
      hsweb-logging/hsweb-access-logging-api/pom.xml
  66. 1 1
      hsweb-logging/pom.xml
  67. 1 1
      hsweb-starter/hsweb-spring-boot-starter/pom.xml
  68. 11 7
      hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemVersion.java
  69. 46 0
      hsweb-starter/hsweb-spring-boot-starter/src/test/java/org/hswebframework/web/starter/SystemVersionTest.java
  70. 1 1
      hsweb-starter/pom.xml
  71. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml
  72. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/pom.xml
  73. 4 2
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/AuthorizationSettingDetailMapper.xml
  74. 2 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/AuthorizationSettingMapper.xml
  75. 4 2
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/AuthorizationSettingMenuMapper.xml
  76. 4 2
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/MenuGroupBindMapper.xml
  77. 2 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/MenuGroupMapper.xml
  78. 3 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/MenuMapper.xml
  79. 2 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/PermissionMapper.xml
  80. 2 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/RoleMapper.xml
  81. 2 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserMapper.xml
  82. 8 4
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserRoleMapper.xml
  83. 2 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserSettingMapper.xml
  84. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/pom.xml
  85. 4 4
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/resources/hsweb-starter.js
  86. 1 1
      hsweb-system/hsweb-system-authorization/hsweb-system-authorization-web/pom.xml
  87. 1 1
      hsweb-system/hsweb-system-authorization/pom.xml
  88. 1 1
      hsweb-system/hsweb-system-config/hsweb-system-config-api/pom.xml
  89. 1 1
      hsweb-system/hsweb-system-config/hsweb-system-config-local/pom.xml
  90. 2 1
      hsweb-system/hsweb-system-config/hsweb-system-config-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/config/ConfigMapper.xml
  91. 1 1
      hsweb-system/hsweb-system-config/hsweb-system-config-starter/pom.xml
  92. 1 1
      hsweb-system/hsweb-system-config/hsweb-system-config-web/pom.xml
  93. 1 1
      hsweb-system/hsweb-system-config/pom.xml
  94. 1 1
      hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-api/pom.xml
  95. 1 1
      hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/pom.xml
  96. 2 1
      hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dashboard/DashBoardConfigMapper.xml
  97. 1 1
      hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-starter/pom.xml
  98. 1 1
      hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-web/pom.xml
  99. 1 1
      hsweb-system/hsweb-system-dashboard/pom.xml
  100. 0 0
      hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-api/pom.xml

+ 1 - 1
hsweb-authorization/hsweb-authorization-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-authorization/hsweb-authorization-basic/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-authorization/hsweb-authorization-jwt/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-authorization-oauth2</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-authorization-oauth2</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-core/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-authorization-oauth2</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <!--<relativePath>../../pom.xml</relativePath>-->
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-authorization/hsweb-authorization-oauth2/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-authorization/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-boost/hsweb-boost-aop/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-boost</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-boost/hsweb-boost-excel/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-boost</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-boost/hsweb-boost-ftp/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-boost</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-boost/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 3 - 1
hsweb-commons/create-crud.md

@@ -164,7 +164,9 @@ public interface MenuDao extends CrudDao<MenuEntity, String> {
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_menu where u_id =#{id}
+         <include refid="config"/>
+         <include refid="BasicMapper.switcher"/> <!--支持表切换-->
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 1 - 1
hsweb-commons/hsweb-commons-bean/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-commons</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-commons/hsweb-commons-controller/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-api/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons-dao</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons-dao</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 46 - 7
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/java/org/hswebframework/web/dao/mybatis/builder/EasyOrmSqlBuilder.java

@@ -66,7 +66,7 @@ public class EasyOrmSqlBuilder {
 
     public EntityFactory entityFactory;
 
-    private static final   EasyOrmSqlBuilder  instance   = new EasyOrmSqlBuilder();
+    private static final EasyOrmSqlBuilder instance = new EasyOrmSqlBuilder();
     protected static final Map<Class, String> simpleName = new HashMap<>();
 
     protected PropertyUtilsBean propertyUtils = BeanUtilsBean.getInstance().getPropertyUtils();
@@ -106,11 +106,11 @@ public class EasyOrmSqlBuilder {
         return javaType;
     }
 
-    private final RDBDatabaseMetaData mysql      = new MysqlMeta();
-    private final RDBDatabaseMetaData oracle     = new OracleMeta();
-    private final RDBDatabaseMetaData h2         = new H2Meta();
+    private final RDBDatabaseMetaData mysql = new MysqlMeta();
+    private final RDBDatabaseMetaData oracle = new OracleMeta();
+    private final RDBDatabaseMetaData h2 = new H2Meta();
     private final RDBDatabaseMetaData postgresql = new PGMeta();
-    private final RDBDatabaseMetaData mssql      = new MSSQLMeta();
+    private final RDBDatabaseMetaData mssql = new MSSQLMeta();
 
     private final ConcurrentMap<RDBDatabaseMetaData, Map<String, RDBTableMetaData>> metaCache = new ConcurrentHashMap<>();
 
@@ -146,7 +146,7 @@ public class EasyOrmSqlBuilder {
     }
 
     protected RDBTableMetaData createMeta(String tableName, String resultMapId) {
-        tableName = getRealTableName(tableName);
+//        tableName = getRealTableName(tableName);
         RDBDatabaseMetaData active = getActiveDatabase();
         String cacheKey = tableName.concat("-").concat(resultMapId);
         Map<String, RDBTableMetaData> cache = metaCache.computeIfAbsent(active, k -> new ConcurrentHashMap<>());
@@ -155,7 +155,14 @@ public class EasyOrmSqlBuilder {
         if (cached != null) {
             return cached;
         }
-        RDBTableMetaData rdbTableMetaData = new RDBTableMetaData();
+
+        RDBTableMetaData rdbTableMetaData = new RDBTableMetaData() {
+            @Override
+            public String getName() {
+                //动态切换表名
+                return getRealTableName(tableName);
+            }
+        };
         ResultMap resultMaps = MybatisUtils.getResultMap(resultMapId);
         rdbTableMetaData.setName(tableName);
         rdbTableMetaData.setDatabaseMetaData(active);
@@ -167,6 +174,9 @@ public class EasyOrmSqlBuilder {
                 RDBColumnMetaData column = new RDBColumnMetaData();
                 column.setJdbcType(JDBCType.valueOf(resultMapping.getJdbcType().name()));
                 column.setName(resultMapping.getColumn());
+                if (resultMapping.getTypeHandler() != null) {
+                    column.setProperty("typeHandler", resultMapping.getTypeHandler().getClass().getName());
+                }
                 if (!StringUtils.isNullOrEmpty(resultMapping.getProperty())) {
                     column.setAlias(resultMapping.getProperty());
                 }
@@ -241,10 +251,14 @@ public class EasyOrmSqlBuilder {
                 appender.add(",", encodeColumn(dialect, columnMetaData.getName())
                         , "=", ((Sql) value).getSql());
             } else {
+                String typeHandler = columnMetaData.getProperty("typeHandler")
+                        .getValue();
+
                 appender.add(",", encodeColumn(dialect, columnMetaData.getName())
                         , "=", "#{data.", columnMetaData.getAlias(),
                         ",javaType=", EasyOrmSqlBuilder.getJavaType(columnMetaData.getJavaType()),
                         ",jdbcType=", columnMetaData.getJdbcType(),
+                        typeHandler != null ? ",typeHandler=" + typeHandler : "",
                         "}");
             }
         });
@@ -410,6 +424,11 @@ public class EasyOrmSqlBuilder {
             renderMap.put(SqlRender.TYPE.INSERT, new InsertSqlBuilder());
             renderMap.put(SqlRender.TYPE.UPDATE, new UpdateSqlBuilder(Dialect.MYSQL));
         }
+
+        @Override
+        public String getDatabaseName() {
+            return DataSourceHolder.databaseSwitcher().currentDatabase();
+        }
     }
 
     class OracleMeta extends OracleRDBDatabaseMetaData {
@@ -418,6 +437,11 @@ public class EasyOrmSqlBuilder {
             renderMap.put(SqlRender.TYPE.INSERT, new InsertSqlBuilder());
             renderMap.put(SqlRender.TYPE.UPDATE, new UpdateSqlBuilder(Dialect.ORACLE));
         }
+
+        @Override
+        public String getDatabaseName() {
+            return DataSourceHolder.databaseSwitcher().currentDatabase();
+        }
     }
 
     class H2Meta extends H2RDBDatabaseMetaData {
@@ -426,6 +450,11 @@ public class EasyOrmSqlBuilder {
             renderMap.put(SqlRender.TYPE.INSERT, new InsertSqlBuilder());
             renderMap.put(SqlRender.TYPE.UPDATE, new UpdateSqlBuilder(Dialect.H2));
         }
+
+        @Override
+        public String getDatabaseName() {
+            return DataSourceHolder.databaseSwitcher().currentDatabase();
+        }
     }
 
     class PGMeta extends PGRDBDatabaseMetaData {
@@ -434,6 +463,11 @@ public class EasyOrmSqlBuilder {
             renderMap.put(SqlRender.TYPE.INSERT, new InsertSqlBuilder());
             renderMap.put(SqlRender.TYPE.UPDATE, new UpdateSqlBuilder(Dialect.POSTGRES));
         }
+
+        @Override
+        public String getDatabaseName() {
+            return DataSourceHolder.databaseSwitcher().currentDatabase();
+        }
     }
 
     class MSSQLMeta extends MSSQLRDBDatabaseMetaData {
@@ -442,5 +476,10 @@ public class EasyOrmSqlBuilder {
             renderMap.put(SqlRender.TYPE.INSERT, new InsertSqlBuilder());
             renderMap.put(SqlRender.TYPE.UPDATE, new UpdateSqlBuilder(Dialect.MSSQL));
         }
+
+        @Override
+        public String getDatabaseName() {
+            return DataSourceHolder.databaseSwitcher().currentDatabase();
+        }
     }
 }

+ 6 - 1
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/java/org/hswebframework/web/dao/mybatis/builder/InsertSqlBuilder.java

@@ -42,8 +42,13 @@ public class InsertSqlBuilder extends SimpleInsertSqlRender {
 
     @Override
     protected SqlAppender getParamString(String prefix, String paramName, RDBColumnMetaData rdbColumnMetaData) {
+        String typeHandler = rdbColumnMetaData.getProperty("typeHandler")
+                .getValue();
+
         return new SqlAppender().add("#{", paramName,
                 ",javaType=", EasyOrmSqlBuilder.getJavaType(rdbColumnMetaData.getJavaType()),
-                ",jdbcType=", rdbColumnMetaData.getJdbcType(), "}");
+                ",jdbcType=", rdbColumnMetaData.getJdbcType(),
+                typeHandler != null ? ",typeHandler=" + typeHandler : "",
+                "}");
     }
 }

+ 7 - 1
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/java/org/hswebframework/web/dao/mybatis/builder/UpdateSqlBuilder.java

@@ -33,6 +33,7 @@ public class UpdateSqlBuilder extends SimpleUpdateSqlRender {
     public UpdateSqlBuilder(Dialect dialect) {
         super(dialect);
     }
+
     @Override
     public SQL render(RDBTableMetaData metaData, UpdateParam param) {
         RDBTableMetaData metaDataNew = metaData.clone();
@@ -44,10 +45,15 @@ public class UpdateSqlBuilder extends SimpleUpdateSqlRender {
                 .forEach(metaDataNew::removeColumn);
         return super.render(metaDataNew, param);
     }
+
     @Override
     protected SqlAppender getParamString(String paramName, RDBColumnMetaData rdbColumnMetaData) {
+        String typeHandler = rdbColumnMetaData.getProperty("typeHandler")
+                .getValue();
+
         return new SqlAppender().add("#{", paramName,
                 ",javaType=", EasyOrmSqlBuilder.getJavaType(rdbColumnMetaData.getJavaType()),
-                ",jdbcType=", rdbColumnMetaData.getJdbcType(), "}");
+                ",jdbcType=", rdbColumnMetaData.getJdbcType(),
+                typeHandler != null ? ",typeHandler=" + typeHandler : "", "}");
     }
 }

+ 31 - 4
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/basic/BasicMapper.xml

@@ -45,12 +45,36 @@
         ${@org.hswebframework.web.dao.mybatis.builder.SqlBuilder@current().buildOrder(resultMapId,tableName,#this['_parameter'])}
     </sql>
 
+    <sql id="switcher">
+        <bind name="_fullTableName" value="tableName"/>
+        <!--当前数据库-->
+        <bind name="_databaseName"
+              value="@org.hswebframework.web.datasource.DataSourceHolder@databaseSwitcher().currentDatabase()"/>
+        <!--表全名前缀-->
+        <bind name="_databasePrefix" value="''"/>
+
+        <!--当前表名-->
+        <bind name="_currentTableName"
+              value="@org.hswebframework.web.datasource.DataSourceHolder@tableSwitcher().getTable(tableName)"/>
+
+        <if test="_currentTableName==null">
+            <bind name="_currentTableName" value="tableName"/>
+        </if>
+        <if test="_databaseName!=null">
+            <bind name="_databasePrefix" value="_databaseName+'.'"/>
+        </if>
+        <if test="_currentTableName!=null">
+            <bind name="_fullTableName" value="_databasePrefix+_currentTableName"/>
+        </if>
+    </sql>
+
     <!--生成查询sql-->
     <sql id="buildSelectSql">
+        <include refid="BasicMapper.switcher"/>
         <trim>
             select
             <include refid="BasicMapper.buildSelectField"/>
-            from ${tableName}
+            from ${_fullTableName}
             <where>
                 <include refid="BasicMapper.buildWhere"/>
             </where>
@@ -60,8 +84,9 @@
 
     <!--生成删除sql-->
     <sql id="buildDeleteSql">
+        <include refid="BasicMapper.switcher"/>
         <trim>
-            delete from ${tableName}
+            delete from ${_fullTableName}
             <where>
                 <include refid="BasicMapper.buildWhereForUpdate"/>
             </where>
@@ -75,8 +100,9 @@
 
     <!--生成UpdateSql-->
     <sql id="buildUpdateSql">
+        <include refid="BasicMapper.switcher"/>
         <trim>
-            update ${tableName}
+            update ${_fullTableName}
             <include refid="BasicMapper.buildUpdateField"/>
             <where>
                 <include refid="BasicMapper.buildWhereForUpdate"/>
@@ -86,8 +112,9 @@
 
     <!--生成查询数量sql-->
     <sql id="buildTotalSql">
+        <include refid="BasicMapper.switcher"/>
         <trim>
-            select count(0) as total from ${tableName}
+            select count(0) as total from ${_fullTableName}
             <where>
                 <include refid="BasicMapper.buildWhere"/>
             </where>

+ 16 - 6
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/test/java/org/hswebframework/web/dao/crud/TestCrud.java

@@ -5,6 +5,7 @@ import org.hswebframework.ezorm.core.param.QueryParam;
 import org.hswebframework.ezorm.rdb.executor.SqlExecutor;
 import org.hswebframework.web.commons.entity.param.DeleteParamEntity;
 import org.hswebframework.web.commons.entity.param.QueryParamEntity;
+import org.hswebframework.web.commons.entity.param.UpdateParamEntity;
 import org.hswebframework.web.datasource.DataSourceHolder;
 import org.hswebframework.web.dict.EnumDict;
 import org.junit.Assert;
@@ -58,7 +59,9 @@ public class TestCrud extends AbstractTransactionalJUnit4SpringContextTests {
     }
 
     @Test
-    public void testInsert() {
+    public void testCRUD() {
+
+        DataSourceHolder.databaseSwitcher().use("PUBLIC");
 
         TestEntity entity = new TestEntity();
         entity.setName("测试");
@@ -72,17 +75,24 @@ public class TestCrud extends AbstractTransactionalJUnit4SpringContextTests {
         query.where("dataTypes$in$any", Arrays.asList(DataType.TYPE1, DataType.TYPE2));
 
         //#102
-        query.where("createTime","2017-11-10");
+        query.where("createTime", "2017-11-10");
 
-        query.includes("nest.name", "*");
+//        query.includes("nest.name", "*");
 
-        //  DataSourceHolder.tableSwitcher().use("h_test", "h_test2");
+//        DataSourceHolder.tableSwitcher().use("h_test", "h_test2");
         List<TestEntity> entities = testDao.queryNest(query);
 
-//        testDao.query(entity);
+        testDao.query(query);
+        testDao.countNest(query);
+        testDao.count(query);
+        UpdateParamEntity.newUpdate()
+                .set("name","测试")
+                .set(entity::getDataType)
+                .where("id",entity.getId())
+                .exec(testDao::update);
 
         DeleteParamEntity.newDelete()
-                .where("id","1234")
+                .where("id", "1234")
                 .exec(testDao::delete);
         System.out.println(entities);
     }

+ 7 - 4
hsweb-commons/hsweb-commons-dao/hsweb-commons-dao-mybatis/src/test/resources/org/hswebframework/web/dao/test/TestDao.xml

@@ -4,6 +4,7 @@
 
     <resultMap id="TestResultMap" type="org.hswebframework.web.dao.crud.TestEntity">
         <id property="id" column="id" javaType="Long" jdbcType="INTEGER"/>
+        <id property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
 
     </resultMap>
 
@@ -46,10 +47,11 @@
     <select id="queryNest" parameterType="org.hswebframework.web.commons.entity.Entity" resultMap="TestNestResultMap">
         <bind name="tableName" value="'h_test'"/>
         <bind name="resultMapId" value="'TestNestResultMap'"/>
+        <include refid="BasicMapper.switcher"/>
         select
         <include refid="BasicMapper.buildSelectField"/>
-        from h_test
-        left join h_nest_table nest_table on nest_table.id=h_test.id
+        from ${_fullTableName} h_test
+        left join ${_databasePrefix}h_nest_table nest_table on nest_table.id=h_test.id
         <where>
             <include refid="BasicMapper.buildWhere"/>
         </where>
@@ -58,10 +60,11 @@
 
     <select id="countNest" parameterType="org.hswebframework.web.commons.entity.Entity" resultType="int">
         <include refid="config"/>
+        <include refid="BasicMapper.switcher"/>
         select
         count(1)
-        from h_test
-        left join h_nest_table nest_table on nest_table.id=h_test.id
+        from ${_fullTableName} h_test
+        left join ${_databasePrefix}h_nest_table nest_table on nest_table.id=h_test.id
         <where>
             <include refid="BasicMapper.buildWhere"/>
         </where>

+ 1 - 1
hsweb-commons/hsweb-commons-dao/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-commons/hsweb-commons-entity/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-commons/hsweb-commons-model/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-commons/hsweb-commons-service/hsweb-commons-service-api/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons-service</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-commons/hsweb-commons-service/hsweb-commons-service-oauth2/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-commons-service</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
 
         <relativePath>../pom.xml</relativePath>
     </parent>

+ 1 - 1
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons-service</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
 
     </parent>

+ 1 - 1
hsweb-commons/hsweb-commons-service/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
 
         <relativePath>../pom.xml</relativePath>
     </parent>

+ 1 - 1
hsweb-commons/hsweb-commons-utils/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-commons</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-commons/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-async-job/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-cache/pom.xml

@@ -22,7 +22,7 @@
     <parent>
         <artifactId>hsweb-concurrent</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-api/pom.xml

@@ -22,7 +22,7 @@
     <parent>
         <artifactId>hsweb-concurrent-counter</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-counter/hsweb-concurrent-counter-redis/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent-counter</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-counter/pom.xml

@@ -22,7 +22,7 @@
     <parent>
         <artifactId>hsweb-concurrent</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent-lock</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-redis/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent-lock</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-lock/hsweb-concurrent-lock-starter/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent-lock</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-lock/pom.xml

@@ -22,7 +22,7 @@
     <parent>
         <artifactId>hsweb-concurrent</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-rate-limiter/hsweb-concurrent-rate-limiter-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent-rate-limiter</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-rate-limiter/hsweb-concurrent-rate-limiter-starter/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent-rate-limiter</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/hsweb-concurrent-rate-limiter/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-concurrent</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-concurrent/pom.xml

@@ -22,7 +22,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-core/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 3 - 1
hsweb-datasource/README.md

@@ -15,8 +15,10 @@ hsweb:
            test: # 只是一个标识
               # 拦截类和方法的表达式
               expression: org.hswebframework.**.*Service.find*
-              # 使用数据源
+              # 切换数据源
               data-source-id: read_db
+              # 切换数据库 从3.0.8开始支持
+              #database: db_001  # select * from db_001.s_user
 ```
 
 编程方式:

+ 1 - 1
hsweb-datasource/hsweb-datasource-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-datasource</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
 
         <relativePath>../pom.xml</relativePath>
     </parent>

+ 27 - 14
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/AopDataSourceSwitcherAutoConfiguration.java

@@ -13,6 +13,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.util.ClassUtils;
+import org.springframework.util.StringUtils;
 
 import java.lang.reflect.Method;
 import java.util.List;
@@ -67,8 +68,8 @@ public class AopDataSourceSwitcherAutoConfiguration {
     }
 
     public static class SwitcherMethodMatcherPointcutAdvisor extends StaticMethodMatcherPointcutAdvisor {
-        private static final Logger logger           = LoggerFactory.getLogger(SwitcherMethodMatcherPointcutAdvisor.class);
-        private static final long   serialVersionUID = 536295121851990398L;
+        private static final Logger logger = LoggerFactory.getLogger(SwitcherMethodMatcherPointcutAdvisor.class);
+        private static final long serialVersionUID = 536295121851990398L;
 
         private List<DataSourceSwitchStrategyMatcher> matchers;
 
@@ -76,7 +77,7 @@ public class AopDataSourceSwitcherAutoConfiguration {
 
         private Map<CachedDataSourceSwitchStrategyMatcher.CacheKey, DataSourceSwitchStrategyMatcher> cache
                 = new ConcurrentHashMap<>();
-        private Map<CachedTableSwitchStrategyMatcher.CacheKey, TableSwitchStrategyMatcher>           tableCache
+        private Map<CachedTableSwitchStrategyMatcher.CacheKey, TableSwitchStrategyMatcher> tableCache
                 = new ConcurrentHashMap<>();
 
         public SwitcherMethodMatcherPointcutAdvisor(List<DataSourceSwitchStrategyMatcher> matchers,
@@ -92,7 +93,9 @@ public class AopDataSourceSwitcherAutoConfiguration {
 
                 Consumer<MethodInterceptorContext> before = context -> {
                 };
-                AtomicBoolean dataSourceChanged = new AtomicBoolean(true);
+                AtomicBoolean dataSourceChanged = new AtomicBoolean(false);
+                AtomicBoolean databaseChanged = new AtomicBoolean(false);
+
                 if (matcher != null) {
                     before = before.andThen(context -> {
                         Strategy strategy = matcher.getStrategy(context);
@@ -100,23 +103,26 @@ public class AopDataSourceSwitcherAutoConfiguration {
                             dataSourceChanged.set(false);
                             logger.warn("strategy matcher found:{}, but strategy is null!", matcher);
                         } else {
-                            logger.debug("switch datasource.use strategy:{}", strategy);
+                            logger.debug("switch datasource. use strategy:{}", strategy);
                             if (strategy.isUseDefaultDataSource()) {
                                 DataSourceHolder.switcher().useDefault();
                             } else {
                                 try {
                                     String id = strategy.getDataSourceId();
-                                    if (id.contains("${")) {
-                                        id = ExpressionUtils.analytical(id, context.getParams(), "spel");
-                                    }
-                                    if (!DataSourceHolder.existing(id)) {
-                                        if (strategy.isFallbackDefault()) {
-                                            DataSourceHolder.switcher().useDefault();
+                                    if (StringUtils.hasText(id)) {
+                                        if (id.contains("${")) {
+                                            id = ExpressionUtils.analytical(id, context.getParams(), "spel");
+                                        }
+                                        if (!DataSourceHolder.existing(id)) {
+                                            if (strategy.isFallbackDefault()) {
+                                                DataSourceHolder.switcher().useDefault();
+                                            } else {
+                                                throw new DataSourceNotFoundException("数据源[" + id + "]不存在");
+                                            }
                                         } else {
-                                            throw new DataSourceNotFoundException(id);
+                                            DataSourceHolder.switcher().use(id);
                                         }
-                                    } else {
-                                        DataSourceHolder.switcher().use(id);
+                                        dataSourceChanged.set(true);
                                     }
                                 } catch (RuntimeException e) {
                                     dataSourceChanged.set(false);
@@ -126,6 +132,10 @@ public class AopDataSourceSwitcherAutoConfiguration {
                                     throw new RuntimeException(e.getMessage(), e);
                                 }
                             }
+                            if (StringUtils.hasText(strategy.getDatabase())) {
+                                databaseChanged.set(true);
+                                DataSourceHolder.databaseSwitcher().use(strategy.getDatabase());
+                            }
                         }
                     });
                 }
@@ -149,6 +159,9 @@ public class AopDataSourceSwitcherAutoConfiguration {
                     if (dataSourceChanged.get()) {
                         DataSourceHolder.switcher().useLast();
                     }
+                    if (databaseChanged.get()) {
+                        DataSourceHolder.databaseSwitcher().useLast();
+                    }
                     DataSourceHolder.tableSwitcher().reset();
                 }
             });

+ 14 - 4
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DataSourceHolder.java

@@ -1,9 +1,7 @@
 package org.hswebframework.web.datasource;
 
 import org.hswebframework.web.datasource.exception.DataSourceNotFoundException;
-import org.hswebframework.web.datasource.switcher.DataSourceSwitcher;
-import org.hswebframework.web.datasource.switcher.DefaultDataSourceSwitcher;
-import org.hswebframework.web.datasource.switcher.TableSwitcher;
+import org.hswebframework.web.datasource.switcher.*;
 
 /**
  * 用于操作动态数据源,如获取当前使用的数据源,使用switcher切换数据源等
@@ -24,7 +22,10 @@ public final class DataSourceHolder {
      */
     static volatile DynamicDataSourceService dynamicDataSourceService;
 
-    static volatile TableSwitcher tableSwitcher;
+    static volatile TableSwitcher tableSwitcher = new DefaultTableSwitcher();
+
+    static volatile DatabaseSwitcher databaseSwitcher = new DefaultDatabaseSwitcher();
+
 
     public static void checkDynamicDataSourceReady() {
         if (dynamicDataSourceService == null) {
@@ -46,6 +47,15 @@ public final class DataSourceHolder {
         return tableSwitcher;
     }
 
+    /**
+     * @return 数据库切换器
+     * @since 3.0.8
+     */
+    public static DatabaseSwitcher databaseSwitcher() {
+        return databaseSwitcher;
+    }
+
+
     /**
      * @return 默认数据源
      */

+ 5 - 1
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DynamicDataSourceAutoConfiguration.java

@@ -6,6 +6,7 @@ import org.hswebframework.web.datasource.config.InSpringDynamicDataSourceConfig;
 import org.hswebframework.web.datasource.service.InSpringContextDynamicDataSourceService;
 import org.hswebframework.web.datasource.service.InSpringDynamicDataSourceConfigRepository;
 import org.hswebframework.web.datasource.switcher.DataSourceSwitcher;
+import org.hswebframework.web.datasource.switcher.DatabaseSwitcher;
 import org.hswebframework.web.datasource.switcher.DefaultTableSwitcher;
 import org.hswebframework.web.datasource.switcher.TableSwitcher;
 import org.springframework.beans.BeansException;
@@ -40,7 +41,7 @@ public class DynamicDataSourceAutoConfiguration {
 
     @Bean
     @ConditionalOnMissingBean(DynamicDataSourceConfigRepository.class)
-    public InSpringDynamicDataSourceConfigRepository inSpringDynamicDataSourceConfigRepository() {
+    public DynamicDataSourceConfigRepository inSpringDynamicDataSourceConfigRepository() {
         return new InSpringDynamicDataSourceConfigRepository();
     }
 
@@ -86,6 +87,9 @@ public class DynamicDataSourceAutoConfiguration {
                 if (bean instanceof TableSwitcher) {
                     DataSourceHolder.tableSwitcher = ((TableSwitcher) bean);
                 }
+                if (bean instanceof DatabaseSwitcher) {
+                    DataSourceHolder.databaseSwitcher = ((DatabaseSwitcher) bean);
+                }
                 return bean;
             }
         };

+ 8 - 1
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/annotation/UseDataSource.java

@@ -17,7 +17,14 @@ public @interface UseDataSource {
      * @return 数据源ID ,支持表达式如 : ${#param.id}
      * @see DynamicDataSource#getId()
      */
-    String value();
+    String value() default "";
+
+    /**
+     * 指定数据库
+     *
+     * @return 数据库名
+     */
+    String database() default "";
 
     /**
      * @return 数据源不存在时, 是否使用默认数据源.

+ 6 - 0
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/strategy/AnnotationDataSourceSwitchStrategyMatcher.java

@@ -3,6 +3,7 @@ package org.hswebframework.web.datasource.strategy;
 import org.hswebframework.web.AopUtils;
 import org.hswebframework.web.datasource.annotation.UseDataSource;
 import org.hswebframework.web.datasource.annotation.UseDefaultDataSource;
+import org.springframework.util.StringUtils;
 
 import java.lang.reflect.Method;
 import java.util.Arrays;
@@ -46,6 +47,11 @@ public class AnnotationDataSourceSwitchStrategyMatcher extends CachedDataSourceS
                 public String toString() {
                     return "Annotation Strategy(" + (useDataSource != null ? useDataSource : useDefaultDataSource) + ")";
                 }
+
+                @Override
+                public String getDatabase() {
+                    return useDataSource == null ? null : StringUtils.isEmpty(useDataSource.database()) ? null : useDataSource.database();
+                }
             };
         }
         return null;

+ 6 - 0
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/strategy/DataSourceSwitchStrategyMatcher.java

@@ -55,6 +55,12 @@ public interface DataSourceSwitchStrategyMatcher {
          * @see org.hswebframework.web.datasource.switcher.DataSourceSwitcher#use(String)
          */
         String getDataSourceId();
+
+        /**
+         * @since 3.0.8
+         * @return 指定数据库
+         */
+        String getDatabase();
     }
 
 }

+ 7 - 6
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/strategy/ExpressionDataSourceSwitchStrategyMatcher.java

@@ -17,10 +17,10 @@ import java.util.Map;
  *      datasource:
  *          switcher:
  *              test: # 只是一个标识
- *              # 拦截类和方法的表达式
- *              expression: org.hswebframework.**.*Service.find*
- *              # 使用数据源
- *              data-source-id: read_db
+ *                  # 拦截类和方法的表达式
+ *                  expression: org.hswebframework.**.*Service.find*
+ *                  # 使用数据源
+ *                  data-source-id: read_db
  * </pre>
  *
  * @author zhouhao
@@ -53,8 +53,9 @@ public class ExpressionDataSourceSwitchStrategyMatcher extends CachedDataSourceS
     @Setter
     public static class ExpressionStrategy implements Strategy {
         private boolean useDefaultDataSource = false;
-        private boolean fallbackDefault      = false;
-        private String  dataSourceId         = null;
+        private boolean fallbackDefault = false;
+        private String dataSourceId = null;
+        private String database;
         private String expression;
         private String id;
 

+ 28 - 0
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/switcher/DatabaseSwitcher.java

@@ -0,0 +1,28 @@
+package org.hswebframework.web.datasource.switcher;
+
+public interface DatabaseSwitcher {
+    /**
+     * 使用上一次调用的数据源
+     */
+    void useLast();
+
+    /**
+     * @param database 数据库名称
+     */
+    void use(String database);
+
+    /**
+     * 切换为默认数据库
+     */
+    void useDefault();
+
+    /**
+     * @return 当前选择的数据库
+     */
+    String currentDatabase();
+
+    /**
+     * 重置切换记录,重置后,使用默认数据库
+     */
+    void reset();
+}

+ 5 - 5
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/switcher/DefaultDataSourceSwitcher.java

@@ -36,9 +36,9 @@ public class DefaultDataSourceSwitcher implements DataSourceSwitcher {
         if (logger.isDebugEnabled()) {
             String current = currentDataSourceId();
             if (null != current) {
-                logger.debug("try use last data source : {}", currentDataSourceId());
+                logger.debug("try use last datasource : {}", currentDataSourceId());
             } else {
-                logger.debug("try use last default data source");
+                logger.debug("try use last default datasource");
             }
         }
     }
@@ -48,7 +48,7 @@ public class DefaultDataSourceSwitcher implements DataSourceSwitcher {
         //添加对队尾
         getUsedHistoryQueue().addLast(dataSourceId);
         if (logger.isDebugEnabled()) {
-            logger.debug("try use data source : {}", dataSourceId);
+            logger.debug("try use datasource : {}", dataSourceId);
         }
     }
 
@@ -56,7 +56,7 @@ public class DefaultDataSourceSwitcher implements DataSourceSwitcher {
     public void useDefault() {
         getUsedHistoryQueue().addLast(DEFAULT_DATASOURCE_ID);
         if (logger.isDebugEnabled()) {
-            logger.debug("try use default data source");
+            logger.debug("try use default datasource");
         }
     }
 
@@ -77,7 +77,7 @@ public class DefaultDataSourceSwitcher implements DataSourceSwitcher {
     public void reset() {
         getUsedHistoryQueue().clear();
         if (logger.isDebugEnabled()) {
-            logger.debug("reset data source used history");
+            logger.debug("reset datasource history");
         }
     }
 }

+ 83 - 0
hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/switcher/DefaultDatabaseSwitcher.java

@@ -0,0 +1,83 @@
+package org.hswebframework.web.datasource.switcher;
+
+import org.hswebframework.web.ThreadLocalUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Deque;
+import java.util.LinkedList;
+
+/**
+ * 默认的动态数据库切换器,基于ThreadLocal,queue
+ *
+ * @author zhouhao
+ * @since 3.0.8
+ */
+public class DefaultDatabaseSwitcher implements DatabaseSwitcher {
+
+    //默认数据源标识
+    private static final String DEFAULT_DATASOURCE_ID = DatabaseSwitcher.class.getName() + "_default_";
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    private Deque<String> getUsedHistoryQueue() {
+        // 从ThreadLocal中获取一个使用记录
+        return ThreadLocalUtils.get(DefaultDatabaseSwitcher.class.getName() + "_queue", LinkedList::new);
+    }
+
+    @Override
+    public void useLast() {
+        // 没有上一次了
+        if (getUsedHistoryQueue().isEmpty()) {
+            return;
+        }
+        //移除队尾,则当前的队尾则为上一次的数据源
+        getUsedHistoryQueue().removeLast();
+        if (logger.isDebugEnabled()) {
+            String current = currentDatabase();
+            if (null != current) {
+                logger.debug("try use database : {}", currentDatabase());
+            } else {
+                logger.debug("try use last default database");
+            }
+        }
+    }
+
+    @Override
+    public void use(String dataSourceId) {
+        //添加对队尾
+        getUsedHistoryQueue().addLast(dataSourceId);
+        if (logger.isDebugEnabled()) {
+            logger.debug("try use database : {}", dataSourceId);
+        }
+    }
+
+    @Override
+    public void useDefault() {
+        getUsedHistoryQueue().addLast(DEFAULT_DATASOURCE_ID);
+        if (logger.isDebugEnabled()) {
+            logger.debug("try use default database");
+        }
+    }
+
+    @Override
+    public String currentDatabase() {
+        if (getUsedHistoryQueue().isEmpty()) {
+            return null;
+        }
+
+        String activeId = getUsedHistoryQueue().getLast();
+        if (DEFAULT_DATASOURCE_ID.equals(activeId)) {
+            return null;
+        }
+        return activeId;
+    }
+
+    @Override
+    public void reset() {
+        getUsedHistoryQueue().clear();
+        if (logger.isDebugEnabled()) {
+            logger.debug("reset database used history");
+        }
+    }
+}

+ 9 - 8
hsweb-datasource/hsweb-datasource-jta/README.md

@@ -25,7 +25,8 @@ spring:
 ```yaml
 hsweb:
   datasource:
-    test_ds:  # 数据源ID
+    jta:
+      test_ds:  # 数据源ID
         xa-data-source-class-name: com.alibaba.druid.pool.xa.DruidXADataSource
         xa-properties: # 数据源的配置属性
           url: jdbc:h2:mem:test;DB_CLOSE_ON_EXIT=FALSE
@@ -33,16 +34,16 @@ hsweb:
           password:
         max-pool-size: 20
         borrow-connection-timeout: 1000
-    test_ds2: # 数据源ID
-      xa-data-source-class-name: com.alibaba.druid.pool.xa.DruidXADataSource
-      xa-properties: # 数据源的配置属性
+      test_ds2: # 数据源ID
+        xa-data-source-class-name: com.alibaba.druid.pool.xa.DruidXADataSource
+        xa-properties: # 数据源的配置属性
         url: jdbc:mysql://localhost:3306/hsweb?pinGlobalTxToPhysicalConnection=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false
-#            url: jdbc:h2:mem:test2;DB_CLOSE_ON_EXIT=FALSE
+        #            url: jdbc:h2:mem:test2;DB_CLOSE_ON_EXIT=FALSE
         username: root
         password: "123456" # 纯数字密码要加上双引号,不然启动会报Cannot initialize AtomikosDataSourceBean
-      max-pool-size: 20
-      borrow-connection-timeout: 1000
-      init-timeout: 20
+        max-pool-size: 20
+        borrow-connection-timeout: 1000
+        init-timeout: 20
 ```
 
 自定义,将数据源配置放到数据库中,实现 ``DynamicDataSourceConfigRepository<AtomikosDataSourceConfig>`` 接口并注入到spring容器即可

+ 1 - 1
hsweb-datasource/hsweb-datasource-jta/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-datasource</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
 
     </parent>

+ 2 - 2
hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceAutoConfiguration.java

@@ -27,9 +27,9 @@ public class AtomikosDataSourceAutoConfiguration {
         return new AtomikosDataSourceBean();
     }
 
-    @ConditionalOnMissingBean(JtaDataSourceRepository.class)
+    @ConditionalOnMissingBean(DynamicDataSourceConfigRepository.class)
     @Bean
-    public InMemoryAtomikosDataSourceRepository memoryJtaDataSourceStore() {
+    public DynamicDataSourceConfigRepository inMemoryAtomikosDataSourceRepository() {
         return new InMemoryAtomikosDataSourceRepository();
     }
 

+ 1 - 1
hsweb-datasource/hsweb-datasource-web/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-datasource</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
 
         <relativePath>../pom.xml</relativePath>
     </parent>

+ 1 - 1
hsweb-datasource/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
 
         <relativePath>../pom.xml</relativePath>
     </parent>

+ 1 - 1
hsweb-logging/hsweb-access-logging-aop/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-logging</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-logging/hsweb-access-logging-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-logging</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-logging/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-starter/hsweb-spring-boot-starter/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-starter</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 11 - 7
hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/SystemVersion.java

@@ -202,18 +202,22 @@ class Version implements Comparable<Version> {
         if (null == version) {
             return;
         }
+        version = version.toLowerCase();
+
         boolean snapshot = version.toLowerCase().contains("snapshot");
-        version = version.toLowerCase()
-                .replace(".snapshot", "")
-                .replace("-snapshot", "")
-                .replace("-rc", "")
-                .replace("-release", "");
-        String[] ver = version.split("[.]");
+
+        String[] ver = version.split("[-]")[0].split("[.]");
         Integer[] numberVer = ListUtils.stringArr2intArr(ver);
-        if (numberVer.length < 1 || Arrays.stream(numberVer).anyMatch(Objects::isNull)) {
+        if (numberVer.length == 0) {
             numberVer = new Integer[]{1, 0, 0};
             log.warn("解析版本号失败:{},将使用默认版本号:1.0.0,请检查hsweb-starter.js配置内容!", version);
         }
+
+        for (int i = 0; i < numberVer.length; i++) {
+            if (numberVer[i] == null) {
+                numberVer[i] = 0;
+            }
+        }
         setVersion(numberVer[0],
                 numberVer.length <= 1 ? 0 : numberVer[1],
                 numberVer.length <= 2 ? 0 : numberVer[2],

+ 46 - 0
hsweb-starter/hsweb-spring-boot-starter/src/test/java/org/hswebframework/web/starter/SystemVersionTest.java

@@ -0,0 +1,46 @@
+package org.hswebframework.web.starter;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * @author zhouhao
+ * @since 3.0.8
+ */
+public class SystemVersionTest {
+
+    @Test
+    public void test() {
+        SystemVersion version = new SystemVersion();
+
+        version.setVersion("3.0-RELEASE");
+        Assert.assertEquals(version.getMajorVersion(), 3);
+        Assert.assertEquals(version.getMinorVersion(), 0);
+        Assert.assertEquals(version.getRevisionVersion(), 0);
+
+        version.setVersion("3.0.1-RELEASE");
+        Assert.assertEquals(version.getMajorVersion(), 3);
+        Assert.assertEquals(version.getMinorVersion(), 0);
+        Assert.assertEquals(version.getRevisionVersion(), 1);
+        version.setVersion("3.2.1-SNAPSHOT");
+        Assert.assertEquals(version.getMajorVersion(), 3);
+        Assert.assertEquals(version.getMinorVersion(), 2);
+        Assert.assertEquals(version.getRevisionVersion(), 1);
+        Assert.assertTrue(version.isSnapshot());
+
+        version.setVersion("3.1.2");
+        Assert.assertEquals(version.getMajorVersion(), 3);
+        Assert.assertEquals(version.getMinorVersion(), 1);
+        Assert.assertEquals(version.getRevisionVersion(), 2);
+
+        version.setVersion("3.1.2.RELEASE");
+        Assert.assertEquals(version.getMajorVersion(), 3);
+        Assert.assertEquals(version.getMinorVersion(), 1);
+        Assert.assertEquals(version.getRevisionVersion(), 2);
+
+    }
+
+
+}

+ 1 - 1
hsweb-starter/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-framework</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 4 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/AuthorizationSettingDetailMapper.xml

@@ -42,11 +42,13 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_autz_detail where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <select id="selectBySettingId" parameterType="String" resultMap="AuthorizationSettingDetailResultMap">
-        select * from s_autz_detail where setting_id =#{setting_id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        select * from ${_fullTableName} where setting_id =#{setting_id}
     </select>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 2 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/AuthorizationSettingMapper.xml

@@ -41,7 +41,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_autz_setting where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 4 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/AuthorizationSettingMenuMapper.xml

@@ -43,11 +43,13 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_autz_menu where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <select id="selectBySettingId" parameterType="String" resultMap="AuthorizationSettingMenuResultMap">
-        select * from s_autz_menu where setting_id =#{setting_id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        select * from ${_fullTableName} where setting_id =#{setting_id}
     </select>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 4 - 2
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/MenuGroupBindMapper.xml

@@ -42,7 +42,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_menu_group_bind where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">
@@ -56,7 +57,8 @@
     </update>
 
     <select id="queryByGroupId" parameterType="String" resultMap="MenuGroupBindResultMap">
-        select * from s_menu_group_bind where group_id =#{id}
+        <include refid="config"/>
+        select * from ${_fullTableName} where group_id =#{id}
     </select>
 
     <select id="query" parameterType="org.hswebframework.web.commons.entity.Entity" resultMap="MenuGroupBindResultMap">

+ 2 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/MenuGroupMapper.xml

@@ -44,7 +44,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from S_MENU_GROUP where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} here u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 3 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/MenuMapper.xml

@@ -46,7 +46,9 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_menu where u_id =#{id}
+        <include refid="config"/>
+        <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 2 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/PermissionMapper.xml

@@ -45,7 +45,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_permission where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 2 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/RoleMapper.xml

@@ -40,7 +40,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_role where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 2 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserMapper.xml

@@ -44,7 +44,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_user where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 8 - 4
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserRoleMapper.xml

@@ -38,19 +38,23 @@
     </insert>
 
     <delete id="deleteByRoleId" parameterType="String">
-        delete from s_user_role where role_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where role_id =#{id}
     </delete>
 
     <delete id="deleteByUserId" parameterType="String">
-        delete from s_user_role where user_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where user_id =#{id}
     </delete>
 
     <select id="selectByUserId" parameterType="string" resultMap="UserRoleResultMap">
-        select * from s_user_role where user_id=#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        select * from ${_fullTableName} where user_id=#{id}
     </select>
 
     <select id="selectByRoleId" parameterType="String" resultMap="UserRoleResultMap">
-        select * from s_user_role where role_id=#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        select * from ${_fullTableName} where role_id=#{id}
     </select>
 
 </mapper>

+ 2 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/authorization/UserSettingMapper.xml

@@ -45,7 +45,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_user_setting where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 1 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/pom.xml

@@ -22,7 +22,7 @@
     <parent>
         <artifactId>hsweb-system-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 4 - 4
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/main/resources/hsweb-starter.js

@@ -118,7 +118,7 @@ function install(context) {
         .addColumn().name("parent_id").alias("parentId").varchar(32).comment("父级ID").commit()
         .addColumn().name("menu_id").alias("menuId").varchar(32).notNull().comment("菜单ID").commit()
         .addColumn().name("setting_id").alias("settingId").varchar(64).notNull().comment("设置ID").commit()
-        .addColumn().name("path").varchar(512).notNull().comment("树编码").commit()
+        .addColumn().name("path").varchar(128).notNull().comment("树编码").commit()
         .addColumn().name("sort_index").alias("sortIndex").number(32).comment("树编码").commit()
         .addColumn().name("status").number(4, 0).comment("状态").commit()
         .addColumn().name("level").number(32, 0).comment("树深度").commit()
@@ -134,7 +134,7 @@ function install(context) {
         .addColumn().name("name").varchar(64).notNull().comment("名称").commit()
         .addColumn().name("parent_id").alias("parentId").varchar(32).comment("父级ID").commit()
         .addColumn().name("permission_id").alias("permissionId").varchar(2048).comment("权限ID").commit()
-        .addColumn().name("path").varchar(512).notNull().comment("树编码").commit()
+        .addColumn().name("path").varchar(128).notNull().comment("树编码").commit()
         .addColumn().name("sort_index").alias("sortIndex").number(32).comment("树编码").commit()
         .addColumn().name("describe").varchar(128).comment("备注").commit()
         .addColumn().name("url").varchar(2000).comment("URL").commit()
@@ -150,7 +150,7 @@ function install(context) {
         .addColumn().name("name").alias("name").comment("分组名称").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
         .addColumn().name("describe").alias("describe").comment("分组描述").jdbcType(java.sql.JDBCType.VARCHAR).length(64).commit()
         .addColumn().name("default_group").alias("defaultGroup").comment("是否默认").jdbcType(java.sql.JDBCType.DECIMAL).length(4, 0).commit()
-        .addColumn().name("path").alias("path").comment("树路径").jdbcType(java.sql.JDBCType.VARCHAR).length(512).commit()
+        .addColumn().name("path").alias("path").comment("树路径").jdbcType(java.sql.JDBCType.VARCHAR).length(128).commit()
         .addColumn().name("parent_id").alias("parentId").comment("父级id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
         .addColumn().name("level").alias("level").comment("树层级").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
         .addColumn().name("sort_index").alias("sortIndex").comment("排序序号").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
@@ -161,7 +161,7 @@ function install(context) {
         .addColumn().name("u_id").alias("id").comment("ID").jdbcType(java.sql.JDBCType.VARCHAR).length(32).primaryKey().commit()
         .addColumn().name("menu_id").alias("menuId").comment("菜单id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
         .addColumn().name("group_id").alias("groupId").comment("分组id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
-        .addColumn().name("path").alias("path").comment("树结构编码").jdbcType(java.sql.JDBCType.VARCHAR).length(512).commit()
+        .addColumn().name("path").alias("path").comment("树结构编码").jdbcType(java.sql.JDBCType.VARCHAR).length(128).commit()
         .addColumn().name("parent_id").alias("parentId").comment("父级id").jdbcType(java.sql.JDBCType.VARCHAR).length(32).commit()
         .addColumn().name("level").alias("level").comment("树层级").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()
         .addColumn().name("sort_index").alias("sortIndex").comment("排序序号").jdbcType(java.sql.JDBCType.DECIMAL).length(32, 0).commit()

+ 1 - 1
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-web/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-authorization</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-authorization/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-config/hsweb-system-config-api/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-system-config</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
 
         <relativePath>../pom.xml</relativePath>
     </parent>

+ 1 - 1
hsweb-system/hsweb-system-config/hsweb-system-config-local/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-system-config</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 2 - 1
hsweb-system/hsweb-system-config/hsweb-system-config-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/config/ConfigMapper.xml

@@ -26,7 +26,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_config where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 1 - 1
hsweb-system/hsweb-system-config/hsweb-system-config-starter/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-config</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-system/hsweb-system-config/hsweb-system-config-web/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-system-config</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

+ 1 - 1
hsweb-system/hsweb-system-config/pom.xml

@@ -23,7 +23,7 @@
     <parent>
         <artifactId>hsweb-system</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-api/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-dashboard</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-dashboard</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 1
hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-local/src/main/resources/org/hswebframework/web/dao/mybatis/mappers/dashboard/DashBoardConfigMapper.xml

@@ -30,7 +30,8 @@
     </insert>
 
     <delete id="deleteByPk" parameterType="String">
-        delete from s_dashboard_conf where u_id =#{id}
+        <include refid="config"/> <include refid="BasicMapper.switcher"/>
+        delete from ${_fullTableName} where u_id =#{id}
     </delete>
 
     <delete id="delete" parameterType="org.hswebframework.web.commons.entity.Entity">

+ 1 - 1
hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-starter/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-dashboard</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-dashboard/hsweb-system-dashboard-web/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system-dashboard</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 1 - 1
hsweb-system/hsweb-system-dashboard/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>hsweb-system</artifactId>
         <groupId>org.hswebframework.web</groupId>
-        <version>3.0.7</version>
+        <version>3.0.8</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 0 - 0
hsweb-system/hsweb-system-database-manager/hsweb-system-database-manager-api/pom.xml


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است