소스 검색

加入分片功能呢

wuxw 7 년 전
부모
커밋
02727f5389
78개의 변경된 파일301개의 추가작업 그리고 21872개의 파일을 삭제
  1. 6 0
      Api/pom.xml
  2. 13 1
      Api/src/main/java/com/java110/api/ApiApplicationStart.java
  3. 1 1
      CodeService/src/main/java/com/java110/code/CodeServiceApplicationStart.java
  4. 1 0
      CommunityService/pom.xml
  5. 1 1
      CommunityService/src/main/java/com/java110/community/CommunityServiceApplicationStart.java
  6. 6 0
      WebService/pom.xml
  7. 9 2
      WebService/src/main/java/com/java110/web/WebServiceApplicationStart.java
  8. 0 20
      WebService/src/main/resources/application-dev.yml
  9. 0 20
      WebService/src/main/resources/application-prod.yml
  10. 0 20
      WebService/src/main/resources/application-test.yml
  11. 0 1912
      java110-config/src/main/resources/css/bootstrap-grid.css
  12. 0 1
      java110-config/src/main/resources/css/bootstrap-grid.css.map
  13. 0 7
      java110-config/src/main/resources/css/bootstrap-grid.min.css
  14. 0 1
      java110-config/src/main/resources/css/bootstrap-grid.min.css.map
  15. 0 330
      java110-config/src/main/resources/css/bootstrap-reboot.css
  16. 0 1
      java110-config/src/main/resources/css/bootstrap-reboot.css.map
  17. 0 8
      java110-config/src/main/resources/css/bootstrap-reboot.min.css
  18. 0 1
      java110-config/src/main/resources/css/bootstrap-reboot.min.css.map
  19. 0 8950
      java110-config/src/main/resources/css/bootstrap.css
  20. 0 1
      java110-config/src/main/resources/css/bootstrap.css.map
  21. 0 7
      java110-config/src/main/resources/css/bootstrap.min.css
  22. 0 1
      java110-config/src/main/resources/css/bootstrap.min.css.map
  23. 0 31
      java110-config/src/main/resources/db/db.properties
  24. 0 10
      java110-config/src/main/resources/html/error.html
  25. 0 6433
      java110-config/src/main/resources/js/bootstrap.bundle.js
  26. 0 1
      java110-config/src/main/resources/js/bootstrap.bundle.js.map
  27. 0 7
      java110-config/src/main/resources/js/bootstrap.bundle.min.js
  28. 0 1
      java110-config/src/main/resources/js/bootstrap.bundle.min.js.map
  29. 0 3925
      java110-config/src/main/resources/js/bootstrap.js
  30. 0 1
      java110-config/src/main/resources/js/bootstrap.js.map
  31. 0 7
      java110-config/src/main/resources/js/bootstrap.min.js
  32. 0 1
      java110-config/src/main/resources/js/bootstrap.min.js.map
  33. 0 0
      java110-db/db/AgentService/create_table.sql
  34. 0 0
      java110-db/db/CommentService/create_table.sql
  35. 0 0
      java110-db/db/CommunityService/create_owner.sql
  36. 0 0
      java110-db/db/CommunityService/create_room.sql
  37. 0 0
      java110-db/db/CommunityService/create_table.sql
  38. 0 0
      java110-db/db/LogService/create_table.db
  39. 0 0
      java110-db/db/OrderService/create_table.sql
  40. 0 0
      java110-db/db/PropertyService/create_table.sql
  41. 0 0
      java110-db/db/ShopService/create_table.sql
  42. 0 0
      java110-db/db/StoreService/create_table.sql
  43. 0 0
      java110-db/db/UserService/create_table.db
  44. 0 0
      java110-db/db/WebService/create_table.db
  45. 0 0
      java110-db/db/WebService/menu.sql
  46. 51 0
      java110-db/pom.xml
  47. 2 3
      java110-service/src/main/java/com/java110/service/MyBatisConfig.java
  48. 1 1
      java110-service/src/main/java/com/java110/service/MyBatisMapperScannerConfig.java
  49. 13 11
      java110-service/src/main/java/com/java110/service/druid/DruidConfiguration.java
  50. 0 0
      java110-db/src/main/resources/mapper/agent/AgentServiceDaoImplMapper.xml
  51. 0 0
      java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml
  52. 0 0
      java110-db/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml
  53. 0 0
      java110-db/src/main/resources/mapper/comment/CommentServiceDaoImplMapper.xml
  54. 0 0
      java110-db/src/main/resources/mapper/common/CommonServiceDaoImplMapper.xml
  55. 0 0
      java110-db/src/main/resources/mapper/common/PrimaryKeyServiceDaoImplMapper.xml
  56. 0 0
      java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
  57. 0 0
      java110-db/src/main/resources/mapper/floor/FloorServiceDaoImplMapper.xml
  58. 0 0
      java110-db/src/main/resources/mapper/listener/ListenerServiceDaoImplMapper.xml
  59. 0 0
      java110-db/src/main/resources/mapper/log/LogServiceDaoImplMapper.xml
  60. 0 0
      java110-db/src/main/resources/mapper/order/OrderServiceDaoImplMapper.xml
  61. 0 0
      java110-db/src/main/resources/mapper/owner/OwnerServiceDaoImplMapper.xml
  62. 0 0
      java110-db/src/main/resources/mapper/product/ProductServiceDaoImplMapper.xml
  63. 0 0
      java110-db/src/main/resources/mapper/property/PropertyServiceDaoImplMapper.xml
  64. 0 0
      java110-db/src/main/resources/mapper/room/RoomAttrServiceDaoImplMapper.xml
  65. 0 0
      java110-db/src/main/resources/mapper/room/RoomServiceDaoImplMapper.xml
  66. 0 0
      java110-db/src/main/resources/mapper/rule/RuleDaoImplMapper.xml
  67. 0 0
      java110-db/src/main/resources/mapper/service/QueryServiceDAOImplMapper.xml
  68. 0 0
      java110-db/src/main/resources/mapper/shop/ShopServiceDaoImplMapper.xml
  69. 0 0
      java110-db/src/main/resources/mapper/store/MerchantMemberServiceDaoImplMapper.xml
  70. 0 0
      java110-db/src/main/resources/mapper/store/StoreServiceDaoImplMapper.xml
  71. 0 0
      java110-db/src/main/resources/mapper/unit/UnitServiceDaoImplMapper.xml
  72. 0 0
      java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
  73. 20 0
      java110-db/src/test/java/com/java110/AppTest.java
  74. 5 17
      java110-service/pom.xml
  75. 1 1
      java110-service/src/main/java/com/java110/service/aop/PageProcessAspect.java
  76. 58 46
      java110-service/src/main/java/com/java110/service/dao/impl/QueryServiceDAOImpl.java
  77. 101 91
      java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
  78. 12 0
      pom.xml

+ 6 - 0
Api/pom.xml

@@ -25,6 +25,12 @@
         <dependency>
             <groupId>com.java110</groupId>
             <artifactId>java110-service</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>java110-db</artifactId>
+                    <groupId>com.java110</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>

+ 13 - 1
Api/src/main/java/com/java110/api/ApiApplicationStart.java

