浏览代码

去除无用信息,改用spring-boot-starter

mxd 5 年之前
父节点
当前提交
667df1a735

+ 0 - 36
README.en.md

@@ -1,36 +0,0 @@
-# ssssssss
-
-#### Description
-{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
-
-#### Software Architecture
-Software architecture description
-
-#### Installation
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Instructions
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Contribution
-
-1.  Fork the repository
-2.  Create Feat_xxx branch
-3.  Commit your code
-4.  Create Pull Request
-
-
-#### Gitee Feature
-
-1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4.  The most valuable open source project [GVP](https://gitee.com/gvp)
-5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 3 - 7
pom.xml

@@ -10,9 +10,10 @@
         <version>2.1.5.RELEASE</version>
         <relativePath/>
     </parent>
-    <groupId>com.mxd</groupId>
-    <artifactId>sql-mvc</artifactId>
+    <groupId>com.ssssssss</groupId>
+    <artifactId>ssssssss-core</artifactId>
     <version>0.0.1</version>
+    <packaging>jar</packaging>
     <dependencies>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -30,11 +31,6 @@
             <artifactId>mysql-connector-java</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-jdbc</artifactId>
-        </dependency>
-
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>

+ 0 - 13
src/main/java/com/ssssssss/TestApplication.java

@@ -1,13 +0,0 @@
-package com.ssssssss;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class TestApplication {
-
-
-    public static void main(String[] args) {
-        SpringApplication.run(TestApplication.class);
-    }
-}

+ 0 - 56
src/main/java/com/ssssssss/configuration/S8Configuration.java

@@ -1,56 +0,0 @@
-package com.ssssssss.configuration;
-
-import com.ssssssss.executor.RequestExecutor;
-import com.ssssssss.executor.SqlExecutor;
-import com.ssssssss.executor.StatementExecutor;
-import com.ssssssss.expression.ExpressionEngine;
-import com.ssssssss.provider.PageProvider;
-import com.ssssssss.provider.impl.DefaultPageProvider;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.sql.DataSource;
-
-@Configuration
-public class S8Configuration {
-
-    @Bean
-    public RequestExecutor requestExecutor() {
-        return new RequestExecutor();
-    }
-
-    @Bean
-    public ExpressionEngine expressionEngine() {
-        return new ExpressionEngine();
-    }
-
-    @ConditionalOnMissingBean(PageProvider.class)
-    @Bean
-    public PageProvider pageProvider(){
-        return new DefaultPageProvider("page","size");
-    }
-
-    @Bean
-    public StatementExecutor statementExecutor(DataSource dataSource,PageProvider pageProvider) {
-        SqlExecutor sqlExecutor = new SqlExecutor(dataSource);
-        sqlExecutor.setMapUnderscoreToCamelCase(true);
-        return new StatementExecutor(sqlExecutor, pageProvider);
-    }
-
-    @Bean
-    public com.ssssssss.session.Configuration configuration(StatementExecutor statementExecutor, ExpressionEngine expressionEngine, RequestExecutor requestExecutor, RequestMappingHandlerMapping requestMappingHandlerMapping) throws NoSuchMethodException {
-        com.ssssssss.session.Configuration configuration = new com.ssssssss.session.Configuration();
-        configuration.setRequestMappingHandlerMapping(requestMappingHandlerMapping);
-        configuration.setRequestHandler(requestExecutor);
-        configuration.setXmlLocations("classpath*:ssssssss/*/**.xml");
-        configuration.setEnableRefresh(true);
-        configuration.setRequestHandleMethod(RequestExecutor.class.getDeclaredMethod("invoke", HttpServletRequest.class));
-        requestExecutor.setConfiguration(configuration);
-        requestExecutor.setExpressionEngine(expressionEngine);
-        requestExecutor.setStatementExecutor(statementExecutor);
-        return configuration;
-    }
-}

+ 2 - 2
src/main/java/com/ssssssss/session/Configuration.java

@@ -36,7 +36,7 @@ public class Configuration implements InitializingBean {
     /**
      * xml位置
      */
-    private String xmlLocations;
+    private String[] xmlLocations;
 
     /**
      * 是否自动刷新
@@ -103,7 +103,7 @@ public class Configuration implements InitializingBean {
         this.requestHandleMethod = requestHandleMethod;
     }
 
-    public void setXmlLocations(String xmlLocations) {
+    public void setXmlLocations(String[] xmlLocations) {
         this.xmlLocations = xmlLocations;
     }
 

+ 17 - 15
src/main/java/com/ssssssss/utils/XmlFileLoader.java

@@ -20,7 +20,7 @@ public class XmlFileLoader implements Runnable{
     /**
      * 路径表达式
      */
-    private String pattern;
+    private String[] patterns;
 
     private Configuration configuration;
 
@@ -33,26 +33,28 @@ public class XmlFileLoader implements Runnable{
 
     private ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
 
-    public XmlFileLoader(String pattern, Configuration configuration) {
-        this.pattern = pattern;
+    public XmlFileLoader(String[] patterns, Configuration configuration) {
+        this.patterns = patterns;
         this.configuration = configuration;
     }
 
     @Override
     public void run() {
         try {
-            // 提取所有符合表达式的XML文件
-            Resource[] resources = resourceResolver.getResources(this.pattern);
-            for (Resource resource : resources) {
-                File file = resource.getFile();
-                // 获取上次修改时间
-                Long lastModified = fileMap.get(resource.getDescription());
-                // 修改缓存
-                fileMap.put(resource.getDescription(), file.lastModified());
-                //判断是否更新
-                if (lastModified == null || lastModified < file.lastModified()) {
-                    XMLStatement xmlStatement = S8XMLFileParser.parse(file);
-                    xmlStatement.getSqlStatements().forEach(configuration::addStatement);
+            for (String pattern : this.patterns) {
+                // 提取所有符合表达式的XML文件
+                Resource[] resources = resourceResolver.getResources(pattern);
+                for (Resource resource : resources) {
+                    File file = resource.getFile();
+                    // 获取上次修改时间
+                    Long lastModified = fileMap.get(resource.getDescription());
+                    // 修改缓存
+                    fileMap.put(resource.getDescription(), file.lastModified());
+                    //判断是否更新
+                    if (lastModified == null || lastModified < file.lastModified()) {
+                        XMLStatement xmlStatement = S8XMLFileParser.parse(file);
+                        xmlStatement.getSqlStatements().forEach(configuration::addStatement);
+                    }
                 }
             }
         } catch (Exception e) {

+ 0 - 10
src/main/resources/application.properties

@@ -1,10 +0,0 @@
-server.port=9999
-server.servlet.context-path=/ssssssss
-logging.level.com.ssssssss=debug
-
-spring.datasource.url=jdbc:mysql://localhost/test?useSSL=false&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8
-spring.datasource.username=root
-spring.datasource.password=123456789
-spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.initialSize=5
-spring.datasource.minIdle=5

+ 0 - 20
src/main/resources/ssssssss/role/test.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<ssssssss request-mapping="/user" >
-    <sql id="customSql">
-        username,password
-    </sql>
-    <!-- select/update/insert/delete -->
-    <select-list request-mapping="/list" request-method="get" page="true">
-        select <include refid="customSql"/> from sys_user
-    </select-list>
-    <insert request-mapping="/add" return-type="boolean">
-        insert into sys_user(username,password,role_id) values(#{username},#{password},#{roleId})
-    </insert>
-    <select-one request-mapping="/one" request-method="get" return-type="map">
-        select username from sys_user
-        <if test="name != null and name.length() > 0">
-            where username like concat('%','${name}','%')
-        </if>
-        limit 1
-    </select-one>
-</ssssssss>