完成springboot-multisource升级重构
This commit is contained in:
parent
62a79fa73e
commit
c84c9150bd
@ -5,6 +5,7 @@ import com.xncoding.pos.common.dao.entity.User;
|
|||||||
import com.xncoding.pos.common.dao.repository.UserMapper;
|
import com.xncoding.pos.common.dao.repository.UserMapper;
|
||||||
import com.xncoding.pos.common.mutidatesource.DSEnum;
|
import com.xncoding.pos.common.mutidatesource.DSEnum;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ import javax.annotation.Resource;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional
|
||||||
public class UserService {
|
public class UserService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -38,14 +38,14 @@ logging:
|
|||||||
spring:
|
spring:
|
||||||
profiles: dev
|
profiles: dev
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
url: jdbc:mysql://127.0.0.1:3306/pos?serverTimezone=UTC&useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
|
|
||||||
#多数据源
|
#多数据源
|
||||||
biz:
|
biz:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://127.0.0.1:3306/biz?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
url: jdbc:mysql://127.0.0.1:3306/biz?serverTimezone=UTC&useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
|
|
||||||
@ -54,31 +54,5 @@ logging:
|
|||||||
ROOT: INFO
|
ROOT: INFO
|
||||||
com:
|
com:
|
||||||
xncoding: DEBUG
|
xncoding: DEBUG
|
||||||
file: E:/logs/app.log
|
file: D:/logs/app.log
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
######################## 测试环境profile ##########################
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
spring:
|
|
||||||
profiles: test
|
|
||||||
datasource:
|
|
||||||
url: jdbc:mysql://127.0.0.1:3306/pos?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
|
||||||
username: root
|
|
||||||
password: 123456
|
|
||||||
|
|
||||||
#多数据源
|
|
||||||
biz:
|
|
||||||
datasource:
|
|
||||||
url: jdbc:mysql://127.0.0.1:3306/biz?useSSL=false&autoReconnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8
|
|
||||||
username: root
|
|
||||||
password: 123456
|
|
||||||
|
|
||||||
logging:
|
|
||||||
level:
|
|
||||||
ROOT: INFO
|
|
||||||
com:
|
|
||||||
xncoding: DEBUG
|
|
||||||
file: /var/logs/app.log
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# -------------------------------------以下是pos业务库开始-------------------------------------------
|
-- -------------------------------------以下是pos业务库开始-------------------------------------------
|
||||||
CREATE DATABASE IF NOT EXISTS pos default charset utf8 COLLATE utf8_general_ci;
|
CREATE DATABASE IF NOT EXISTS pos default charset utf8 COLLATE utf8_general_ci;
|
||||||
SET FOREIGN_KEY_CHECKS=0;
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
USE pos;
|
USE pos;
|
||||||
@ -18,13 +18,13 @@ CREATE TABLE `t_user` (
|
|||||||
`updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
|
`updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='后台管理用户表';
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='后台管理用户表';
|
||||||
|
|
||||||
# 下面是pos数据库中的插入数据
|
-- 下面是pos数据库中的插入数据
|
||||||
INSERT INTO `t_user` VALUES (1,'admin','系统管理员','123456','www', '17890908889', '系统管理员', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
INSERT INTO `t_user` VALUES (1,'admin','系统管理员','123456','www', '17890908889', '系统管理员', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
||||||
INSERT INTO `t_user` VALUES (2,'aix','张三','123456','eee', '17859569358', '', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
INSERT INTO `t_user` VALUES (2,'aix','张三','123456','eee', '17859569358', '', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------以下biz业务库开始-------------------------------------------
|
-- -------------------------------------以下biz业务库开始-------------------------------------------
|
||||||
CREATE DATABASE IF NOT EXISTS pos default charset utf8 COLLATE utf8_general_ci;
|
CREATE DATABASE IF NOT EXISTS biz default charset utf8 COLLATE utf8_general_ci;
|
||||||
SET FOREIGN_KEY_CHECKS=0;
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
USE biz;
|
USE biz;
|
||||||
|
|
||||||
@ -44,6 +44,6 @@ CREATE TABLE `t_user` (
|
|||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='后台管理用户表';
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='后台管理用户表';
|
||||||
|
|
||||||
|
|
||||||
# 下面是biz数据库中的插入数据
|
-- 下面是biz数据库中的插入数据
|
||||||
INSERT INTO `t_user` VALUES (1,'admin1','系统管理员','123456','www', '17890908889', '系统管理员', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
INSERT INTO `t_user` VALUES (1,'admin1','系统管理员','123456','www', '17890908889', '系统管理员', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
||||||
INSERT INTO `t_user` VALUES (2,'aix1','张三','123456','eee', '17859569358', '', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
INSERT INTO `t_user` VALUES (2,'aix1','张三','123456','eee', '17859569358', '', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12');
|
||||||
|
@ -8,6 +8,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user