@@ -1,3 +1,4 @@
+
 package com.java110.api;
 
 import com.java110.core.annotation.Java110ListenerDiscovery;
@@ -8,7 +9,9 @@ import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.web.client.RestTemplateBuilder;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
@@ -37,13 +40,18 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.api", "com.java110.core", "com.java110.event.service.api", "com.java110.cache"})
+@SpringBootApplication(scanBasePackages = {"com.java110.service.aop",
+        "com.java110.service.configuration",
+        "com.java110.service.controller",
+        "com.java110.service.filter",
+        "com.java110.service.init", "com.java110.api", "com.java110.core", "com.java110.event.service.api", "com.java110.cache"})
 @EnableDiscoveryClient
 @Java110ListenerDiscovery(listenerPublishClass = ServiceDataFlowEventPublishing.class,
         basePackages = {"com.java110.api.listener"})
 @EnableSwagger2
 //@EnableConfigurationProperties(EventProperties.class)
 @EnableFeignClients(basePackages = {"com.java110.core.smo"})
+@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
 public class ApiApplicationStart {
 
     private static Logger logger = LoggerFactory.getLogger(ApiApplicationStart.class);
@@ -73,6 +81,10 @@ public class ApiApplicationStart {
         return restTemplate;
     }
 
+    /**
+     * swagger 插件
+     * @return Docket 对象
+     */
     @Bean
     public Docket swaggerSpringMvcPlugin() {
         return new Docket(DocumentationType.SWAGGER_2)

+ 1 - 1
CodeService/src/main/java/com/java110/code/CodeServiceApplicationStart.java

@@ -36,7 +36,7 @@ import java.util.List;
  * @tag
  */
 @SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.code", "com.java110.core", "com.java110.cache",
-        "com.java110.config.properties.code"})
+        "com.java110.config.properties.code", "com.java110.db"})
 //@SpringBootApplication(scanBasePackages = {"com.java110.service","com.java110.code","com.java110.config.properties.code"})
 @EnableDiscoveryClient
 @EnableFeignClients(basePackages = {"com.java110.core.smo"})

+ 1 - 0
CommunityService/pom.xml

@@ -27,6 +27,7 @@
             <groupId>com.java110</groupId>
             <artifactId>java110-service</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.java110</groupId>
             <artifactId>java110-event</artifactId>

+ 1 - 1
CommunityService/src/main/java/com/java110/community/CommunityServiceApplicationStart.java

@@ -28,7 +28,7 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.community", "com.java110.core", "com.java110.cache"})
+@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.community", "com.java110.core", "com.java110.cache", "com.java110.db"})
 @EnableDiscoveryClient
 @Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
         basePackages = {"com.java110.community.listener"})

+ 6 - 0
WebService/pom.xml

@@ -25,6 +25,12 @@
         <dependency>
             <groupId>com.java110</groupId>
             <artifactId>java110-service</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>java110-db</artifactId>
+                    <groupId>com.java110</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>

+ 9 - 2
WebService/src/main/java/com/java110/web/WebServiceApplicationStart.java

@@ -9,7 +9,9 @@ import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
 import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
 import org.springframework.boot.web.client.RestTemplateBuilder;
@@ -32,10 +34,15 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.web", "com.java110.core", "com.java110.cache"})
+@SpringBootApplication(scanBasePackages = {"com.java110.service.aop",
+        "com.java110.service.configuration",
+        "com.java110.service.controller",
+        "com.java110.service.filter",
+        "com.java110.service.init",
+        "com.java110.web", "com.java110.core", "com.java110.cache"})
 @EnableDiscoveryClient
 //@EnableConfigurationProperties(EventProperties.class)
