Browse Source

add db config

wuxw7 9 years ago
parent
commit
6961a886e0

+ 0 - 16
.idea/misc.xml

@@ -57,20 +57,4 @@
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/out" />
   </component>
-  <component name="masterDetails">
-    <states>
-      <state key="ProjectJDKs.UI">
-        <settings>
-          <last-edited>1.8</last-edited>
-          <splitter-proportions>
-            <option name="proportions">
-              <list>
-                <option value="0.2" />
-              </list>
-            </option>
-          </splitter-proportions>
-        </settings>
-      </state>
-    </states>
-  </component>
 </project>

File diff suppressed because it is too large
+ 398 - 513
.idea/workspace.xml


+ 1 - 1
UserService/src/main/java/com/java110/user/AppSpringBootApplication.java

@@ -15,7 +15,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication
+@SpringBootApplication(scanBasePackages="com.java110.service,com.java110.user")
 @EnableDiscoveryClient
 public class AppSpringBootApplication {
 

+ 1 - 1
UserService/src/main/resources/application.yml

@@ -25,7 +25,7 @@ spring:
     poolPreparedStatements: true
     maxOpenPreparedStatements: 20
 logging:
-  file: ./logs/UserService.log
+  file: ./UserService/logs/UserService.log
   level:
     root: INFO
     com.java110.user: ERROR

+ 23 - 0
UserService/src/main/resources/banner.txt

@@ -0,0 +1,23 @@
+${AnsiColor.BRIGHT_RED}
+////////////////////////////////////////////////////////////////////
+//                          _ooOoo_                               //
+//                         o8888888o                              //
+//                         88" . "88                              //
+//                         (| ^_^ |)                              //
+//                         O\  =  /O                              //
+//                      ____/`---'\____                           //
+//                    .'  \\|     |//  `.                         //
+//                   /  \\|||  :  |||//  \                        //
+//                  /  _||||| -:- |||||-  \                       //
+//                  |   | \\\  -  /// |   |                       //
+//                  | \_|  ''\---/''  |   |                       //
+//                  \  .-\__  `-`  ___/-. /                       //
+//                ___`. .'  /--.--\  `. . ___                     //
+//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
+//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
+//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
+//      ========`-.____`-.___\_____/___.-`____.-'========         //
+//                           `=---='                              //
+//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
+//            佛祖保佑       永不宕机     永无BUG                  //
+////////////////////////////////////////////////////////////////////

+ 23 - 0
UserService/target/classes/banner.txt

@@ -0,0 +1,23 @@
+${AnsiColor.BRIGHT_RED}
+////////////////////////////////////////////////////////////////////
+//                          _ooOoo_                               //
+//                         o8888888o                              //
+//                         88" . "88                              //
+//                         (| ^_^ |)                              //
+//                         O\  =  /O                              //
+//                      ____/`---'\____                           //
+//                    .'  \\|     |//  `.                         //
+//                   /  \\|||  :  |||//  \                        //
+//                  /  _||||| -:- |||||-  \                       //
+//                  |   | \\\  -  /// |   |                       //
+//                  | \_|  ''\---/''  |   |                       //
+//                  \  .-\__  `-`  ___/-. /                       //
+//                ___`. .'  /--.--\  `. . ___                     //
+//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
+//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
+//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
+//      ========`-.____`-.___\_____/___.-`____.-'========         //
+//                           `=---='                              //
+//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
+//            佛祖保佑       永不宕机     永无BUG                  //
+////////////////////////////////////////////////////////////////////

BIN
UserService/target/classes/com/java110/user/AppSpringBootApplication.class


+ 5 - 5
bean/src/main/java/com/java110/entity/user/Cust.java

@@ -28,7 +28,7 @@ public class Cust {
 
     private String openId;
 
-    private String state;
+    private String status_cd;
 
 
     public String getCustId() {
@@ -119,11 +119,11 @@ public class Cust {
         this.openId = openId;
     }
 
-    public String getState() {
-        return state;
+    public String getStatus_cd() {
+        return status_cd;
     }
 
-    public void setState(String state) {
-        this.state = state;
+    public void setStatus_cd(String status_cd) {
+        this.status_cd = status_cd;
     }
 }

+ 5 - 5
bean/src/main/java/com/java110/entity/user/CustAttr.java

@@ -12,7 +12,7 @@ public class CustAttr {
 
     private String value;
 
-    private String state;
+    private String status_cd;
 
     public String getCustId() {
         return custId;
@@ -38,11 +38,11 @@ public class CustAttr {
         this.value = value;
     }
 
-    public String getState() {
-        return state;
+    public String getStatus_cd() {
+        return status_cd;
     }
 
-    public void setState(String state) {
-        this.state = state;
+    public void setStatus_cd(String status_cd) {
+        this.status_cd = status_cd;
     }
 }

+ 92 - 0
config/db/cust.db

@@ -0,0 +1,92 @@
+-- cust table bo_cust
+
+create table bo_cust(
+
+    boId varchar(20) not null,
+
+    custId  varchar(20) not null,
+
+     name  varchar(50) not null,
+
+     email  varchar(20) not null,
+
+     cellphone  varchar(11) not null,
+
+     realName  varchar(20) not null,
+
+     sex  varchar(10) not null,
+
+     password  varchar(20) not null,
+
+     lanId  varchar(10) not null,
+
+     custAdress  varchar(500) not null,
+
+     custType  varchar(10) not null,
+
+     openId  varchar(30) not null,
+
+    state varchar(10) not null,
+
+    create_dt date default now()
+
+);
+-- table bo_cust_attr 
+create table bo_cust_attr(
+
+    boId  varchar(20) not null,
+
+    custId  varchar(20) not null,
+
+    itemSpecCd  varchar(50) not null,
+
+    value  varchar(200) not null,
+
+    state  varchar(10) not null,
+
+    create_dt date default now()
+
+);
+
+create table cust(
+        custId  varchar(20) not null,
+    
+        name  varchar(50) not null,
+    
+        email  varchar(20) not null,
+    
+        cellphone  varchar(11) not null,
+    
+        realName  varchar(20) not null,
+    
+        sex  varchar(10) not null,
+    
+        password  varchar(20) not null,
+    
+        lanId  varchar(10) not null,
+    
+        custAdress  varchar(500) not null,
+    
+        custType  varchar(10) not null,
+    
+        openId  varchar(30) not null,
+    
+        status_cd varchar(10) default '0',
+
+        create_dt date default now()
+);
+
+create table cust_attr(
+
+        custId  varchar(20) not null,
+
+        itemSpecCd  varchar(50) not null,
+
+        value  varchar(200) not null,
+
+        status_cd  varchar(10) not null,
+
+        create_dt date default now()
+
+);
+

+ 34 - 0
config/db/orders.db

@@ -0,0 +1,34 @@
+-- cust table order_list
+
+create table order_list(
+
+    olId varchar(20) not null,
+
+    channelId  varchar(20) not null,
+
+     name  varchar(50) not null,
+
+     email  varchar(20) not null,
+
+     cellphone  varchar(11) not null,
+
+     realName  varchar(20) not null,
+
+     sex  varchar(10) not null,
+
+     password  varchar(20) not null,
+
+     lanId  varchar(10) not null,
+
+     custAdress  varchar(500) not null,
+
+     custType  varchar(10) not null,
+
+     openId  varchar(30) not null,
+
+    state varchar(10) not null,
+
+    create_dt date default now()
+
+);
+

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

@@ -0,0 +1,31 @@
+#数据库设置
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource  
+spring.datasource.driverClassName=com.mysql.jdbc.Driver  
+spring.datasource.url=jdbc:mysql://localhost:3306/mydatabases  
+spring.datasource.username=root  
+spring.datasource.password=123  
+#--------------------------
+# 下面为连接池的补充设置,应用到上面所有数据源中
+# 初始化大小,最小,最大
+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

+ 1 - 0
service/pom.xml

@@ -44,6 +44,7 @@
         </dependency>
         -->
 
+
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>

+ 10 - 0
service/src/main/java/com/java110/service/MyBatisConfig.java

@@ -10,6 +10,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureBefore;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -38,6 +39,15 @@ public class MyBatisConfig implements TransactionManagementConfigurer {
     @Autowired
     DataSource dataSource;
 
+    @Bean(name = "dataSource")
+    @ConfigurationProperties(prefix = "spring.datasource")
+    public DataSource dataSource(){
+        DruidDataSource druidDataSource = new DruidDataSource();
+        return druidDataSource;
+    }
+
+
+
     @Bean(name = "sqlSessionFactory")
     public SqlSessionFactory sqlSessionFactoryBean() {
         SqlSessionFactoryBean bean = new SqlSessionFactoryBean();

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

@@ -20,7 +20,7 @@ public class MyBatisMapperScannerConfig {
     public MapperScannerConfigurer mapperScannerConfigurer() {
         MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
         mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
-        mapperScannerConfigurer.setBasePackage("tk.mybatis.springboot.mapper");
+        mapperScannerConfigurer.setBasePackage("mapper");
         return mapperScannerConfigurer;
     }
 }

+ 10 - 0
service/target/classes/META-INF/spring-configuration-metadata.json

@@ -0,0 +1,10 @@
+{
+  "groups": [{
+    "name": "spring.datasource",
+    "type": "javax.sql.DataSource",
+    "sourceType": "com.java110.service.MyBatisConfig",
+    "sourceMethod": "dataSource()"
+  }],
+  "properties": [],
+  "hints": []
+}

BIN
service/target/classes/com/java110/service/MyBatisConfig.class