-
+@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
 public class WebServiceApplicationStart {
 
     /**

+ 0 - 20
WebService/src/main/resources/application-dev.yml

@@ -51,26 +51,6 @@ spring:
       max-idle: 100
       min-idle: 0
       timeout: 0
-  datasource:
-    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
-    minIdle: 5
-    validationQuery: SELECT 1 FROM DUAL
-    initialSize: 5
-    maxWait: 60000
-    filters: stat,wall,log4j
-    poolPreparedStatements: true
-    type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://dev.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8
-    maxPoolPreparedStatementPerConnectionSize: 20
-    password: TT@12345678
-    testOnBorrow: false
-    testWhileIdle: true
-    minEvictableIdleTimeMillis: 300000
-    timeBetweenEvictionRunsMillis: 60000
-    testOnReturn: false
-    driverClassName: com.mysql.jdbc.Driver
-    maxActive: 20
-    username: TT
 
   thymeleaf:
     mode: LEGACYHTML5

+ 0 - 20
WebService/src/main/resources/application-prod.yml

@@ -51,26 +51,6 @@ spring:
       max-idle: 100
       min-idle: 0
       timeout: 0
-  datasource:
-    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
-    minIdle: 5
-    validationQuery: SELECT 1 FROM DUAL
-    initialSize: 5
-    maxWait: 60000
-    filters: stat,wall,log4j
-    poolPreparedStatements: true
-    type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://prod.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8
-    maxPoolPreparedStatementPerConnectionSize: 20
-    password: TT@12345678
-    testOnBorrow: false
-    testWhileIdle: true
-    minEvictableIdleTimeMillis: 300000
-    timeBetweenEvictionRunsMillis: 60000
-    testOnReturn: false
-    driverClassName: com.mysql.jdbc.Driver
-    maxActive: 20
-    username: TT
 
   thymeleaf:
     mode: LEGACYHTML5

+ 0 - 20
WebService/src/main/resources/application-test.yml

@@ -51,26 +51,6 @@ spring:
       max-idle: 100
       min-idle: 0
       timeout: 0
-  datasource:
-    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
-    minIdle: 5
-    validationQuery: SELECT 1 FROM DUAL
-    initialSize: 5
-    maxWait: 60000
-    filters: stat,wall,log4j
-    poolPreparedStatements: true
-    type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://test.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8
-    maxPoolPreparedStatementPerConnectionSize: 20
-    password: TT@12345678
-    testOnBorrow: false
-    testWhileIdle: true
-    minEvictableIdleTimeMillis: 300000
-    timeBetweenEvictionRunsMillis: 60000
-    testOnReturn: false
-    driverClassName: com.mysql.jdbc.Driver
-    maxActive: 20
-    username: TT
 
   thymeleaf:
     mode: LEGACYHTML5

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1912
java110-config/src/main/resources/css/bootstrap-grid.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/css/bootstrap-grid.css.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 7
java110-config/src/main/resources/css/bootstrap-grid.min.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/css/bootstrap-grid.min.css.map


+ 0 - 330
java110-config/src/main/resources/css/bootstrap-reboot.css

@@ -1,330 +0,0 @@
-/*!
- * Bootstrap Reboot v4.1.0 (https://getbootstrap.com/)
- * Copyright 2011-2018 The Bootstrap Authors
- * Copyright 2011-2018 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
- */
-*,
-*::before,
-*::after {
-  box-sizing: border-box;
-}
-
-html {
-  font-family: sans-serif;
-  line-height: 1.15;
-  -webkit-text-size-adjust: 100%;
-  -ms-text-size-adjust: 100%;
-  -ms-overflow-style: scrollbar;
-  -webkit-tap-highlight-color: transparent;
-}
-
-@-ms-viewport {
-  width: device-width;
-}
-
-article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section {
-  display: block;
-}
-
-body {
-  margin: 0;
-  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
-  font-size: 1rem;
-  font-weight: 400;
-  line-height: 1.5;
-  color: #212529;
-  text-align: left;
-  background-color: #fff;
-}
-
-[tabindex="-1"]:focus {
-  outline: 0 !important;
-}
-
-hr {
-  box-sizing: content-box;
-  height: 0;
-  overflow: visible;
-}
-
-h1, h2, h3, h4, h5, h6 {
-  margin-top: 0;
-  margin-bottom: 0.5rem;
-}
-
-p {
-  margin-top: 0;
-  margin-bottom: 1rem;
-}
-
-abbr[title],
-abbr[data-original-title] {
-  text-decoration: underline;
-  -webkit-text-decoration: underline dotted;
-  text-decoration: underline dotted;
-  cursor: help;
-  border-bottom: 0;
-}
-
-address {
-  margin-bottom: 1rem;
-  font-style: normal;
-  line-height: inherit;
-}
-
-ol,
-ul,
-dl {
-  margin-top: 0;
-  margin-bottom: 1rem;
-}
-
-ol ol,
-ul ul,
-ol ul,
-ul ol {
-  margin-bottom: 0;
-}
-
-dt {
-  font-weight: 700;
-}
-
-dd {
-  margin-bottom: .5rem;
-  margin-left: 0;
-}
-
-blockquote {
-  margin: 0 0 1rem;
-}
-
-dfn {
-  font-style: italic;
-}
-
-b,
-strong {
-  font-weight: bolder;
-}
-
-small {
-  font-size: 80%;
-}
-
-sub,
-sup {
-  position: relative;
-  font-size: 75%;
-  line-height: 0;
-  vertical-align: baseline;
-}
-
-sub {
-  bottom: -.25em;
-}
-
-sup {
-  top: -.5em;
-}
-
-a {
-  color: #007bff;
-  text-decoration: none;
-  background-color: transparent;
-  -webkit-text-decoration-skip: objects;
-}
-
-a:hover {
-  color: #0056b3;
-  text-decoration: underline;
-}
-
-a:not([href]):not([tabindex]) {
-  color: inherit;
-  text-decoration: none;
-}
-
-a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
-  color: inherit;
-  text-decoration: none;
-}
-
-a:not([href]):not([tabindex]):focus {
-  outline: 0;
-}
-
-pre,
-code,
-kbd,
-samp {
-  font-family: monospace, monospace;
-  font-size: 1em;
-}
-
-pre {
-  margin-top: 0;
-  margin-bottom: 1rem;
-  overflow: auto;
-  -ms-overflow-style: scrollbar;
-}
-
-figure {
-  margin: 0 0 1rem;
-}
-
-img {
-  vertical-align: middle;
-  border-style: none;
-}
-
-svg:not(:root) {
-  overflow: hidden;
-}
-
-table {
-  border-collapse: collapse;
-}
-
-caption {
-  padding-top: 0.75rem;
-  padding-bottom: 0.75rem;
-  color: #6c757d;
-  text-align: left;
-  caption-side: bottom;
-}
-
-th {
-  text-align: inherit;
-}
-
-label {
-  display: inline-block;
-  margin-bottom: 0.5rem;
-}
-
-button {
-  border-radius: 0;
-}
-
-button:focus {
-  outline: 1px dotted;
-  outline: 5px auto -webkit-focus-ring-color;
-}
-
-input,
-button,
-select,
-optgroup,
-textarea {
-  margin: 0;
-  font-family: inherit;
-  font-size: inherit;
-  line-height: inherit;
-}
-
-button,
-input {
-  overflow: visible;
-}
-
-button,
-select {
-  text-transform: none;
-}
-
-button,
-html [type="button"],
-[type="reset"],
-[type="submit"] {
-  -webkit-appearance: button;
-}
-
-button::-moz-focus-inner,
-[type="button"]::-moz-focus-inner,
-[type="reset"]::-moz-focus-inner,
-[type="submit"]::-moz-focus-inner {
-  padding: 0;
-  border-style: none;
-}
-
-input[type="radio"],
-input[type="checkbox"] {
-  box-sizing: border-box;
-  padding: 0;
-}
-
-input[type="date"],
-input[type="time"],
-input[type="datetime-local"],
-input[type="month"] {
-  -webkit-appearance: listbox;
-}
-
-textarea {
-  overflow: auto;
-  resize: vertical;
-}
-
-fieldset {
-  min-width: 0;
-  padding: 0;
-  margin: 0;
-  border: 0;
-}
-
-legend {
-  display: block;
-  width: 100%;
-  max-width: 100%;
-  padding: 0;
-  margin-bottom: .5rem;
-  font-size: 1.5rem;
-  line-height: inherit;
-  color: inherit;
-  white-space: normal;
-}
-
-progress {
-  vertical-align: baseline;
-}
-
-[type="number"]::-webkit-inner-spin-button,
-[type="number"]::-webkit-outer-spin-button {
-  height: auto;
-}
-
-[type="search"] {
-  outline-offset: -2px;
-  -webkit-appearance: none;
-}
-
-[type="search"]::-webkit-search-cancel-button,
-[type="search"]::-webkit-search-decoration {
-  -webkit-appearance: none;
-}
-
-::-webkit-file-upload-button {
-  font: inherit;
-  -webkit-appearance: button;
-}
-
-output {
-  display: inline-block;
-}
-
-summary {
-  display: list-item;
-  cursor: pointer;
-}
-
-template {
-  display: none;
-}
-
-[hidden] {
-  display: none !important;
-}
-/*# sourceMappingURL=bootstrap-reboot.css.map */

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/css/bootstrap-reboot.css.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 8
java110-config/src/main/resources/css/bootstrap-reboot.min.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/css/bootstrap-reboot.min.css.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 8950
java110-config/src/main/resources/css/bootstrap.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/css/bootstrap.css.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 7
java110-config/src/main/resources/css/bootstrap.min.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/css/bootstrap.min.css.map


+ 0 - 31
java110-config/src/main/resources/db/db.properties

@@ -1,31 +0,0 @@
-#数据库设置
-spring.datasource.type=com.alibaba.druid.pool.DruidDataSource  
-spring.datasource.driverClassName=com.mysql.jdbc.Driver  
-spring.datasource.url=jdbc:mysql://192.168.31.199:3306/TT  
-spring.datasource.username=TT  
-spring.datasource.password=TT@12345678  
-#--------------------------
-# 下面为连接池的补充设置,应用到上面所有数据源中
-# 初始化大小,最小,最大
-spring.datasource.initialSize=5  
-spring.datasource.minIdle=5  
-spring.datasource.maxActive=20  
-# 配置获取连接等待超时的时间
-spring.datasource.maxWait=60000  
-# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-spring.datasource.timeBetweenEvictionRunsMillis=60000  
-# 配置一个连接在池中最小生存的时间,单位是毫秒
-spring.datasource.minEvictableIdleTimeMillis=300000  
-spring.datasource.validationQuery=SELECT 1 FROM DUAL  
-spring.datasource.testWhileIdle=true  
-spring.datasource.testOnBorrow=false  
-spring.datasource.testOnReturn=false  
-# 打开PSCache,并且指定每个连接上PSCache的大小
-spring.datasource.poolPreparedStatements=true  
-spring.datasource.maxPoolPreparedStatementPerConnectionSize=20  
-# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-spring.datasource.filters=stat,wall,log4j  
-# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
-spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000  
-# 合并多个DruidDataSource的监控数据
-#spring.datasource.useGlobalDataSourceStat=true

+ 0 - 10
java110-config/src/main/resources/html/error.html

@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>出错了</title>
-</head>
-<body>
-<h1>${code},${msg}</h1>
-</body>
-</html>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 6433
java110-config/src/main/resources/js/bootstrap.bundle.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/js/bootstrap.bundle.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 7
java110-config/src/main/resources/js/bootstrap.bundle.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/js/bootstrap.bundle.min.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 3925
java110-config/src/main/resources/js/bootstrap.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/js/bootstrap.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 7
java110-config/src/main/resources/js/bootstrap.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
java110-config/src/main/resources/js/bootstrap.min.js.map


java110-config/db/AgentService/create_table.sql → java110-db/db/AgentService/create_table.sql


java110-config/db/CommentService/create_table.sql → java110-db/db/CommentService/create_table.sql


java110-config/db/CommunityService/create_owner.sql → java110-db/db/CommunityService/create_owner.sql


java110-config/db/CommunityService/create_room.sql → java110-db/db/CommunityService/create_room.sql


java110-config/db/CommunityService/create_table.sql → java110-db/db/CommunityService/create_table.sql


java110-config/db/LogService/create_table.db → java110-db/db/LogService/create_table.db


java110-config/db/OrderService/create_table.sql → java110-db/db/OrderService/create_table.sql


java110-config/db/PropertyService/create_table.sql → java110-db/db/PropertyService/create_table.sql


java110-config/db/ShopService/create_table.sql → java110-db/db/ShopService/create_table.sql


java110-config/db/StoreService/create_table.sql → java110-db/db/StoreService/create_table.sql


java110-config/db/UserService/create_table.db → java110-db/db/UserService/create_table.db


java110-config/db/WebService/create_table.db → java110-db/db/WebService/create_table.db


java110-config/db/WebService/menu.sql → java110-db/db/WebService/menu.sql


+ 51 - 0
java110-db/pom.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>MicroCommunity</artifactId>
+        <groupId>com.java110</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>java110-db</artifactId>
+    <packaging>jar</packaging>
+
+    <name>java110-db</name>
+    <!-- FIXME change it to the project's website -->
+    <url>http://www.example.com</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+        </dependency>
+        <!--mapper-->
+        <dependency>
+            <groupId>tk.mybatis</groupId>
+            <artifactId>mapper-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.shardingsphere</groupId>
+            <artifactId>sharding-jdbc</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 2 - 3
java110-service/src/main/java/com/java110/service/MyBatisConfig.java

@@ -1,4 +1,4 @@
-package com.java110.service;
+package com.java110.db;
 
 import com.alibaba.druid.pool.DruidDataSource;
 import org.apache.ibatis.session.SqlSessionFactory;
@@ -32,13 +32,12 @@ public class MyBatisConfig implements TransactionManagementConfigurer {
 
     @Bean(name = "dataSource")
     @ConfigurationProperties(prefix = "spring.datasource")
-    public DataSource dataSource(){
+    public DataSource dataSource() {
         DruidDataSource druidDataSource = new DruidDataSource();
         return druidDataSource;
     }
 
 
-
     @Bean(name = "sqlSessionFactory")
     public SqlSessionFactory sqlSessionFactoryBean() {
         SqlSessionFactoryBean bean = new SqlSessionFactoryBean();

+ 1 - 1
java110-service/src/main/java/com/java110/service/MyBatisMapperScannerConfig.java

@@ -1,4 +1,4 @@
-package com.java110.service;
+package com.java110.db;
 
 import org.mybatis.spring.mapper.MapperScannerConfigurer;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;

+ 13 - 11
java110-service/src/main/java/com/java110/service/druid/DruidConfiguration.java

@@ -1,4 +1,4 @@
-package com.java110.service.druid;
+package com.java110.db.druid;
 
 import com.alibaba.druid.support.http.StatViewServlet;
 import com.alibaba.druid.support.http.WebStatFilter;
@@ -14,38 +14,40 @@ import org.springframework.context.annotation.Bean;
  */
 public class DruidConfiguration {
 
-    private final static Logger logger = LoggerFactory.getLogger(DruidConfiguration.class);
+    private static Logger logger = LoggerFactory.getLogger(DruidConfiguration.class);
 
 
     /**
      * 注册一个StatViewServlet
+     *
      * @return
      */
     @Bean
-    public ServletRegistrationBean DruidStatViewServle2(){
+    public ServletRegistrationBean DruidStatViewServle2() {
         //org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册.
-        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/druid2/*");
+        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid2/*");
 
         //添加初始化参数:initParams
 
         //白名单:
-        servletRegistrationBean.addInitParameter("allow","127.0.0.1");
+        servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
         //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page.
-        servletRegistrationBean.addInitParameter("deny","192.168.1.73");
+        servletRegistrationBean.addInitParameter("deny", "192.168.1.73");
         //登录查看信息的账号密码.
-        servletRegistrationBean.addInitParameter("loginUsername","admin2");
-        servletRegistrationBean.addInitParameter("loginPassword","123456");
+        servletRegistrationBean.addInitParameter("loginUsername", "admin2");
+        servletRegistrationBean.addInitParameter("loginPassword", "123456");
         //是否能够重置数据.
-        servletRegistrationBean.addInitParameter("resetEnable","false");
+        servletRegistrationBean.addInitParameter("resetEnable", "false");
         return servletRegistrationBean;
     }
 
     /**
      * 注册一个:filterRegistrationBean
+     *
      * @return
      */
     @Bean
-    public FilterRegistrationBean druidStatFilter2(){
+    public FilterRegistrationBean druidStatFilter2() {
 
         FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
 
@@ -53,7 +55,7 @@ public class DruidConfiguration {
         filterRegistrationBean.addUrlPatterns("/*");
 
         //添加不需要忽略的格式信息.
-        filterRegistrationBean.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid2/*");
+        filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid2/*");
         return filterRegistrationBean;
     }
 }

java110-config/src/main/resources/mapper/agent/AgentServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/agent/AgentServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml → java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml


java110-config/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml → java110-db/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml


java110-config/src/main/resources/mapper/comment/CommentServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/comment/CommentServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/common/CommonServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/common/CommonServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/common/PrimaryKeyServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/common/PrimaryKeyServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/floor/FloorServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/floor/FloorServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/listener/ListenerServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/listener/ListenerServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/log/LogServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/log/LogServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/order/OrderServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/order/OrderServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/owner/OwnerServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/owner/OwnerServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/product/ProductServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/product/ProductServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/property/PropertyServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/property/PropertyServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/room/RoomAttrServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/room/RoomAttrServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/room/RoomServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/room/RoomServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/rule/RuleDaoImplMapper.xml → java110-db/src/main/resources/mapper/rule/RuleDaoImplMapper.xml


java110-config/src/main/resources/mapper/service/QueryServiceDAOImplMapper.xml → java110-db/src/main/resources/mapper/service/QueryServiceDAOImplMapper.xml


java110-config/src/main/resources/mapper/shop/ShopServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/shop/ShopServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/store/MerchantMemberServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/store/MerchantMemberServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/store/StoreServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/store/StoreServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/unit/UnitServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/unit/UnitServiceDaoImplMapper.xml


java110-config/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml → java110-db/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml


+ 20 - 0
java110-db/src/test/java/com/java110/AppTest.java

@@ -0,0 +1,20 @@
+package com.java110;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+{
+    /**
+     * Rigorous Test :-)
+     */
+    @Test
+    public void shouldAnswerWithTrue()
+    {
+        assertTrue( true );
+    }
+}

+ 5 - 17
java110-service/pom.xml

@@ -28,23 +28,6 @@
             <artifactId>java110-core</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.mybatis.spring.boot</groupId>
-            <artifactId>mybatis-spring-boot-starter</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>druid</artifactId>
-        </dependency>
-
-
-        <!--mapper-->
-        <dependency>
-            <groupId>tk.mybatis</groupId>
-            <artifactId>mapper-spring-boot-starter</artifactId>
-        </dependency>
-
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-aop</artifactId>
@@ -72,6 +55,11 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>com.java110</groupId>
+            <artifactId>java110-db</artifactId>
+        </dependency>
+
 
         <dependency>
             <groupId>mysql</groupId>

+ 1 - 1
java110-service/src/main/java/com/java110/service/aop/PageProcessAspect.java

@@ -36,7 +36,7 @@ import java.util.Map;
 @Component
 public class PageProcessAspect {
 
-    private  static Logger logger = LoggerFactory.getLogger(PageProcessAspect.class);
+    private static Logger logger = LoggerFactory.getLogger(PageProcessAspect.class);
 
     @Pointcut("execution(public * com.java110..*.*Controller.*(..)) || execution(public * com.java110..*.*Rest.*(..))")
     public void dataProcess() {

+ 58 - 46
java110-service/src/main/java/com/java110/service/dao/impl/QueryServiceDAOImpl.java

@@ -10,8 +10,16 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.sql.*;
-import java.util.*;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * Created by wuxw on 2018/4/20.
@@ -23,35 +31,36 @@ public class QueryServiceDAOImpl extends BaseServiceDao implements IQueryService
     private final static Logger logger = LoggerFactory.getLogger(QueryServiceDAOImpl.class);
 
     /**
-     *  防止sql注入 改造成直接用prepareStatement 预处理sql
+     * 防止sql注入 改造成直接用prepareStatement 预处理sql
+     *
      * @param sql
      * @param params
      * @return
      */
     @Override
-    public List<Map<String,Object>> executeSql(String sql,Object[] params) {
-        logger.debug("----【queryServiceDAOImpl.executeSql】入参 : "+sql+" params= "+params);
+    public List<Map<String, Object>> executeSql(String sql, Object[] params) {
+        logger.debug("----【queryServiceDAOImpl.executeSql】入参 : " + sql + " params= " + params);
         Connection conn = null;
         ResultSet rs = null;
         PreparedStatement ps = null;
-        List<Map<String,Object>> mapList = new ArrayList<Map<String,Object>>();
+        List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
         try {
             conn = sqlSessionTemplate.getConnection();
             ps = conn.prepareStatement(sql);
-            if(params != null){
-                for(int i = 0 ; i < params.length ; i++){
-                    ps.setObject(i+1, params[i]);
+            if (params != null) {
+                for (int i = 0; i < params.length; i++) {
+                    ps.setObject(i + 1, params[i]);
                 }
             }
             rs = ps.executeQuery();
             //精髓的地方就在这里,类ResultSet有getMetaData()会返回数据的列和对应的值的信息,然后我们将列名和对应的值作为map的键值存入map对象之中...
             ResultSetMetaData rsmd = rs.getMetaData();
-            while(rs.next()){
-                Map<String,Object> map = new HashMap<String,Object>();
-                for(int i = 0 ; i < rsmd.getColumnCount() ; i++){
-                    String col_name = rsmd.getColumnLabel(i+1);
+            while (rs.next()) {
+                Map<String, Object> map = new HashMap<String, Object>();
+                for (int i = 0; i < rsmd.getColumnCount(); i++) {
+                    String col_name = rsmd.getColumnLabel(i + 1);
                     Object col_value = rs.getObject(col_name);
-                    if(col_value == null){
+                    if (col_value == null) {
                         col_value = "";
                     }
                     map.put(col_name, col_value);
@@ -60,15 +69,15 @@ public class QueryServiceDAOImpl extends BaseServiceDao implements IQueryService
             }
             return mapList;
         } catch (SQLException e) {
-            logger.error("执行sql异常:" + sql +params,e);
+            logger.error("执行sql异常:" + sql + params, e);
             return null;
-        }finally{
+        } finally {
             try {
                 //conn.close();
-                if( ps!=null) {
+                if (ps != null) {
                     ps.close();
                 }
-                if(rs != null) {
+                if (rs != null) {
                     rs.close();
                 }
             } catch (SQLException e) {
@@ -80,28 +89,29 @@ public class QueryServiceDAOImpl extends BaseServiceDao implements IQueryService
 
     /**
      * 防止sql注入 改造成直接用prepareStatement 预处理sql
+     *
      * @param sql
      * @param params
      * @return
      */
-    public int updateSql(String sql,Object[] params){
-        logger.debug("----【queryServiceDAOImpl.updateSql】入参 : "+sql+" params= "+params);
+    public int updateSql(String sql, Object[] params) {
+        logger.debug("----【queryServiceDAOImpl.updateSql】入参 : " + sql + " params= " + params);
         Connection conn = null;
         PreparedStatement ps = null;
         try {
             conn = sqlSessionTemplate.getConnection();
             ps = conn.prepareStatement(sql);
-            if(params != null){
-                for(int i = 0 ; i < params.length ; i++){
-                    ps.setObject(i+1, params[i]);
+            if (params != null) {
+                for (int i = 0; i < params.length; i++) {
+                    ps.setObject(i + 1, params[i]);
                 }
             }
             return ps.executeUpdate();
             //精髓的地方就在这里,类ResultSet有getMetaData()会返回数据的列和对应的值的信息,然后我们将列名和对应的值作为map的键值存入map对象之中...
         } catch (SQLException e) {
-            logger.error("执行sql异常:" + sql +params,e);
+            logger.error("执行sql异常:" + sql + params, e);
             return 0;
-        }finally{
+        } finally {
             try {
                 //conn.close();
                 ps.close();
@@ -113,51 +123,52 @@ public class QueryServiceDAOImpl extends BaseServiceDao implements IQueryService
     }
 
     @Override
-    public String executeProc(Map<String,Object> paramsInfo) {
+    public String executeProc(Map<String, Object> paramsInfo) {
         String paramsInfoStr = "";
-        for (String key : paramsInfo.keySet()){
-            if("procName".equals(key)){
+        for (String key : paramsInfo.keySet()) {
+            if ("procName".equals(key)) {
                 paramsInfoStr += (paramsInfo.get("procName") + "(");
-            }else{
-                if(StringUtil.isNullOrNone(paramsInfo.get(key))){
+            } else {
+                if (StringUtil.isNullOrNone(paramsInfo.get(key))) {
                     paramsInfoStr += "'',";
-                }else{
-                    paramsInfoStr += "'"+paramsInfo.get(key)+"',";
+                } else {
+                    paramsInfoStr += "'" + paramsInfo.get(key) + "',";
                 }
             }
         }
 
-        paramsInfo.put("paramsInfo",paramsInfoStr);
+        paramsInfo.put("paramsInfo", paramsInfoStr);
 
-        sqlSessionTemplate.selectOne("queryServiceDAOImpl.executeProc",paramsInfo);
+        sqlSessionTemplate.selectOne("queryServiceDAOImpl.executeProc", paramsInfo);
 
-        return paramsInfo.get("resMsg") ==null ?"" :paramsInfo.get("resMsg").toString();
+        return paramsInfo.get("resMsg") == null ? "" : paramsInfo.get("resMsg").toString();
     }
 
     @Override
-    public String updateProc(Map<String,Object> paramsInfo) {
+    public String updateProc(Map<String, Object> paramsInfo) {
         String paramsInfoStr = "";
-        for (String key : paramsInfo.keySet()){
-            if("procName".equals(key)){
+        for (String key : paramsInfo.keySet()) {
+            if ("procName".equals(key)) {
                 paramsInfoStr += (paramsInfo.get("procName") + "(");
-            }else{
-                if(StringUtil.isNullOrNone(paramsInfo.get(key))){
+            } else {
+                if (StringUtil.isNullOrNone(paramsInfo.get(key))) {
                     paramsInfoStr += "'',";
-                }else{
-                    paramsInfoStr += "'"+paramsInfo.get(key)+"',";
+                } else {
+                    paramsInfoStr += "'" + paramsInfo.get(key) + "',";
                 }
             }
         }
 
-        paramsInfo.put("paramsInfo",paramsInfoStr);
+        paramsInfo.put("paramsInfo", paramsInfoStr);
 
-        sqlSessionTemplate.update("queryServiceDAOImpl.updateProc",paramsInfo);
+        sqlSessionTemplate.update("queryServiceDAOImpl.updateProc", paramsInfo);
 
-        return paramsInfo.get("resMsg") ==null ?"" :paramsInfo.get("resMsg").toString();
+        return paramsInfo.get("resMsg") == null ? "" : paramsInfo.get("resMsg").toString();
     }
 
     /**
      * 查询 ServiceSql
+     *
      * @return
      */
     @Override
@@ -168,9 +179,10 @@ public class QueryServiceDAOImpl extends BaseServiceDao implements IQueryService
 
     /**
      * 查询服务业务信息
+     *
      * @return
      */
-    public List<ServiceBusiness> qureyServiceBusiness(){
+    public List<ServiceBusiness> qureyServiceBusiness() {
         return sqlSessionTemplate.selectList("queryServiceDAOImpl.queryServiceBusiness");
     }
 }

+ 101 - 91
java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java

@@ -38,7 +38,7 @@ import java.util.TreeMap;
 public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSMO {
 
 
-    private final static Logger logger = LoggerFactory.getLogger(QueryServiceSMOImpl.class);
+    private static Logger logger = LoggerFactory.getLogger(QueryServiceSMOImpl.class);
 
 
     @Autowired
@@ -51,62 +51,63 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
         try {
             ServiceSql currentServiceSql = ServiceSqlCache.getServiceSql(dataQuery.getServiceCode());
             if (currentServiceSql == null) {
-                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"未提供该服务 serviceCode = " + dataQuery.getServiceCode());
+                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "未提供该服务 serviceCode = " + dataQuery.getServiceCode());
             }
             if ("".equals(currentServiceSql.getQueryModel())) {
-                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"配置服务 serviceCode = " + dataQuery.getServiceCode() + " 错误,未配置QueryModel,请联系管理员");
+                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "配置服务 serviceCode = " + dataQuery.getServiceCode() + " 错误,未配置QueryModel,请联系管理员");
             }
             //请求参数校验
             List<String> sysParams = currentServiceSql.getParamList();
-            for(String param : sysParams) {
-                if(!dataQuery.getRequestParams().containsKey(param)){
+            for (String param : sysParams) {
+                if (!dataQuery.getRequestParams().containsKey(param)) {
                     //2019-04-10 这里修改为不抛出异常而是写为空字符串
                     //throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR,"请求参数错误,请求报文中未包含参数 " + param + " 信息");
-                    dataQuery.getRequestParams().put(param,"");
+                    dataQuery.getRequestParams().put(param, "");
                 }
             }
             dataQuery.setServiceSql(currentServiceSql);
             if (CommonConstant.QUERY_MODEL_SQL.equals(currentServiceSql.getQueryModel())) {
                 doExecuteSql(dataQuery);
-            }else if(CommonConstant.QUERY_MODE_JAVA.equals(currentServiceSql.getQueryModel())){
+            } else if (CommonConstant.QUERY_MODE_JAVA.equals(currentServiceSql.getQueryModel())) {
                 doExecuteJava(dataQuery);
-            }else {
+            } else {
                 doExecuteProc(dataQuery);
             }
             responseEntity = new ResponseEntity<String>(dataQuery.getResponseInfo().toJSONString(), HttpStatus.OK);
-        }catch (BusinessException e){
-            logger.error("公用查询异常:",e);
+        } catch (BusinessException e) {
+            logger.error("公用查询异常:", e);
             /*dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_PARAM_ERROR,
                     e.getMessage()));*/
-            responseEntity = new ResponseEntity<String>("请求发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
-        }finally {
+            responseEntity = new ResponseEntity<String>("请求发生异常," + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+        } finally {
             dataQuery.setResponseEntity(responseEntity);
         }
 
 
     }
+
     @Override
     public void commonDoService(DataQuery dataQuery) throws BusinessException {
         //查询缓存查询 对应处理的ServiceSql
         try {
             ServiceSql currentServiceSql = ServiceSqlCache.getServiceSql(dataQuery.getServiceCode());
             if (currentServiceSql == null) {
-                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"未提供该服务 serviceCode = " + dataQuery.getServiceCode());
+                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "未提供该服务 serviceCode = " + dataQuery.getServiceCode());
             }
             if ("".equals(currentServiceSql.getQueryModel())) {
-                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"配置服务 serviceCode = " + dataQuery.getServiceCode() + " 错误,未配置QueryModel,请联系管理员");
+                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "配置服务 serviceCode = " + dataQuery.getServiceCode() + " 错误,未配置QueryModel,请联系管理员");
             }
             dataQuery.setServiceSql(currentServiceSql);
             if (CommonConstant.QUERY_MODEL_SQL.equals(currentServiceSql.getQueryModel())) {
                 doExecuteUpdateSql(dataQuery);
                 return;
-            }else if(CommonConstant.QUERY_MODE_JAVA.equals(currentServiceSql.getQueryModel())){
+            } else if (CommonConstant.QUERY_MODE_JAVA.equals(currentServiceSql.getQueryModel())) {
                 doExecuteJava(dataQuery);
-                return ;
+                return;
             }
             doExecuteUpdateProc(dataQuery);
-        }catch (BusinessException e){
-            logger.error("公用查询异常:",e);
+        } catch (BusinessException e) {
+            logger.error("公用查询异常:", e);
             dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_PARAM_ERROR,
                     e.getMessage()));
         }
@@ -115,15 +116,16 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
 
     /**
      * {"PARAM:"{
-     "param1": "$.a.#A#Object",
-     "param2": "$.a.b.A#B#Array",
-     "param3": "$.a.b.c.A.B#C#Array"
-     },"TEMPLATE":"{}"
-     }
+     * "param1": "$.a.#A#Object",
+     * "param2": "$.a.b.A#B#Array",
+     * "param3": "$.a.b.c.A.B#C#Array"
+     * },"TEMPLATE":"{}"
+     * }
      * 执行sql
+     *
      * @param dataQuery
      */
-    private void doExecuteUpdateSql(DataQuery dataQuery) throws BusinessException{
+    private void doExecuteUpdateSql(DataQuery dataQuery) throws BusinessException {
         JSONObject business = null;
         try {
             JSONObject params = dataQuery.getRequestParams();
@@ -132,7 +134,7 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
             business = JSONObject.parseObject(templateObj.getString("TEMPLATE"));
             List<Object> currentParams = new ArrayList<Object>();
             String currentSql = "";
-            for(String key : sqlObj.keySet()) {
+            for (String key : sqlObj.keySet()) {
                 currentSql = sqlObj.getString(key);
                 String[] sqls = currentSql.split("#");
                 String currentSqlNew = "";
@@ -146,28 +148,29 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
                     //currentSqlNew += params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "'" + params.getString(sqls[sqlIndex]) + "'";
                 }
 
-                int flag = queryServiceDAOImpl.updateSql(currentSqlNew,currentParams.toArray());
+                int flag = queryServiceDAOImpl.updateSql(currentSqlNew, currentParams.toArray());
 
                 if (flag < 1) {
                     throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR, "数据交互失败");
                 }
             }
 
-        }catch (Exception e){
-            logger.error("数据交互异常:",e);
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"数据交互异常。。。");
+        } catch (Exception e) {
+            logger.error("数据交互异常:", e);
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "数据交互异常。。。");
         }
 
         dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,
-                "成功",business));
+                "成功", business));
     }
 
     /**
      * 执行java脚本
+     *
      * @param dataQuery
      * @throws BusinessException
      */
-    private void doExecuteJava(DataQuery dataQuery) throws BusinessException{
+    private void doExecuteJava(DataQuery dataQuery) throws BusinessException {
         try {
             JSONObject params = dataQuery.getRequestParams();
             String javaCode = dataQuery.getServiceSql().getJavaScript();
@@ -175,32 +178,34 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
             Interpreter interpreter = new Interpreter();
             interpreter.eval(javaCode);
             String param = "";
-            for(String key : params.keySet()){
+            for (String key : params.keySet()) {
                 param += (params.getString(key) + ",");
             }
 
-            if(param.endsWith(",")){
-                param = param.substring(0,param.length()-1);
+            if (param.endsWith(",")) {
+                param = param.substring(0, param.length() - 1);
             }
 
             dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,
-                    "成功",JSONObject.parseObject(interpreter.eval("execute("+param+")").toString())));
-        }catch (Exception e){
-            logger.error("数据交互异常:",e);
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"数据交互异常。。。");
+                    "成功", JSONObject.parseObject(interpreter.eval("execute(" + param + ")").toString())));
+        } catch (Exception e) {
+            logger.error("数据交互异常:", e);
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "数据交互异常。。。");
         }
     }
+
     /**
      * {"PARAM:"{
-     "param1": "$.a.#A#Object",
-     "param2": "$.a.b.A#B#Array",
-     "param3": "$.a.b.c.A.B#C#Array"
-     },"TEMPLATE":"{}"
-     }
+     * "param1": "$.a.#A#Object",
+     * "param2": "$.a.b.A#B#Array",
+     * "param3": "$.a.b.c.A.B#C#Array"
+     * },"TEMPLATE":"{}"
+     * }
      * 执行sql
+     *
      * @param dataQuery
      */
-    private void doExecuteSql(DataQuery dataQuery) throws BusinessException{
+    private void doExecuteSql(DataQuery dataQuery) throws BusinessException {
 
         JSONObject templateObj = JSONObject.parseObject(dataQuery.getServiceSql().getTemplate());
         JSONObject templateParams = templateObj.getJSONObject("PARAM");
@@ -209,7 +214,7 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
         String[] values = null;
         JSONObject currentJsonObj = null;
         JSONArray currentJsonArr = null;
-        for(String key:templateParams.keySet()){
+        for (String key : templateParams.keySet()) {
             template = templateParams.getString(key);
 
             values = judgeResponseTemplate(template);
@@ -217,28 +222,29 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
             Object o = JSONPath.eval(business, values[0]);
 
             dataQuery.setTemplateKey(key);
-            if(o instanceof JSONObject){
-                currentJsonObj = (JSONObject)o;
-                doJsonObject(currentJsonObj,dataQuery,values);
-            }else if(o instanceof JSONArray){
+            if (o instanceof JSONObject) {
+                currentJsonObj = (JSONObject) o;
+                doJsonObject(currentJsonObj, dataQuery, values);
+            } else if (o instanceof JSONArray) {
                 currentJsonArr = (JSONArray) o;
-                doJsonArray(currentJsonArr,dataQuery,values);
-            }else{
-                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"template 配置 不正确,value 值 和 TEMPLATE 配置不一致");
+                doJsonArray(currentJsonArr, dataQuery, values);
+            } else {
+                throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "template 配置 不正确,value 值 和 TEMPLATE 配置不一致");
             }
         }
 
         dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,
-                "成功",business));
+                "成功", business));
     }
 
     /**
      * 处理 jsonObject
+     *
      * @param obj
      * @param dataQuery
      * @param values
      */
-    private void doJsonObject(JSONObject obj,DataQuery dataQuery,String[] values){
+    private void doJsonObject(JSONObject obj, DataQuery dataQuery, String[] values) {
         try {
             JSONObject params = dataQuery.getRequestParams();
             JSONObject sqlObj = JSONObject.parseObject(dataQuery.getServiceSql().getSql());
@@ -253,7 +259,7 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
                     continue;
                 }
                 if (sqls[sqlIndex].startsWith("PARENT_")) {
-                    if(obj.isEmpty()){
+                    if (obj.isEmpty()) {
                         currentSqlNew += "?";
                         currentParams.add("''");
                         continue;
@@ -270,12 +276,12 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
                     }
                 } else {
                     currentSqlNew += "?";
-                    Object param =  params.getString(sqls[sqlIndex]);
-                    if(params.get(sqls[sqlIndex]) instanceof Integer){
+                    Object param = params.getString(sqls[sqlIndex]);
+                    if (params.get(sqls[sqlIndex]) instanceof Integer) {
                         param = params.getInteger(sqls[sqlIndex]);
                     }
-                   //这里对 page 和 rows 特殊处理 ,目前没有想到其他的办法
-                    if(StringUtils.isNumeric(param.toString()) && "page,rows".contains(sqls[sqlIndex])){
+                    //这里对 page 和 rows 特殊处理 ,目前没有想到其他的办法
+                    if (StringUtils.isNumeric(param.toString()) && "page,rows".contains(sqls[sqlIndex])) {
                         param = Integer.parseInt(param.toString());
                     }
                     currentParams.add(param);
@@ -283,93 +289,96 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
                 }
             }
 
-            List<Map<String,Object>> results = queryServiceDAOImpl.executeSql(currentSqlNew, currentParams.toArray());
+            List<Map<String, Object>> results = queryServiceDAOImpl.executeSql(currentSqlNew, currentParams.toArray());
 
             if (results == null || results.size() == 0) {
-                if(StringUtil.isNullOrNone(values[1])){
-                    return ;
+                if (StringUtil.isNullOrNone(values[1])) {
+                    return;
                 }
-                obj.put(values[1], values[2].equals("Object")?new JSONObject():new JSONArray());
+                obj.put(values[1], values[2].equals("Object") ? new JSONObject() : new JSONArray());
                 return;
             }
             if (values[2].equals("Object")) {
-                if(StringUtil.isNullOrNone(values[1])){
+                if (StringUtil.isNullOrNone(values[1])) {
                     obj.putAll(JSONObject.parseObject(JSONObject.toJSONString(results.get(0))));
-                    return ;
+                    return;
                 }
                 obj.put(values[1], JSONObject.parseObject(JSONObject.toJSONString(results.get(0))));
             } else if (values[2].equals("Array")) {
-                if(StringUtil.isNullOrNone(values[1])){
+                if (StringUtil.isNullOrNone(values[1])) {
                     JSONArray datas = JSONArray.parseArray(JSONArray.toJSONString(results));
-                    for(int dataIndex = 0;dataIndex < datas.size();dataIndex ++){
+                    for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) {
                         obj.putAll(datas.getJSONObject(dataIndex));
                     }
-                    return ;
+                    return;
                 }
                 obj.put(values[1], JSONArray.parseArray(JSONArray.toJSONString(results)));
             }
-        }catch (Exception e){
-            logger.error("数据交互异常:",e);
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"数据交互异常。。。");
+        } catch (Exception e) {
+            logger.error("数据交互异常:", e);
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "数据交互异常。。。");
         }
     }
 
     /**
      * 处理JSONArray
+     *
      * @param objs
      * @param dataQuery
      * @param values
      */
-    private void doJsonArray(JSONArray objs,DataQuery dataQuery,String[] values){
+    private void doJsonArray(JSONArray objs, DataQuery dataQuery, String[] values) {
 
-        for (int objIndex = 0 ; objIndex < objs.size();objIndex ++){
-            doJsonObject(objs.getJSONObject(objIndex),dataQuery,values);
+        for (int objIndex = 0; objIndex < objs.size(); objIndex++) {
+            doJsonObject(objs.getJSONObject(objIndex), dataQuery, values);
         }
 
     }
 
     /**
      * 执行存储
+     *
      * @param dataQuery
      */
-    private void doExecuteUpdateProc(DataQuery dataQuery){
+    private void doExecuteUpdateProc(DataQuery dataQuery) {
         Map info = new TreeMap();
-        info.put("procName",dataQuery.getServiceSql().getProc());
+        info.put("procName", dataQuery.getServiceSql().getProc());
         JSONObject params = dataQuery.getRequestParams();
         info.putAll(params);
 
         String jsonStr = queryServiceDAOImpl.updateProc(info);
 
-        if(!Assert.isJsonObject(jsonStr)){
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"存储过程 procName = " + dataQuery.getServiceSql().getProc() + " 返回结果不是Json格式");
+        if (!Assert.isJsonObject(jsonStr)) {
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "存储过程 procName = " + dataQuery.getServiceSql().getProc() + " 返回结果不是Json格式");
         }
 
         dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,
-                "成功",JSONObject.parseObject(jsonStr)));
+                "成功", JSONObject.parseObject(jsonStr)));
     }
 
 
     /**
      * 校验 返回模板
+     *
      * @param template
      * @return
      * @throws BusinessException
      */
-    private String[] judgeResponseTemplate(String template) throws BusinessException{
+    private String[] judgeResponseTemplate(String template) throws BusinessException {
 
 
-        if(!template.startsWith("$.")){
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"template 配置 不正确,value 必须以$.开头");
+        if (!template.startsWith("$.")) {
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "template 配置 不正确,value 必须以$.开头");
         }
 
         String[] values = template.split("#");
 
-        if(values == null || values.length != 3){
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"template 配置 不正确,value 必须有两个#号");
+        if (values == null || values.length != 3) {
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "template 配置 不正确,value 必须有两个#号");
         }
 
-        if(StringUtil.isNullOrNone(values[1]) && !"$.##Object".equals(template) && !"$.##Array".equals(template)){
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"template 配置 不正确,目前只支持 $.##Object 和 $.##Array ");
+        if (StringUtil.isNullOrNone(values[1]) && !"$.##Object".equals(template) && !"$.##Array".equals(template)) {
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "template 配置 不正确,目前只支持 $.##Object 和 $.##Array ");
         }
 
         return values;
@@ -378,22 +387,23 @@ public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSM
 
     /**
      * 执行存储
+     *
      * @param dataQuery
      */
-    private void doExecuteProc(DataQuery dataQuery){
+    private void doExecuteProc(DataQuery dataQuery) {
         Map info = new TreeMap();
-        info.put("procName",dataQuery.getServiceSql().getProc());
+        info.put("procName", dataQuery.getServiceSql().getProc());
         JSONObject params = dataQuery.getRequestParams();
         info.putAll(params);
 
         String jsonStr = queryServiceDAOImpl.executeProc(info);
 
-        if(!Assert.isJsonObject(jsonStr)){
-            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"存储过程 procName = " + dataQuery.getServiceSql().getProc() + " 返回结果不是Json格式");
+        if (!Assert.isJsonObject(jsonStr)) {
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "存储过程 procName = " + dataQuery.getServiceSql().getProc() + " 返回结果不是Json格式");
         }
 
         dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,
-                "成功",JSONObject.parseObject(jsonStr)));
+                "成功", JSONObject.parseObject(jsonStr)));
     }
 
 

+ 12 - 0
pom.xml

@@ -32,6 +32,7 @@
         <module>Api</module>
         <module>CommunityService</module>
         <module>java110-code-generator</module>
+        <module>java110-db</module>
     </modules>
 
     <parent>
@@ -173,6 +174,11 @@
                 <artifactId>java110-logAgent</artifactId>
                 <version>${microcommunity.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.java110</groupId>
+                <artifactId>java110-db</artifactId>
+                <version>${microcommunity.version}</version>
+            </dependency>
             <!-- logback 日志组件支持  -->
 
             <dependency>
@@ -299,6 +305,12 @@
                 <version>${httpclient.verion}</version>
             </dependency>
 
+            <dependency>
+                <groupId>io.shardingsphere</groupId>
+                <artifactId>sharding-jdbc</artifactId>
+                <version>3.0.0.M3</version>
+            </dependency>
+
 
             <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2
             <dependency>