diff --git a/mybatis配置多数据源/springboot-multisource/.gitignore b/mybatis配置多数据源/springboot-multisource/.gitignore new file mode 100644 index 0000000..9d8e7cc --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/.gitignore @@ -0,0 +1,10 @@ +.idea/ +target/ +*.iml +*.ipr +*.iws +*.log +.svn/ +.project +rebel.xml +.rebel-remote.xml.* diff --git a/mybatis配置多数据源/springboot-multisource/LICENSE b/mybatis配置多数据源/springboot-multisource/LICENSE new file mode 100644 index 0000000..83cd47d --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2018 Xiong Neng + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/mybatis配置多数据源/springboot-multisource/README.md b/mybatis配置多数据源/springboot-multisource/README.md new file mode 100644 index 0000000..97bd0b2 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/README.md @@ -0,0 +1,34 @@ +## 配置多数据源 + +SpringBoot配置多数据源,使用MyBatis作为DAO层演示 + +## 安装MySQL数据库 + +数据库的安装教程网上非常多,配置数据库的账号和密码。 +并且创建两个数据库pos和biz来测试多数据源。 + +## 修改application.yml + +修改配置文件,主要是mysql的账号和密码,两个数据库都要配置 + +## 数据库初始化 + +然后执行SQL文件`src/main/resources/sql/schema.sql` + +``` +# 下面是核心数据库中的插入数据 +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'); + +# 下面是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 (2,'aix1','张三','123456','eee', '17859569358', '', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12'); + +``` + +## 运行测试用例 + +执行对用户表增/删/改/查的测试用例:`com.woniu.pos.ApplicationTests.java` + + + diff --git a/mybatis配置多数据源/springboot-multisource/pom.xml b/mybatis配置多数据源/springboot-multisource/pom.xml new file mode 100644 index 0000000..35f65d5 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + + com.woniu + springboot-multisource + 1.0.0-SNAPSHOT + jar + + springboot-multisource + SpringBoot配置多数据源 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.4.RELEASE + + + + UTF-8 + UTF-8 + 1.8 + 1.1.2 + 8.0.26 + 2.1.8 + 1.0.5 + + + + + org.springframework.boot + spring-boot-starter-aop + + + mysql + mysql-connector-java + ${mysql-connector.version} + runtime + + + com.alibaba + druid + ${druid.version} + + + + com.baomidou + mybatis-plus + ${mybatis-plus.version} + + + com.baomidou + mybatisplus-spring-boot-starter + ${mybatisplus-spring-boot-starter.version} + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + true + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + src/main/resources + + + src/main/java + + **/*.xml + + + + + + \ No newline at end of file diff --git a/mybatis配置多数据源/springboot-multisource/run.sh b/mybatis配置多数据源/springboot-multisource/run.sh new file mode 100644 index 0000000..955efb1 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/run.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# 项目自动更新脚本 +# 先clone相应的分支下来: +# git clone ssh://git@120.24.173.142:7999/xxx.git +# 远程调试启动: +# nohup java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -Xms512m -Xmx1024m -jar -Dspring.profiles.active=${profile} ${jarfile} >/dev/null 2>&1 & + +function start { + profile="$1" + echo "启动环境profile=${profile}" + jarfile=$(ls target/*.jar) + if [[ "$?" == "0" ]]; then + stop $profile $jarfile + fi + branch=$(git branch |awk '{print $2}') + git pull origin ${branch} + echo "更新完代码开始重新打包" + mvn clean && mvn clean && mvn package -DskipTests=true + if [[ "$?" != "0" ]]; then + echo "编译出错,退出!" + exit 1 + fi + echo "nohup java -Xms512m -Xmx1024m -jar -Dspring.profiles.active=${profile} ${jarfile} >/dev/null 2>&1 &" + nohup java -Xms512m -Xmx1024m -jar -Dspring.profiles.active=${profile} ${jarfile} >/dev/null 2>&1 & + echo "启动应用中,请查看日志文件..." +} + +function stop { + profile="$1" + jarfile="$2" + ps aux | grep "${jarfile}" | grep "spring.profiles.active=${profile}" | grep -v grep > /dev/null + if [[ "$?" == "0" ]]; then + echo "该应用还在跑,我先停了它" + pid=$(ps aux | grep "${jarfile}" | grep "spring.profiles.active=${profile}" | grep -v grep |awk '{print $2}') + if [[ "$pid" != "" ]]; then + kill -9 $pid + fi + echo "停止应用成功..." + fi +} + +if [[ "$1" == "start" ]]; then + if [[ "$#" < 2 ]]; then + echo "请输入正确参数:./epay.sh start {profile}" + exit 1 + fi + profile="$2" + if [[ "$profile" != "dev" && "$profile" != "test" && "$profile" != "show" && "$profile" != "production" ]]; then + echo "参数错误,请输入正确的profile参数,使用方法:" + echo "./epay.sh start {profile} ==> 启动应用,{profile}取值:dev|test|show|production" + exit 1 + fi + start "${profile}" +elif [[ "$1" == "stop" ]]; then + if [[ "$#" < 2 ]]; then + echo "请输入正确参数:./epay.sh stop {profile}" + exit 1 + fi + profile="$2" + if [[ "$profile" != "dev" && "$profile" != "test" && "$profile" != "show" && "$profile" != "production" ]]; then + echo "参数错误,请输入正确的profile参数,使用方法:" + echo "./epay.sh stop {profile} ==> 停止应用,{profile}取值:dev|test|show|production" + exit 1 + fi + jarfile=$(ls target/*.jar) + stop $profile $jarfile +else + echo "参数错误,使用方法:{}参数是必填的,[]参数可选" + echo "./epay.sh start {profile} ==> 启动应用,{profile}取值:dev|test|show|production" + echo "./epay.sh stop {profile} ==> 停止应用,{profile}取值:dev|test|show|production" + exit 1 +fi diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/Application.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/Application.java new file mode 100644 index 0000000..323fbc8 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/Application.java @@ -0,0 +1,12 @@ +package com.woniu.pos; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/annotion/DataSource.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/annotion/DataSource.java new file mode 100644 index 0000000..45a7396 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/annotion/DataSource.java @@ -0,0 +1,16 @@ +package com.woniu.pos.common.annotion; + +import java.lang.annotation.*; + +/** + * 多数据源标识 + * @author 蜗牛 + */ + +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface DataSource { + + String name() default ""; +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/aop/MultiSourceExAop.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/aop/MultiSourceExAop.java new file mode 100644 index 0000000..7b289bf --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/aop/MultiSourceExAop.java @@ -0,0 +1,73 @@ +package com.woniu.pos.common.aop; + +import com.woniu.pos.common.annotion.DataSource; +import com.woniu.pos.common.mutidatesource.DSEnum; +import com.woniu.pos.common.mutidatesource.DataSourceContextHolder; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.Signature; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +/** + * 多数据源切换的aop + */ +@Aspect +@Component +@ConditionalOnProperty(prefix = "xncoding", name = "muti-datasource-open", havingValue = "true") +public class MultiSourceExAop implements Ordered { + + private Logger log = LoggerFactory.getLogger(this.getClass()); + + @Pointcut(value = "@annotation(com.woniu.pos.common.annotion.DataSource)") + private void cut() { + + } + + @Around("cut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + + Signature signature = point.getSignature(); + MethodSignature methodSignature = null; + if (!(signature instanceof MethodSignature)) { + throw new IllegalArgumentException("该注解只能用于方法"); + } + methodSignature = (MethodSignature) signature; + + Object target = point.getTarget(); + Method currentMethod = target.getClass().getMethod(methodSignature.getName(), methodSignature.getParameterTypes()); + + DataSource datasource = currentMethod.getAnnotation(DataSource.class); + if (datasource != null) { + DataSourceContextHolder.setDataSourceType(datasource.name()); + log.debug("设置数据源为:" + datasource.name()); + } else { + DataSourceContextHolder.setDataSourceType(DSEnum.DATA_SOURCE_CORE); + log.debug("设置数据源为:dataSourceCore"); + } + try { + return point.proceed(); + } finally { + log.debug("清空数据源信息!"); + DataSourceContextHolder.clearDataSourceType(); + } + } + + + /** + * aop的顺序要早于spring的事务 + */ + @Override + public int getOrder() { + return 1; + } + +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/dao/entity/User.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/dao/entity/User.java new file mode 100644 index 0000000..43457b2 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/dao/entity/User.java @@ -0,0 +1,245 @@ +package com.woniu.pos.common.dao.entity; + +import java.util.Date; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.activerecord.Model; +import java.io.Serializable; + +/** + * @author 蜗牛 + */ +@TableName(value = "t_user") +public class User extends Model { + +private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value="id", type= IdType.AUTO) + private Integer id; + /** + * 账号 + */ + private String username; + /** + * 名字 + */ + private String name; + /** + * 密码 + */ + private String password; + /** + * md5密码盐 + */ + private String salt; + /** + * 联系电话 + */ + private String phone; + /** + * 备注 + */ + private String tips; + /** + * 状态 1:正常 2:禁用 + */ + private Integer state; + /** + * 创建时间 + */ + private Date createdTime; + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 获取 主键ID. + * + * @return 主键ID. + */ + public Integer getId() { + return id; + } + + /** + * 设置 主键ID. + * + * @param id 主键ID. + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * 获取 账号. + * + * @return 账号. + */ + public String getUsername() { + return username; + } + + /** + * 设置 账号. + * + * @param username 账号. + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * 获取 名字. + * + * @return 名字. + */ + public String getName() { + return name; + } + + /** + * 设置 名字. + * + * @param name 名字. + */ + public void setName(String name) { + this.name = name; + } + + /** + * 获取 密码. + * + * @return 密码. + */ + public String getPassword() { + return password; + } + + /** + * 设置 密码. + * + * @param password 密码. + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * 获取 md5密码盐. + * + * @return md5密码盐. + */ + public String getSalt() { + return salt; + } + + /** + * 设置 md5密码盐. + * + * @param salt md5密码盐. + */ + public void setSalt(String salt) { + this.salt = salt; + } + + /** + * 获取 联系电话. + * + * @return 联系电话. + */ + public String getPhone() { + return phone; + } + + /** + * 设置 联系电话. + * + * @param phone 联系电话. + */ + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * 获取 备注. + * + * @return 备注. + */ + public String getTips() { + return tips; + } + + /** + * 设置 备注. + * + * @param tips 备注. + */ + public void setTips(String tips) { + this.tips = tips; + } + + /** + * 获取 状态 1:正常 2:禁用. + * + * @return 状态 1:正常 2:禁用. + */ + public Integer getState() { + return state; + } + + /** + * 设置 状态 1:正常 2:禁用. + * + * @param state 状态 1:正常 2:禁用. + */ + public void setState(Integer state) { + this.state = state; + } + + /** + * 获取 创建时间. + * + * @return 创建时间. + */ + public Date getCreatedTime() { + return createdTime; + } + + /** + * 设置 创建时间. + * + * @param createdTime 创建时间. + */ + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + /** + * 获取 更新时间. + * + * @return 更新时间. + */ + public Date getUpdatedTime() { + return updatedTime; + } + + /** + * 设置 更新时间. + * + * @param updatedTime 更新时间. + */ + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/dao/repository/UserMapper.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/dao/repository/UserMapper.java new file mode 100644 index 0000000..69e0ae1 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/dao/repository/UserMapper.java @@ -0,0 +1,11 @@ +package com.woniu.pos.common.dao.repository; + +import com.woniu.pos.common.dao.entity.User; +import com.baomidou.mybatisplus.mapper.BaseMapper; + +/** + * @author 蜗牛 + */ +public interface UserMapper extends BaseMapper { + +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DSEnum.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DSEnum.java new file mode 100644 index 0000000..852b87d --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DSEnum.java @@ -0,0 +1,11 @@ +package com.woniu.pos.common.mutidatesource; + +/** + * @author 蜗牛 + */ +public interface DSEnum { + + String DATA_SOURCE_CORE = "dataSourceCore"; //核心数据源 + + String DATA_SOURCE_BIZ = "dataSourceBiz"; //其他业务的数据源 +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DataSourceContextHolder.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DataSourceContextHolder.java new file mode 100644 index 0000000..07990c7 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DataSourceContextHolder.java @@ -0,0 +1,31 @@ +package com.woniu.pos.common.mutidatesource; + +/** + * @author 蜗牛 + */ +public class DataSourceContextHolder { + + private static final ThreadLocal contextHolder = new ThreadLocal(); + + /** + * @param dataSourceType 数据库类型 + * @Description: 设置数据源类型 + */ + public static void setDataSourceType(String dataSourceType) { + contextHolder.set(dataSourceType); + } + + /** + * @Description: 获取数据源类型 + */ + public static String getDataSourceType() { + return contextHolder.get(); + } + + /** + * @Description: 清除数据源类型 + */ + public static void clearDataSourceType() { + contextHolder.remove(); + } +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DynamicDataSource.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DynamicDataSource.java new file mode 100644 index 0000000..5f072e7 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/common/mutidatesource/DynamicDataSource.java @@ -0,0 +1,15 @@ +package com.woniu.pos.common.mutidatesource; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * @author 蜗牛 + */ +public class DynamicDataSource extends AbstractRoutingDataSource { + + @Override + protected Object determineCurrentLookupKey() { + return DataSourceContextHolder.getDataSourceType(); + } + +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/MybatisPlusConfig.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/MybatisPlusConfig.java new file mode 100644 index 0000000..759a97e --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/MybatisPlusConfig.java @@ -0,0 +1,95 @@ +package com.woniu.pos.config; + +import com.alibaba.druid.pool.DruidDataSource; +import com.baomidou.mybatisplus.plugins.PaginationInterceptor; +import com.woniu.pos.common.mutidatesource.DSEnum; +import com.woniu.pos.common.mutidatesource.DynamicDataSource; +import com.woniu.pos.config.properties.MutiDataSourceProperties; +import com.woniu.pos.config.properties.DruidProperties; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import java.sql.SQLException; +import java.util.HashMap; + +/** + * mybatis配置多数据源! + * @author 蜗牛 + */ +@Configuration +@EnableTransactionManagement(order = 2) +@MapperScan(basePackages = {"com.woniu.pos.common.dao.repository"}) +public class MybatisPlusConfig { + + @Autowired + DruidProperties druidProperties; + + @Autowired + MutiDataSourceProperties mutiDataSourceProperties; + + /** + * 核心数据源 + */ + private DruidDataSource coreDataSource() { + DruidDataSource dataSource = new DruidDataSource(); + druidProperties.config(dataSource); + return dataSource; + } + + /** + * 另一个数据源 + */ + private DruidDataSource bizDataSource() { + DruidDataSource dataSource = new DruidDataSource(); + druidProperties.config(dataSource); + mutiDataSourceProperties.config(dataSource); + return dataSource; + } + + /** + * 单数据源连接池配置 + */ + @Bean + @ConditionalOnProperty(prefix = "xncoding", name = "muti-datasource-open", havingValue = "false") + public DruidDataSource singleDatasource() { + return coreDataSource(); + } + + /** + * 多数据源连接池配置 + */ + @Bean + @ConditionalOnProperty(prefix = "xncoding", name = "muti-datasource-open", havingValue = "true") + public DynamicDataSource mutiDataSource() { + + DruidDataSource coreDataSource = coreDataSource(); + DruidDataSource bizDataSource = bizDataSource(); + + try { + coreDataSource.init(); + bizDataSource.init(); + } catch (SQLException sql) { + sql.printStackTrace(); + } + + DynamicDataSource dynamicDataSource = new DynamicDataSource(); + HashMap hashMap = new HashMap<>(); + hashMap.put(DSEnum.DATA_SOURCE_CORE, coreDataSource); + hashMap.put(DSEnum.DATA_SOURCE_BIZ, bizDataSource); + dynamicDataSource.setTargetDataSources(hashMap); + dynamicDataSource.setDefaultTargetDataSource(coreDataSource); + return dynamicDataSource; + } + + /** + * mybatis-plus分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/properties/DruidProperties.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/properties/DruidProperties.java new file mode 100644 index 0000000..1b68ed8 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/properties/DruidProperties.java @@ -0,0 +1,246 @@ +package com.woniu.pos.config.properties; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.util.JdbcConstants; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.sql.SQLException; + +/** + * 数据库数据源配置 + * 说明:这个类中包含了许多默认配置,若这些配置符合您的情况,您可以不用管,若不符合,建议不要修改本类,建议直接在"application.yml"中配置即可 + */ +@Component +@ConfigurationProperties(prefix = "spring.datasource") +public class DruidProperties { + + private String url; + + private String username; + + private String password; + + private String driverClassName = "com.mysql.cj.jdbc.Driver"; + + private Integer initialSize = 10; + + private Integer minIdle = 3; + + private Integer maxActive = 60; + + private Integer maxWait = 60000; + + private Boolean removeAbandoned = true; + + private Integer removeAbandonedTimeout = 180; + + private Integer timeBetweenEvictionRunsMillis = 60000; + + private Integer minEvictableIdleTimeMillis = 300000; + + private String validationQuery = "SELECT 'x'"; + + private Boolean testWhileIdle = true; + + private Boolean testOnBorrow = false; + + private Boolean testOnReturn = false; + + private Boolean poolPreparedStatements = true; + + private Integer maxPoolPreparedStatementPerConnectionSize = 50; + + private String filters = "stat"; + + public void config(DruidDataSource dataSource) { + dataSource.setDbType(JdbcConstants.MYSQL); + dataSource.setUrl(url); + dataSource.setUsername(username); + dataSource.setPassword(password); + dataSource.setDriverClassName(driverClassName); + dataSource.setInitialSize(initialSize); // 定义初始连接数 + dataSource.setMinIdle(minIdle); // 最小空闲 + dataSource.setMaxActive(maxActive); // 定义最大连接数 + dataSource.setMaxWait(maxWait); // 获取连接等待超时的时间 + dataSource.setRemoveAbandoned(removeAbandoned); // 超过时间限制是否回收 + dataSource.setRemoveAbandonedTimeout(removeAbandonedTimeout); // 超过时间限制多长 + + // 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + // 配置一个连接在池中最小生存的时间,单位是毫秒 + dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + // 用来检测连接是否有效的sql,要求是一个查询语句 + dataSource.setValidationQuery(validationQuery); + // 申请连接的时候检测 + dataSource.setTestWhileIdle(testWhileIdle); + // 申请连接时执行validationQuery检测连接是否有效,配置为true会降低性能 + dataSource.setTestOnBorrow(testOnBorrow); + // 归还连接时执行validationQuery检测连接是否有效,配置为true会降低性能 + dataSource.setTestOnReturn(testOnReturn); + // 打开PSCache,并且指定每个连接上PSCache的大小 + dataSource.setPoolPreparedStatements(poolPreparedStatements); + dataSource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize); + // 属性类型是字符串,通过别名的方式配置扩展插件,常用的插件有: + // 监控统计用的filter:stat + // 日志用的filter:log4j + // 防御SQL注入的filter:wall + try { + dataSource.setFilters(filters); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getDriverClassName() { + return driverClassName; + } + + public void setDriverClassName(String driverClassName) { + this.driverClassName = driverClassName; + } + + public Integer getInitialSize() { + return initialSize; + } + + public void setInitialSize(Integer initialSize) { + this.initialSize = initialSize; + } + + public Integer getMinIdle() { + return minIdle; + } + + public void setMinIdle(Integer minIdle) { + this.minIdle = minIdle; + } + + public Integer getMaxActive() { + return maxActive; + } + + public void setMaxActive(Integer maxActive) { + this.maxActive = maxActive; + } + + public Integer getMaxWait() { + return maxWait; + } + + public void setMaxWait(Integer maxWait) { + this.maxWait = maxWait; + } + + public Integer getTimeBetweenEvictionRunsMillis() { + return timeBetweenEvictionRunsMillis; + } + + public void setTimeBetweenEvictionRunsMillis(Integer timeBetweenEvictionRunsMillis) { + this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; + } + + public Integer getMinEvictableIdleTimeMillis() { + return minEvictableIdleTimeMillis; + } + + public void setMinEvictableIdleTimeMillis(Integer minEvictableIdleTimeMillis) { + this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; + } + + public String getValidationQuery() { + return validationQuery; + } + + public void setValidationQuery(String validationQuery) { + this.validationQuery = validationQuery; + } + + public Boolean getTestWhileIdle() { + return testWhileIdle; + } + + public void setTestWhileIdle(Boolean testWhileIdle) { + this.testWhileIdle = testWhileIdle; + } + + public Boolean getTestOnBorrow() { + return testOnBorrow; + } + + public void setTestOnBorrow(Boolean testOnBorrow) { + this.testOnBorrow = testOnBorrow; + } + + public Boolean getTestOnReturn() { + return testOnReturn; + } + + public void setTestOnReturn(Boolean testOnReturn) { + this.testOnReturn = testOnReturn; + } + + public Boolean getPoolPreparedStatements() { + return poolPreparedStatements; + } + + public void setPoolPreparedStatements(Boolean poolPreparedStatements) { + this.poolPreparedStatements = poolPreparedStatements; + } + + public Integer getMaxPoolPreparedStatementPerConnectionSize() { + return maxPoolPreparedStatementPerConnectionSize; + } + + public void setMaxPoolPreparedStatementPerConnectionSize(Integer maxPoolPreparedStatementPerConnectionSize) { + this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize; + } + + public String getFilters() { + return filters; + } + + public void setFilters(String filters) { + this.filters = filters; + } + + public Boolean getRemoveAbandoned() { + return removeAbandoned; + } + + public void setRemoveAbandoned(Boolean removeAbandoned) { + this.removeAbandoned = removeAbandoned; + } + + public Integer getRemoveAbandonedTimeout() { + return removeAbandonedTimeout; + } + + public void setRemoveAbandonedTimeout(Integer removeAbandonedTimeout) { + this.removeAbandonedTimeout = removeAbandonedTimeout; + } +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/properties/MutiDataSourceProperties.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/properties/MutiDataSourceProperties.java new file mode 100644 index 0000000..e778dcd --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/config/properties/MutiDataSourceProperties.java @@ -0,0 +1,49 @@ +package com.woniu.pos.config.properties; + +import com.alibaba.druid.pool.DruidDataSource; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 多数据源的配置 + */ +@Component +@ConfigurationProperties(prefix = "biz.datasource") +public class MutiDataSourceProperties { + + private String url; + + private String username; + + private String password; + + public void config(DruidDataSource dataSource) { + dataSource.setUrl(url); + dataSource.setUsername(username); + dataSource.setPassword(password); + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/service/UserService.java b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/service/UserService.java new file mode 100644 index 0000000..a6c41b8 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/java/com/woniu/pos/service/UserService.java @@ -0,0 +1,66 @@ +package com.woniu.pos.service; + +import com.woniu.pos.common.annotion.DataSource; +import com.woniu.pos.common.dao.entity.User; +import com.woniu.pos.common.dao.repository.UserMapper; +import com.woniu.pos.common.mutidatesource.DSEnum; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +/** + * 后台用户管理 + */ + +@Service +@Transactional +public class UserService { + + @Resource + private UserMapper userMapper; + + /** + * 通过ID查找用户 + * @param id + * @return + */ + public User findById(Integer id) { + return userMapper.selectById(id); + } + + /** + * 通过ID查找用户 + * @param id + * @return + */ + @DataSource(name = DSEnum.DATA_SOURCE_BIZ) + public User findById1(Integer id) { + return userMapper.selectById(id); + } + + /** + * 新增用户 + * @param user + */ + public void insertUser(User user) { + userMapper.insert(user); + } + + /** + * 修改用户 + * @param user + */ + public void updateUser(User user) { + userMapper.updateById(user); + } + + /** + * 删除用户 + * @param id + */ + public void deleteUser(Integer id) { + userMapper.deleteById(id); + } + +} diff --git a/mybatis配置多数据源/springboot-multisource/src/main/resources/application.yml b/mybatis配置多数据源/springboot-multisource/src/main/resources/application.yml new file mode 100644 index 0000000..9e6efbc --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/resources/application.yml @@ -0,0 +1,48 @@ +xncoding: + muti-datasource-open: true #是否开启多数据源(true/false) + + +spring: + profiles: + active: dev + +mybatis-plus: + mapper-locations: classpath*:com/woniu/pos/common/dao/repository/mapping/*.xml + typeAliasesPackage: > + com.woniu.pos.common.dao.entity + global-config: + id-type: 0 # 0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) + db-column-underline: false + refresh-mapper: true + configuration: + map-underscore-to-camel-case: true + cache-enabled: true #配置的缓存的全局开关 + lazyLoadingEnabled: true #延时加载的开关 + multipleResultSetsEnabled: true #开启的话,延时加载一个属性时会加载该对象全部属性,否则按需加载属性 +logging: + level: + org.springframework.web.servlet: ERROR +server: + port: 8088 +--- + +spring: + profiles: dev + datasource: + url: jdbc:mysql://127.0.0.1:3306/ds1database?rewriteBatchedStatements=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: 123456 + +biz: + datasource: + url: jdbc:mysql://127.0.0.1:3306/ds2database?rewriteBatchedStatements=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: 123456 + +logging: + level: + ROOT: INFO + com: + xncoding: DEBUG + file: D:/logs/app.log + diff --git a/mybatis配置多数据源/springboot-multisource/src/main/resources/banner.txt b/mybatis配置多数据源/springboot-multisource/src/main/resources/banner.txt new file mode 100644 index 0000000..2e69723 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/resources/banner.txt @@ -0,0 +1,139 @@ + :: :.:..... : ....: ..: ..: : : :..: ..:...:.... :..........:.... .:.: : :.::..:.:......:.:..: : :...:..:::..::.:::::::..::.:::::.::::::::::::::::::::::::::::::::::::::::::;:::::: +.::.:.:::...: ::.:.:.:.:::.::::.::.:.:.:::.:.:.::::.::::.:::.::.:.:.:::::::::::::::.::::::::::::::::::::.:::.:::::::::::::::::::::::;:;:;;;:;;:;:i::::;;,;,,;::;,i;:i;,;:;,;;,;;i:;: +::.::: :::::::::::::::::.:::::::::::::::.:::::::::::::.::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;:;;:::::;::::::ii,;,ii,,;,,:ii:ii,;::i:ii:i;,;;,i:,;,:i:::;,,;,,: +::::.::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;:::;;:::::::::::::::::;::::::;::::::::;:::;::::::i:,;:::;,;:;i:;,,;i;i:i,;,;,:,;,::,;;,;,:,;:;,,;i:;,;::i:,;,,;:;, +:;;:;;:,i:,;:;::i:i:;:,;,,ii,,:;;,:i,;,,;,,i:,:::;:i::,;::,;,:,::i;,;::;:::::,:;:,::::,::i;:,::::::,:,:,,:ii:i::i:,;,;,:::;:;:;i:i;ii:i;,i;,;:::,:,::,::i:i:,::;,i,;ii;,,::;,:::i:i: +;ii:,:,;;,;,,:,:;,:,:,::ii;,;:i::;::,:::::::;::,;:,;,:i:,;:::;:i::::::::::::::;,;,;;:::;:::::,::;:::::;,:i::i:;,::::;::::::,::,:i:iiiiiiiiii::i:::;:;:::::::;::i:,;i,i:i:i:,;::::::: +,;;:;,;::;:::;:i::::::,;::i:i;::::,::;,::::,:::::;:i::;,:::;iifffjiii;i:::::i:,;;:,,:::,::::::::::::::::;,;;,;:;:,;,:;,::::;i:;;:iiiiii,i:,;::::;,:,:::;,;,:,:;,;;ii;,;i;::;::,:i::: +,i:i::::::::::::::::,::i:i;;ii::;::,::::::::,::::;:i:;,;ijffLffffGGGDDLGfii;;:,;:i::::::;::::::::::::;::;:i;,;:;::;::::::,;:i:;;i:i:iii,;ii:,;::::,:;::::,:;::;,;;,;ii:i;,:;:;:::::: +:ii:;;:,:;,:::::,;,:::::iiiii;,;,:;:i::::::::;::;;,;ii;ifGLGGLGDGGGDDEDGffijiiii;::;:::::::::::::::::,:;:,::::,:,:::,;:::::,::,i:i,ii;;i,;;,;:,::;::::::;:::,;:,;i:i:,;,,;:,:,:;:::: +i;;,:::::::::::::::::::i::i:ii:,::::::::::;:::,;:iii;ifLDGfDDDGDDEEEKEEDEGDDGLfi:,;::::::,::::::::::::::;:;:i:::;:;::::::::;i:;,;:i:ii,;i:::,,::::,;::::,::::::;,:i:i;,;:,::::::,::: +i:,;,,:::,:::::,::,::,:,;;,;i:i::;,:::::::,::,;,;i;ifLDGGDEKEDEEEKKDEDKEKEEDDDGfi;,::::::::::::::::::::::::::::::::::::::::::,:;:i;;i:;,;,,;::;:;:::::::::::;::,;i:;::;,,;:;;:i:;::: +i:,;::::::::::::;::::,:::;:i::;,,:,:::::::;:,;iiifGGGDGDEEDKEKEEWW#WKKEWKEW#KKEGj;i;,::::::::::::::::::::.::..::.::...: ::::::,;:;:,;i:i:;::;::;:;:::::::::::::,;;:;:::i,:;:,::::::: +:;;,::,:;:,::::::,::::,;,:::;,:;;:;:::::::::;,jjfGDGDGGGEDEEKKK#KWK#E#WWW#KWEWEDffii:;::::::.:::::::::::...;;:ijiii:::: :::::;:,:i,:;::;:::,:,::::::::::::,::::::::,::;::::::::::::: +,::;,::::::::::::::::::::::i:;:::,:,::::.:;,iifffffDGGfLDEKKWK#WKEEWWWEWKKWWWWKKDGGi;,::::::::::::::.:.:;:;;;jLfGGfji;:::::.:::;::;;,:::;,;::;::;:::::::::;::::;:;:;::::::;:::i::::: +::;::::::::::.:::::::::::::;:::::::,::::::i,ififLDGDDDDEKWEWWK##KWEWWWWKKKWKWWKWWKDGfi;::::::..:::::;,;ijLGjjjtjLGDDGDGGGi::::::::;:::::::::;::;,::::.:::::::::;::,:::;::::::::::::: +:;:::::::::::.:::::::::::;:::,:;::;::::.::ijtGDGDDDDDEEKWWWKWWWWE##KK##KKWKWK#KWK#EGfii:::: :::::::::iiifLGGGGjjtGGEDGEGDj;;:::;:::;::::;::::::,;:::::::::::::::::;::::::::;:,;::::: +:::;:::::::.::.:::::::::;:::::::::,::::::ifDGDKEKEDELDKKEKEK#WW#K#WWWWWEWWKK#KK#KKKGGi;::::::.:.::.:;ijfGGGEEDGGtjGGKDDEDG;;:.::::::::::::::::::::::::::::::::::::::;::::::::::::::: +:::::::::::::::::::::::::::::::::::::::;ifDEDDD#GDEDEWWKEW#W#E#WWWKKWKWWKK#EWK#KEKGjii;:::::::: ::iiLGDGKKKKKDKKEjjGEDKEEjjGfj;:::::::::;:;:::::::::.:::::::::::;:;:::.::::::::::::: +::::::::::::::::::::::::::;::::::::::::iiGKKDGEWEKEWWK#K#KWK#WW#KW#WK#WWKWKWK#KKKDj,;:::::... :::i;jGGDEEKDKKKKKKGjjGEKKDjGGGjf::::;::::::::::::::.::.::::::.::.:.::.::::::::::::::: +:::::::::.::: ::::::::::;,::;::::::::,;ifLEKEEDEK#KKKWE#WW##KWWK##KK#KWWKKKWEGKGGi:;::::.::.:::::ifGGGEKKKEKDKWKEGLjGD#EKGGGGGG;:.::::::::::::::::::::..:::::::::::::::::::::::::::: +:::.::: :::.:::::::::::,::::::::::::i;ifGDEKKEEKKK#KK#KWWWKWWW##EWW#E#WEWEWEEDGjLi::::::::.: .:;ijjLGEGDGGEKGEKK#KGGGKKWEDEKDGGi;::::::::::::::::.:..:..:..::.::.:.:::::::::::::.::. +:::::.::::.::::::.:::::::::::.:.::::iifGGDK#EWEKEWK#E#WKWWWKWKWWWKKKK#WEWDGGGLit;;:...:::. :.:;ijLjjjjLGGEEKDEEDGEKDGGEDKKKEEGGi;::: :...:: :::. : ::.::..:::..: .::.::..:::::..:.:. +::::::.::.::: :.::::::::::::..:.: ::iiGGDEEWKKKKEE#K#KWWWWW#K#EW#KWW#KWEKEGfLf;;;;;: ::: ::::ijLGjtjLLGGKEEEEEDKEDKDEGGGKKEKKDGj;;:;;::::..:....:.: ...:..:....:::...:..:.....::.::. +:::.:.:::.: ::.:::::.::.::..:: :::::iLGDGDKWKE#KK#WWEKWWWWWKWWWEWWWWKKKKKDDfjj;;,,..:...:.::;jGjjjjLGKEEGEKDDEGDDGGGGfLjGKKEEKGjj;;,;;: :.:.:::...:. :....::.. : ..:::::..:::: :::: +.:..:..:: : ..:::: :..:: :....: .::ijGDKDGEWEW#EW#EWKWWWWWWKWWWEWKK#KWKKEDGGi;;;,,::.:.: ::;i;t;LEGGDGEGKEGGGLjiji;j;;;;tjGGEKDGjt;.:.:: :: ::.:: : :.......:..:: :.:.:...:.:...::. +..: ::..: :..::...: :.: :: :::..:::ifLGEKEKEK##WWK##KKWWWKKKWWK#K#KKKWKWKEKGti;:.:.,.:. : ;ij;;jGGGLGEGGDEGLjj;t;;;;;;;;;;tjGEDGjt;:.. ;:..........::..:.......: :... :..: ... :... +..... : : :.. :.: .: .: :.. ::::;ifGEEKKE#KKWWWEWK#K#K#K##EWKEWKWWWW#EEEDGi;;;.:.:..:: :;ijitGGLLGEGEKGGGjj;;;;;;,;.;;:;;;LGKEGt;.: :. :..:: ::. :. :... .... :.....: : :::.....:: + :......:. ..: ...::..: ::.....:::;iDEEWEKKKKKKK#WK#KWKW#K##EWWWKW#EKEKWKKEDGj;;;.::.,: ;;ii;jjGGLGGDKGGjLjji;;;,::,:.;:,::,;tjGGLL;................:... : .:: ::....:..: :: :..... +. .::..: : . : :..: :..:: :..:.:::iGDKKKK#KK##E##WWWW#KWW#WK#EKWWKKKEEWEKGEGj;,.:...,..::;;jjLGLGLGEGLGLjjtjt;;;;;.;;.::,:.,;iGDGG;;.............. :..: ::.. :.. : : .: :. : :..: +.::..: :..:... ...:: :: :: : : ::,iGDEEKEK#EWKW#WW#KWK#KWWWWWKEWKKEWDDDKKKDGGi;.:.:,.;::;;itLGLfLGGGGGjjjt;i;;;.;,,::,:...::,;LGGGL;:: .. : ....... : : :....: :: .. :.....: :: :: + :..::.::.: . :: : :.....: :: :::ijDGDWEKWWK#KWWW#K#WW#WW#WWWKK#KWKEKKKDKEEGGj;.:...:.,:;;;jLjGLLGKELjLjjt;t;;;,,;:.:.:..:..:.iGGGLj:.:..... : : ::..... ... :.:......: : : : : +.. : :..: :. ::. :.......: :: :::;fGDDDEWKWW##WW#KWWWWWWWWWWE#KWKEWEKEKGDEDGGj;:.:..:.,;i;jjGGLLDKEGLjjjtjt;;;,,;,:..:.:.:.:.:;;LGt;j:.: .. :....:: :: : : . : . : :.: :.: :.: .: +. : .... .: : : :.....:......:::ijfDEEWKK#K##K#WW#KWWEWEWWWWWKWEWKEKGGDGEGGjj;.:..:.,;jEitiGGLjGKELjjtijii;;;,;..;:.:.::.:.:..;jGjtt.:: :....: : :.: :.: ::...... ::......:.:.:. +: : .........: : : : : :...::itGDDKEW#KWKW#KWWWEE##WWKWEWEK#KKEKKDGKGGGGf;,:..:..;jGK;jLGLGGEKEjLjtt;j;;;;,,,::::.;..:...::.jGLj;j ::: :: :: : : ......:: :: :.:....:.: :.:.:. +: ...................: :....:...:;fGDDKEKWEW##W##KWWWW#WW#K#KWK#KKKDKGfGGGGLj;::..:.;ijjjjGGGGDKKEGjLjjLjjji;;;;,;.::.:..:....:.;fGLijj.:: ::.::.... :: : : : :..:.. : ::..:..: + ....: :.............:: ...:..: :ijGDKEWWWWWEK#KK#WWWKWE#KKWWK#KWDEGGGGfjGji;...:..;;;;;iLjGLGKKKGLLjLLGGLLLj;;:;:.;:..::.::....:jDLijj.:............. :..: :: :: :.......:: :: ::. +: : ..: .. : : :: :: ::. :: :: ;fGDEDEWWWKWWWWWWW#WK##WKWWK#KKEDKEDGfGfjL;;.:.,:.:;...;GLLGDDKEGLGLGGLjfjfLj;;;;,..::.:.::.:...jKLt;j;.................. .. : .........: .....:: + :...: :: .. : : ....: .. ... :: ;fLGDDEKWWKKWWW#K#E#KKWKWKWK#EKEDEGDGGGjji..:.::;.:.:..;LGLGKKELLjjjttt;;;;;;;;;,;..:.:;;;i;::..;KGj;;j; : : .. :: .. : . .. . .. :: . .. ..: + .. . : .. :: : .. : ....: . :;ffDGEK#K#K#WW##WWWW#KWWWK#KWWEKGDDGfGfjj;.:...:..:..:;jGGGEWKGLfLjtjtttij;.;;;;;.:.::;;;iji;:..;KGf;;;; .. : ... .... .: . ..: : .. : :: :... : +. .. ... .... . . .... . :: :. :LGDDDEK#WE##WW#K#KK#EWWW#KKWKEKDDGDjGfij;.::...::..:;j;iLEDKKGjLjjjtjjLLGLj.;;;;;..:.,:;;;t;j::.EGj;;;;: .: .. . : .. .. : . :. ....... . + . . . .: ... . . :. . : .. . ..;jGDGDKKKKKWK#WKW#EK#WKK#KWWWKEDDGGGjGjjtj,:...:.;..:;;;;;GKKGLLtjjtjjGGEEKD;.,;;;.:.;;,;,:::;;.:DGL;;;;...... : .. : .: : : : ... : .. :..... + : . : . :.. : . ... : . .. ...iGDGDEKKWE##EWWK#K#KWWKKKWWWEDDDGGGjGfjji;::.:.....::,..:,DKLjtjttLLGELiiEGG;;i;;.:,;;;;jjj;: :.GGj;;;;... .. : .. : : .. .... : : : .. :....: +. : . .... :.. ... . . : . . ;GEGDDEE#KWW#KWKK#WE##K#K#KKDKGEGGGGjjjjj;:.,..:.:....;,:,;EGLjtjjjjLLLLjLGK;;;;,: ;;;jGDWKG;. .Gjt:,:;: .: ... : .. : : . .... :: ......... + . ... : . . : .. .. .. : . : :GGDEDEWKKWWWEWWKKWWEWWEWKKKDGGGGGjjGjjji;:;:::....::.,:.;;jGLtjttjtjtj;;;;j;;t;;..;;;jiifDW;:.:Ei; :.; : : .. .. :.........:... .. : :... : .: + .. ... . .. : : . .... . .: ..GDGEEKKK#KKKKWWWW#KWWWKEWKKGLL...;jjfjji;,;::.:.. ...:;:;;,;Gtjtj;j;;;;;;;;;jtt;:.:.;;itjjLL; .L::..;... : .. :: .. : : ..........: : : ....: +. . . ..: .... . ........ .... :....LKLKDKKKWWWWWEWWWK#W#WKKKEELL;:;..,;jjjt;;.;.:.:.:....:;;;;iLjtjiti;;;;,,.;;tji;;:.:;t;;;.;;;..j:. .:. : : ..... : .. ..... : .. : :: :...: + .. . ... .. : .. :. :: .... ...: :.iGGDEKKWEWWWKWWKWWK#EWKWEKGLt,tt...;;jjj;;:;;:... :. .;;,;;jGjttti;;,,,;.;;ijtt;...:;;;;;..:. .j: :; .... . ...: ...... : .. : :: :: .::..: :: + . : . . : .. :: ..: :: :: .. : ....;jGGDKDKKKWKKK#KWWWWK#KKGLLtt,tj,..:;;;;;;:,,:,:.. . ..;,;LKLttjt;t,.:,;:,;ttjt;:...:,.:.:.: . j: .:. : : .... : : :: .. ......: : :: :..:: +. . ....: : : . : :.. : ....: :: :.:;fGDKDEWWKWEEWK#KWWWWKEGGjf;,ti:,...;;;;;;;:,:..:..:..,;jKELjttt;;;;,,,.;;jtj;;::....:,,:...:.j:..:.. . .. : .. :: : ........: : ::....: : : + :....... :...: :.. :...... ....::iGEEEKEKKWKWKWWK#KEWWELjLj;,,,j;.:.,;;;:,::;:.:......;;KKGLtttt;,;,.;,;:;jjj;;.....:.::... . f;..: ::.........: :: .......: :.:.:: :.......:: +. .... .....: .. : : : : ..... : .::GGDKEDWWEWK#EWWWK#KWGLjjf;;.tLL. ..;;;;;:;:,:...:. .,jEWGLtttt;;;,;:..;tjLj;;:.:...,:.:..: .ii.:.......... : : : :: :: :::.::.::.....::.. : +....... : . ..... ..: ..:..... .: .:.iGGKKKKKKK#EW##K#WWKGLjtLt,.;ff; .:.;;;;;;:;;:..:.:.:,LEELtjti;;,,::.;ttjtj;,:...;,:::.: . .i;;:::.::.:...:....::: : :::..:.::::..: :..:: :.: +..: :: :: ... :... : :...:..:::..:...;DGEKKEWWWKWWWWWKKKKLjjLfj;.,;t;.:.;,,;,:;.,:,,...::,:jDELtttt;;;:,.;;Ljtjj;;..:.;;.... :.. ;;;::.:.....:..:.:.: :: : ::..::::::::.:.::.::... +.: :::...................:.:..: : :..:.:jGDEEWWKKK#K##W#WWKLjjjtjt....;..;.;;;;;;.,,..,.:...,;GELtjtt;,;,,:;;jjLLLj;,;..;,,:..: : :;:;:::::::.:.:..:.: :.::::..::.::.::.:.::.::::.:: +::::::.:.:.......:.: :.:.:::::::.:...:::.;GDDEKEWKWW#WW#KKKLLjtjtj;....:,,;;;;;;;.,,:.......;;LKLtjtt;;,,;;it;tiij;.:;: ,;;,..:.: .:.:;.::::...::.:....::.:.:::...: : :..: ::.::...: +::::::.:: :::: ...:.:.:.. :::.:..:.:.....:LGEDWWWWW#KWKWKEEjjtjjjLt;.. .;;;;;,:,::::..::..:.:jKELttt;;;;:;;ttt;t;;:,:...:;;;.:.. .:::..:: ::.::.:.:::...: .: :.:..:.:.::.:..:::.:.. +.::.:.: ::: : : :.:.:.:..::...::: :.:..:.:LGDDE#WWW##WWWKKGLjjtttjLt;:.:,;,;;;;,,;:::.:..:.:,LGEGjttt;;;;t;tj;ttt;;...:.:;;,:.... :...;..::: : :: : ...::.:: :....:....:.: :.: :... +....: : .: :.:...:..: : :::....:: ::..:: :jDWKWWWEWWWWKKDDGjtjttit;;;;;;tt;t;;;,;:,.:.. :..:,;LGLttjt;;,;tLLDDDGGDLff;..::;;:..:. ..: .: :..::: ... ..:: : ...: ::........ :: :.: .. +.....:.:: :.: :...:: ::.. : :..:: : ..::..fKWWKWWWKEKKKEDGGjji;;t;;;,;;;;ttt;;;;.;....:..:,,;tGLLtit;;;.;tGELLLGLfffLjt,.;;,..:. ::...;... : :: :. :.: ::: :............: : ..... + :: :....: :.: ..: :.....: :: ::.........iEWWWKWWKKKEKEGGGj;jt;i;,,:.;tijt;;;;;;.;.:..:...,:tGLjtti;;,;;;LGLjt;;;t;ffft;;,;:.... :: :: : ....: : .: .... : ............ :: :: :: +: : : :.........: ::...................;GKWEKEKEKEGGGGGjjti;;;;,,.;;;tttjt;;;,:...:...,:;;;LLtjttt;;.;;;DGL,;:...:tfLf;;:..: .. : :...............:: : : ...........: :: :: :: + :: ::.. :: : : :: :: :: : : : :: :...:iDKGGGGGGGLGjjjjti;i;,,;:;:,;jjttti;;,,,..:..,:,,;:.;jtttt;;,;;itLDGLfft,,,Lft;;,.... : :. : .. . : : :...: . .. : : :: :: : : : : +........: .....: : : : ...: :: : : : :LGGGGGGGLLjjjtj;jt;;,;,,.,;;tjtjt;;;;;:,::..::,:,:..;;;i;;;;;;ttjfGDLffjjjjt,;,;:.:.: .. : : .. :: :: .... : : : : :: .. : : .. :...: + :: :: ::.....: : :: :: :: : .......: :: :: ;i;ijjjjjjjj;jtt;i;;,,::,.;;;jjiit;;;,,:..,.,.:;,...:;tiit;;;;;itjfGGLffjti..;;..... .. :. ...: . : .. .. : .. .........: .. : ..... + :: :: :: : : : :...: ... :: :: : : : . ::.:,:i::::::;t;;;,,;;::,,:;itjitit;;;;,:,:,,:,; :..:,;ti;;t;;;;;,;;;,;....;.:..... :: : .. :: :: :.. :: ... : : .. :.. ..... .... +: .......... :: : : ..........: .. : .. :..::i;,:;::::.:;;;;,;:::..:.,;;ttt;;;;,;;;:,,,,,, : ...:;t;jiit;;;;;;;,;...:.:..: .: .. :.. ..: :........... . : .. ....... : :: :: :: + :: :.......... : :: :: :... .. : :: :: :itfGDGffjii;::.:. ::;;.;:,:.,::,;;tittt;;;;;;,,,:;.. : ...;;ti;t;;;,,:.::.:: .:.:.... ...: :: : ..: .. .... ..... :: :: :... : : : : + .: ...... :: :: ....... .. .. : :...:ifLDDDWDWWEWKWKWEDf;. : .;:::.,.,;,;;;;t;;;;;;;;;;. . : ..:.:.;;tit;;;:,:..... :.... : : :: : : . : : : :..... :.. : .. . : ...: :.. .. + :.. .. : :... ..... ....... .. .. .. ;tfGGDEEEKWK#W#KWWKKEGf:.. :,.:...:::;;;:.. ...: ...... .:. ..:;;itt;;:;.::.::. :...: . .. .. . ........ . :: ..: .. : : :: .. : .... :: + . : ..... .. ... . ..... : .. .. : : iffDDDDDWKKWWKEWWEW#KKKKi...:::,.::;,,:. .. ... .. ..: ...:.:::;;;;jit;;:;.: ...... ..: ..: ... :.. : : :: .... : : .. .....: : : : . . +..: . : . .........: :.. ..... :: ..: :jffLDEDEEKKKK##WWKKEEKKEDL: ..:,:::.::; :: :.. :.. ... . :.:.:,,;;;itj;;;.:.....:: .. :... ... .. : : : : . ..... : ....: : : :: .. .. + . .... ...: . : ... .... . . ....ijLfLGDDDDKKWWWWKWKKKWEKWEEEKD: ..,.:.::. :.. :.:.. .. : :.::.;.;;iititt;;;;:::... :......... : : ..... : : .. : .... :.. : .... : . + .. ... ... : .... : : .. .....: : itjfGDDDEEEKKKWEW#KWWKKWEWEEKDDGi :.::,: .. .... . . : : : .::.::;;tttjttiti;:;..... :.. . : . .. : : : ...... : : :: : :.... ...... +..: : .. : : . :: : . : : ..fLfDDDDEEDKDEEKKKWWWKWWWEWEEEEEEDj..::.;: :: . : . : .. :.:.:.;;;titjtit;;:;:...:.... :....: .... ...: : : . : ... : .. ... ... .... . + ....... . ....: :: . : : . : : tGfDDEWEWEWWW##WW###W###K#KKEEEEDEf:.,: : .. ... .. : ....:.,:,:;;tit;t;,,,.,...... .: .... . : . .: . . . . : ...: . : ... ... . . . + .. :: :: : . . : .... .........: :ifffDDEEWEK#KEW#WK#WWWW#W#WWEKEEEEKf.:. : . : : . .. .. . :,:;;;jttt;;;;,::....:. : : : .. : . ... ... . : ... .. . .. : .. . ..... .. . +........ : .. :. : . ....: ........:ffffGLDDDKKKWK#E##W##W#W####WKWDEEEEf ..: ... :.. .. : ... : ..::.;;;j;;i;;:;::.::.... . ........ : . ... ........ : .... . .. :... . . .. + .. :: : .... ... . .. : :: .:iiffffGDGDDEDKKKK#KK#WWK#KK#KKEW##WKDWDEi.... .... ... ..... : ...:,;;tti;i;;,;.:.,::.:,:. :. : .......: .. :... : ....: : : :: .. : : . +.... : ....: ... .: :.. : .::tifDGLfGDDDGDDWEWKWKWWWWWWK#WK#WEKK##KDEWEi : :.. .. :...: .: ...,;;;;iti;;;;,.;:..:.:::::.. : ::..: : : : ..... : : .........:. :...... ::..:. +..: :... ....... ........... iiiitfEDDDfGDGGDDEEWWWWWWKKWWWK#KKEWEEED#WEDDG: .... :: : ....... : . ,;;;;j;t;t;;,;..:::..:.;....: : ... : .. :: ....::..: : .....: : ....:. : . .. +... :: :: : ......:: :...: :ititifLDGDfLGDfGLDWEWWKKK#EWK#KKKK#KKKKEKDWKEDDf............. : : . :;;;;tt;tt;;;:,..;..::.;.;;.:: .:::..::. :..:.:.....:..:. :.....::..:::...::.:: .. + ::.:: ::... :. :....:...:tDLifjtfDEDGGDDffffDKWEEWEWWEWWEWWEKKWKKEWEKEDEEDG:.: .:::....:::.:.: . .;t;ttt;ttt;;:;..,.:.,.:;;;;;.:. ::..::.:.:::::.::::::::::..:::.::.::::::.:.::.::. +: .: : .:::.:.:: :: :: :iDDfifffGDEDLLDLLffLDKEKKEWEEWEKEKKKWKKWEKWEWWEKDDLL..:: :..::::.:: .: . ;t;itt;tt;t;;,;,,.,,,:,;,;,;;;:: ::::: ::..:::..:::.::.::.:.::::.:.:.:::::::::: +.: :::.::: .:.: ::..:.:;iGDLtfffLDGDfLGLGLffGDKEKEWEEEDEKKKKKKEEWWKK#KKKKEDDLfff;::.::.:.:.::: : .;;ti;ijit;;;,;:.,..,:;;;;;,;;:;::.. :.:::.::.::::::.:::::::::::.:.:::.::::.::.::: +.:.:..::::.::::::.:.::tfGGfftDffLDfDGfffLLfDKEEDEEDKEKKKKKKEWEKWKKEWEWWEWKEKDDLDi::::::.::::: . . .;;;;i;j;;t;;;;..:.::;;;;;;;i;;:.. :.. .:::::::;::::;;:::::;:;:;:::;:;::;;::;: +:.:::::.:.::::.:.:::iitDfGfGfLffGLDDfLGGffDEDKEDEEWKKWEWWEDWEKKKKKKKKKKKKWEEEDDLi::;::::::::. .....:;;t;;titit;,,,;.;,;,;;;;;t;;;::.:..::.::. ::;::;::;i;,:ii;i;i:i:::;;:::;:::;,,; +:::.:::::::.:::.:::iitfDfGDfDDfffDGDLDLLLGKDKEKEEKKKKKKKKKEEKKKK#KWKKEEKKEWEDEDLLi;:;:;:;::: . . .,;;;;j;tt;;;;;;:;::;;;;;;;;;.:;::.:::;;;:::..;,:ii,i,;iiii,iiiii:i:i::i:;i:ii;iii +;iii;;:;;:;::;:iiiijffKffGfLWGfLDGDLLDGDDEEEEDWEKKKKKKK#EKKKWE##WKKKKKKKEKDEDEWEEDDii;i:: : : .: :,;;;;j;t;;t;;:;;;;:;:;,;;;;;;;;:;,:;;;;::::.:.::ii:i,;,;;i:,i::i:i;,;:i:::;,,;ii, +,;,;,,ii;,;,,:iiittttGDtGDfD#LLGLDfDLDGDEEDEDWEWEKKKKKKEEKDKKKKEWW#KKWKEWDKKKWEWWEEEGt: :...:. ;;;;;;jtt;;;:;;;;,;;;;,;;;;;j;:,,:;,;;;;,::.:: :::;:;;;::,;;:i;,;:::,:::;::,:i::; +iiii;;;;:i,;;iG,itiffWLfDLDWEDfLGDDLDDDEKKEEEEEKKKKKKKKKEWEKKKKWKKKKKWWEEKKK#EWEEKDEEDG . ...:.:. :,;;;;t;;;;;,;;;;;;;;,;;;;itj;;;:;;;;;;;::....: ::,;::,;:;::;::::::;:::::;::::;i: +;,,;;,;ii:i:LEttijffDWffDDDWWDGLGDfDGDEEDEEEKEEWEKEWEKKKWEWWEWEE#WWEWEEWEKE#EWEKDEEDEDEi. ...::;:..;;;;t;;;;;;,;;;;;;;;;;;;;tij;;:;;,;i;;;;.:.:. .: ::::;:::::::::;::::::::::::;:::: +:::::::::::jGiittffDKWtLDEWKKDLDLLDLGDDEEDDKKEKEWWEWEKKKWEWWEWKWW#KWKKEKK#KKEWEWDEEDWDKEDj::..: : ;,;t;;;;;;;;;;;;;i;;;;;;;;;j;;,:;;;;;i;;,:..:.: : :::::::::::::::::::::::::::::::: +::::::::::tKjijtffjE#EffDKKKDDGfGLGLDDEKDEDEKKWEWEWEWWEKKKKW#E##KWEWKKEWWEWEKEEEKKEKDEDEED.:::.:.:;;;;:.;;t;;;;;;it;;;;;;i;it;;:;;,;;;;;,;:.:.. . . :::::::::::::::::::.:::::::::.:. +::::::::::D#iftffffWWDfGDKKKEDLDLLLLLDDDEEEWEKKEWWEWEKKKKKKKKW#WWKKKKKEWKEWEKKKKEEEKDEEDED::....:,;;;,:;;t;;t;;i;;;i;;;;;;;;j;;,;,;;;i;;;;;.::... : :::::::::::.:::.:.::::...::.:... +:::.:::::EKfffjfffGWWLjDDEWDEDGfLLGGGDDDEEKKEWWEWWEWEKKEEWEWW#KWWKKKWEWWKWEKKKEKEEDEDKEKDED;..;::.;,,;;;t;;;;;;;;;;;;;;;;;;;;;;;;:;;;i;;,;:.::.. . .:.::::::::::::::::.::.:..::::::. +..:.:.:.jWGfffffjfD#DDfDEKKEEDLDLLGLDDEDEKDEKKWKEEWEWWEWKKKKK#W#EWKWEWWK#WKKEKEEEEEEKDEDEDDt ::.;;,;:;;;;;;;;;;;;;;i;;;;;;;;,;,;:;;;i;;;;,.:.. :.:. :::.:::.:...:..:::.::.::::::..:. +:::.:::.DKfGfffffLEWDDfDEKKEEGfDLDLGDDEEKDKKDWWEWWWWKKWEE#W#WK#WWWWKK##EWWEKKKEKEEEDEKEKDEED:..;:;;,;;;;;;;;;;;;;;;;;;;;;;;,;;;;;;;;;;;;,;:.:.: ....:::: ::::::::::::::::::::::::.: +:::.::::WfDLLffDfGKEDDfDEEWEDGDDDGGLDEDEEKKKEKKEWWEWWEWEEW#E#WEWWWKWWWKKKEKKKEDKKEWDEKDDEEEDG,::,:;,;;;;;:;;,;;;;,;:;;;,;:;,;;;;;i;;;i;;;,:.::. .....::.:..::::.::::::::;::;:;:;:::: +: :::: iELDDfffGfDWDGEfDDEDKEDLDDfDDDEDKEDEDKKKKWE#KWWWW#KK#WE#WW#KK#E#EWWEWKKKKKDEEKDEEDKDED::;:i;;;;,;:;::;;;,;;,;;;:;;;;;;;;;;;;;i;;,:,.:...... .::.:::..:..:::::::;;:;,;i:i,;i;: +:::.:::fGDDDGffLjD#GDEfDDDKEDGDDLDGLEEEDKEDKKKKKKKKKKWEWWK#E#KK#WKW#KWKWEKKKKKKEKKKKEKDDEDDDD.:;GG;;:;;::;::;:;;:;;;;;;,;;;;;i;;i;;j;;;;;::.:: .. ..:.:.:.::::::.:::;;iiii;i;i;;i;i; +.:::...DGDEWLtGffD#LDDfGEEDEDLDDDfDDDEDKDEEKKEEWKKWE#WKKKWEWKK#K#W#K#W#K#WKKEWEWKEDDKDKEEDEDE::jWG;;;;:;,:;;,;;:;;:,;,;;;i;ii;;;;;i;i;;:.:... : : ...:..::..::::::;:iiiiiiiiiiiii;i +:.::..fWDKKKLfDtLKWLKDfDDDDDGLDDDGDDEWEDEKEWEKKKKE#EWWKWKWWKKKW#KEWK#KWW##KKKKKDKDEEEEEDEDDDD::;;it;;:;:;;::;;;;;:;,;;;;;;;;tji;;;iti;;:...: ...... ....: ::......::;;iiitijiiiii;i; +.:::.:GWEKKKDfDiDEWGKKfGDEDDEGDDDGDEKDEKKDKEEWWKKKKWEK#KWWKWWWWW#KWWWKWKKKKKEWEKKEWKKEKEKDDED;:::;;;;:;:::;;;,;:;;;;;;;;;i;;;jji;iti;;:;;::.:.. . ...:...: :.:.:::::iiiiiiii;iiii;i +:...:iKDEW#ELDDiDWEDEKfDDGDEEDDDDDDEEEKEDKKEWEWKWWKKW#EWWWKKWE##KWEWWWWW#WWKKKKKKEDEEDEKDEEDDi.:;;;;:;:;;:;;,;:;;;;;i;;;;;;;tLjj;;;t;;;::.. . : ...:: ::....: :.:.;:i;iiii;ii;;iii; +.....fWLW#WEDDDjDKDKKKfDEDEWDDDEEEKDEEKEDWKKK##EWWKKWW#WWKKKWW#WK#WKWW#KWWWWWEKKKKEKDEDKDEKDE;:;::;:::;:;:;;;:;;;;;;;;;;;,;;jLj;;i;i;;;,.:...: : :.::..: : ....:.::::;iiiii;i;ii;i,; +:..: GWLWWW#DDLfDDLKKKLGDEDEDEDDEDEKKDEWDEWEWKK#K#KWWWK#KKKKWWWEWWK#WKKK#KKEEKKKKDEEKDKEDEEDEi;:;;:;:;:;:;;;;;;;;i;i;;;;;;;;jGji;ti;;;,,:...:. .. .. : :.::......:::;iii;iii;i;i,i; + :..:DEDW#WELEffDDDWKKfDEEDKDGEDDWDKDKEEWEEWE#KKWWK#W#WWWEK#W#WK#KKK#KWEWWEWWKKKKKKEKEDEKDDDEj::;:;:;:;:;;;tLGGGLL;;;;;;:;,;LLLti;t;;;;:.:.. : :...::..: : t,....:::;:i;ii;i;,;i;i;, + :...EEK##WEDDfLDEEW#DfDEEKDGDDDDKDEDKEDKWWWWKKKKE#WEW#EEKEWWW#K#W#KKWKKKKWEWKKKKKEKEEEEEDDEDj;:;:::;,tLEEEEEEKEKEDj;;;:;;;;ELj;i;t;;,:.:... : . .:::....,D,: ...:::;ii,ii;,;,ii;i,: +: ..iWDE#K##EDffGDKKWELDDDEDDDEDKDEKKEEKKEEWWK#WW#KW#WW#WEKW#K#WWWWK#W#WEKKWKK#KKKEEEDEEEDEDEi:;::,;fGEEEEEEEEEEEEEDG;;;;;;;GGjtti;;;;;:.:: : : .... : .,jD..::...:::,;ii:iiii;:iii; + : iEDEWW#WEEDjfDEE#EDfDDEDGDDEDDKEDKEWWEWWEWKKEWK#WWW#WEKW#K#W#W##KK#EWWWWK#WEWWEKEDEDDEWEEGj;::;jLEEEEEEEEDDEEKWEEEf,;,;;;GLjt;;i;;,:.:. . . :.::..,iDL : : :::;ii;i;i:;,iii;;, +::iWWWEE#K#WDLfLEDKK#DGGDDGDEDEDKEEKKKKKWWKK#KWW##WWW#KWKK#W#W#W#KWW#EWKWWKWWE#KKEKDEEDEDEDEDi;,tLLDEEEEEEDEDEDEEKKEEDEf;;;iELjij;;,;;,:.::..: :: : . ;ijG, : :..:::i;,,;ii;i;,;ii; + :W#KWEEW##WKLfGDKKEWDLDDDDEDDEEKDKDKKKWKWKWWWE#KK#W#WWWWWWW#KWWWWWWWWE#WWWWK#K#KKEEDEKEEEKDEffLGEEEEEEEDEDDDDDDEEWKKEEDDf;fDjtiti;;:;.:...:. . ...:iijDi. : . ::::;ii;i;i;i;,i,;i: +:f##DWDWWWWKELfGDWWWEELDELDDEEWEDEKKWWWKWKKWKKWEWK#K##EKWW##K#EW#WEWWWWKK#KWKKWEKEKEEEEKEDEKDLDEEEEEEEKDDDDDDDDDDEEKEEEDDELLGLjt;;;:,::.:.. ..: ....,ijDf.... : :.::;iiiii,ii;;iii; +iEW#DWEEW##KDDfDEKKWKDLDDGDEDWEDKEWE#WKKWEKKKEWW#W#W##WKW#W#KWK#E##W#WW#WWWWWW#WKEDWDKEDWEEDEDDEDEEEDEDEEDDDDDDDDDEKKKKEDEEKLjj;i;;;;::.:..... : ::.jijDj.: :.: :::::i:ii:i;;iiiiii: +EWW#D#EEW#WWDDfDEKKWEDfDDDEDEWDEEKKKK#WKWKKKKKWWW#W#K#KWW#WWE#EWWW#E#W#WKWWWWKKKDEKEEKDDEEDWEDEEEEEEEDDEDDDDDDDDDDEEKKWKEDDWLjt;;;,;:,.:..... :.:.,tijLf. :.......::::;,:;,;,;;;,;;: +K###DWKK#W#EELfDK#KKKGGDEDDEWKKKKEW##WWWWWEKEW#K#WW#WKK##K#E#WKW#WWW#KW#KK#WKKKEKKDEDEEEWDKKDDEEEDEDDDDDDDDDGDDDDDDEEEKKEEDEGLt;;;;;.::... ... .,,iijjDi : ....::::::::i:::;::::;:: +EWW#D#WDWWW#DLLDKWEKKGGDDEDEKWEKKKWKWW#WWEEWEWWWWWWWWWE###WW#KKWWWW#E##K##WWWWEEDEEEDKDEEKKEEGEGEDDEDDDDDDDDDDGDGDDDEWKWKEEDLjt;;;;.,....::.....,t,ijfD,...: :.: .:.:::::::::::::::: +WEW#E#WEW#WWDGLDKKKWDLLDGDEDKWEKK#WW#W##WKEKEWW#KWWWKWWWW#W#WEW#W##K#WW#KW#WWEEEDEEDEEEKKKEEDKEDDDDDDDDDDGDGDDDGDGDDDEEKWWEELft;;,;;:...:....: .i,ijGDD.... .......: .:..:.:::.:.::: +E##WE#EWWWKWDDfD#W#WELDLGEEEKKKEK#W#WW#EWEWEWWWWW#WWKW#WW##WWWWWWWWWWWWW##KEEDKEKKKEEEEK#WWEEWWEDDDDDDGGGDGDDGDDGDDDDEKKEKEWDft;;,:.:.: .... . .i,jfDDf: ....::..: :.... ::...:::... +KE##W#WEW##WDGfDWWWKDLDfDEEEKKEKKWKW#W#WKWEWEWKK##EW#W#K##WW#EK#W##W#WWWWK#WEKEWEKEDEEKWWEEDK##WEDDDDGDDDGDGDDGDGDDDDEEEKWKEEEf;;;::.::.: ... ..iijLDDi: :..: : : ::.:: :.:. : :. +WE#KKWWD#KWEDGLEWWWEKfLDDDKKKKKK#W#WK#KWKKEWWKW#WK#WEW#WWW##WE##K###E##W#KKEEEEKWEWKEWKWWWEE###WKDGGGDGDGDGDDDDGGGDDDDEEKEKKEED;::;:.....:.. ..,iiLLDD;......::..:... ...: : ::: :: +#KK##WWEWWEWDDLEW#KEEfDDEKKKKWE##W#WK#KWKK#KW#WWWE#W##W#W#WW#EWWW##WWWW#KEKEEDEKKWEEWW#WEEDE####WEDGGGGDDGDGDGGDGGDDDDEEEKEWKEEf;::.:. .: . . .iijLDDi.: : ....:..: :: :..: ..:: ::. +###KW#WEW##WDDfKEW#WDLLDKKDKEWWKWW#K#W#K#KKWKKKWW#K#KK###W#W#K#W#KK#W##W#EKDKKEEKKKKK#KWWEDKWWW##WEDDGDGGDGDGGGDGDGDDDDEEKKKKKKD,.;:..: .......tjfGDD,....:: :.....: ....: :.: : .. +#WW#KWWDK#KWDDLD#W#EDfDDKWEWEKK#W#K##K#EWKWKK#KWWKW#KW#W#W###KKWWWW##W##WWEKDEEWKKKW#W#EKDEE###W#WKDGDGGGDGGDGGGDGDGDEEEEEKKEEKDf,,:.:.:. ... ,jjLDDf ::... :.:....:.:.:...:..::.... +#K####WD#E#EDDLEW#WEDfGEWEWEW#K##K#WW#EWKKWEWWWK##W#WW#W#WW#W#K#K###W#WKKEKDKEWK#W##W#WEDEKEW#WKWW#KDDGGDGGGGDDGGDDDDDEEKKEKEKEEEi;.:.:.. ....ijLLDD,.. :....::....:..:....:...: ::. +W#K#WW#EK#WEDDfK#E#WDfDDWWEKKW#KW#K#WW##KWWWKWE#KWWWKK##W##W#WW#W#WWW#KKWKEKKKKKWE##W#KEDEEEKW##WWW#DGDDGDGDGGGGDGGDDDEDKEKEWEEEDL,:.:. : . .,tjfDDD : : :: :: :: : : :....:: :. +######WE#WEKDELEWW#EDfLEWKKKWW#WWWW#W#KKKKE#WKWWKW#W###W#W##WWW#K####KWEKKKKKKW##W##KKKDEKKEKWWWW#WWEDDGGGGGGDGDGDGDDEEEEKEKKEKEEDt.:.:..... tjjfEDD : ... : :.............. ...: +#WWW#E#D#WEDEDLWWWWKDffKKWKK#W#WWWW##K##EWEW#K#K##W#W#W#W#WK#WEK##W#EKWEKWEW#K#WK#WKWKEEEDDEWWKWWWWWWKDDGGGGGDGDGDDDDEEEEEEEEEEEEDD :.:..:.: jjtDDDf. :.... : : :.... : ..... ....: +W###WW#EE#KEDDfEWWKKDfDDKKKWWK#WW#K##W#KKWWWWKKW#WWWKW#####W##W##W#KKKKKEEWWK#E##K##WWDDEDEDEWWEWWWWWKEDDGGGDGDGDGGDDEDEEKKKEEEEEED..:. . . .iijEDDj : .. ... . .. .: . .. . . +#WW###WKWWEDEDLKW#KEDfDEWKWK#W#KW#WWW#EWKKWWWWWKKK#W#W#W#K###W##W#KKKKKKKKWWWWW##W#KWEEEDEDEKKWKWWWWW#KDGDGGGGGGDGDDDDEEEEEEEEEEDEDi. :..::..jjjDDG,. . .. : .. : . :. ..: : : .. +W#K#W##EWWWEDDLKWKKEDfDEEEW#KWK#WW#WK#WKWEWWWWW#WK#WWW###W#K###W###EKKW#WWE#WWWWWWWWEWDDEDDEEWKKWK#KWWWEDGGGDGDGDGDDDEDKEKEEEEKEEDDf,:. . . .tijDDf.. .. .. .. : .. : . . . +#WWWW##EK#KEEDfKWKWEGfDEKKW#KKWW#K#KWWWWWEWW#E#K##K#KW###W#K#####KWEKKW#WWK##KKWKW#KKKDDDDDDDKWKKKKWW#WWDDGGDGDGGDDDDEDEEEKEEEDEDEDDL, .:...,jjGDDt : .: : ...... : ... : ....: .. +#W#W#W#WKKEDDDLKWW#EDfGKK#KW###WW#K#K#KKKWW#KWW#WW#K##K##K###W#W##EKKW#K#E#E#WWWWEKKWWEEDEEDEKKKKKWWKWWWEDDGGGGDDGDDDDEEEEEEKEEDEDDDDj.: ...tjDEDG,. .. . .: .: ....:.... : ... : .. +WWW#W###EWKEDDLKKWKDDfGKKKW#WK#KWWWW#W#KWWWWEWK#WKW#KW##W###W####WWEWWW#WWE#K#WK#KWKWWEDEDEDEWKWKKKKWWWWWEDGDGGGDGDDDEEDEEEEEEDDDDEDDD.... .tDEDDD, ... :......... : : .: :: ..... +WW###W##EWEEDDLKEWEKGfDEWW#W##WWW#KW#W#WE#WWWEW#WE#K###WK#WWK###WWEKWW#W#KWW#W#EEKKKW#WDDDDEDEKKKKKKKW#WWWWGGGGGDGDDDDEDEEEEEEDDDDDDDDj. ..;DEDDDL...:..:...:...::.........:..::..: +##W#KW##EKWDGDfKKKKEDfDKEWWWWW#WK#K#WWWKWKW#KKK#WW#W##W#######W##WW#K##K##KW#KW#WEK#KKEEDKEDEDEWKWKWWKWKW#WDDGGGDGDDDEEEEEEEEDDDDDDDDDL,.. tEEDDDf..: ::..:: ::.::.::::..:..:..:.::. +WWK#W###DEEEGDLEKKKKDfDEWK#K##W##W#EW#KWWW#KKW#W##WWWW##W#W#W##W#KEWKWW#KWK##W#KEEWW##KDEDDDEEDKWKWKWWWWWWWEDGDGGDDDDDEDEEEEDEDDDDDDDDGL .,tEDKDGf.:.:. :...:. : :..:.::..: :. :... +W#W#W###DEWEDGGEDKKEDLDKK#K#WW###W#WK#KWWW#EWW#W##W#K##WW#W#WW##WKKKKKWWWWWWK#KWKKK##KKEDEEDEEEDWKKKWKW#WWWWKDGGGDGDDDEDEEEEEDEDDDGDGDDDD.LDEEDDDj:..:::....::.:..: ::.:.... :...:.: +#KW#WW##EEKDGDfDEKWEDLEK#K#K##W##K#KWWWWW#K#KWK###WW#W##W####W#KWE#EW##WWWW##WKKKK#WWKKDEDKKEEDEKWWWWKWKWWW#KEGGGGGDDEDEEEDEDDDDDDDDDGGGDjGDEDDDGj.:: ::.::: ::..::...: :.:::.....: diff --git a/mybatis配置多数据源/springboot-multisource/src/main/resources/sql/schema.sql b/mybatis配置多数据源/springboot-multisource/src/main/resources/sql/schema.sql new file mode 100644 index 0000000..e334514 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/main/resources/sql/schema.sql @@ -0,0 +1,49 @@ +-- -------------------------------------以下是pos业务库开始------------------------------------------- +CREATE DATABASE IF NOT EXISTS pos default charset utf8 COLLATE utf8_general_ci; +SET FOREIGN_KEY_CHECKS=0; +USE pos; + +-- 后台管理用户表 +DROP TABLE IF EXISTS `t_user`; +CREATE TABLE `t_user` ( + `id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID', + `username` VARCHAR(32) NOT NULL COMMENT '账号', + `name` VARCHAR(16) DEFAULT '' COMMENT '名字', + `password` VARCHAR(128) DEFAULT '' COMMENT '密码', + `salt` VARCHAR(64) DEFAULT '' COMMENT 'md5密码盐', + `phone` VARCHAR(32) DEFAULT '' COMMENT '联系电话', + `tips` VARCHAR(255) COMMENT '备注', + `state` TINYINT(1) DEFAULT 1 COMMENT '状态 1:正常 2:禁用', + `created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='后台管理用户表'; + +-- 下面是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 (2,'aix','张三','123456','eee', '17859569358', '', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12'); + + +-- -------------------------------------以下biz业务库开始------------------------------------------- +CREATE DATABASE IF NOT EXISTS biz default charset utf8 COLLATE utf8_general_ci; +SET FOREIGN_KEY_CHECKS=0; +USE biz; + +-- 后台管理用户表 +DROP TABLE IF EXISTS `t_user`; +CREATE TABLE `t_user` ( + `id` INT(11) PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID', + `username` VARCHAR(32) NOT NULL COMMENT '账号', + `name` VARCHAR(16) DEFAULT '' COMMENT '名字', + `password` VARCHAR(128) DEFAULT '' COMMENT '密码', + `salt` VARCHAR(64) DEFAULT '' COMMENT 'md5密码盐', + `phone` VARCHAR(32) DEFAULT '' COMMENT '联系电话', + `tips` VARCHAR(255) COMMENT '备注', + `state` TINYINT(1) DEFAULT 1 COMMENT '状态 1:正常 2:禁用', + `created_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='后台管理用户表'; + + +-- 下面是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 (2,'aix1','张三','123456','eee', '17859569358', '', 1, '2017-12-12 09:46:12', '2017-12-12 09:46:12'); diff --git a/mybatis配置多数据源/springboot-multisource/src/test/java/com/woniu/pos/ApplicationTests.java b/mybatis配置多数据源/springboot-multisource/src/test/java/com/woniu/pos/ApplicationTests.java new file mode 100644 index 0000000..7931389 --- /dev/null +++ b/mybatis配置多数据源/springboot-multisource/src/test/java/com/woniu/pos/ApplicationTests.java @@ -0,0 +1,42 @@ +package com.woniu.pos; + +import com.woniu.pos.common.dao.entity.User; +import com.woniu.pos.service.UserService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.nullValue; + +/** + * 测试 + */ +@RunWith(SpringRunner.class) +@SpringBootTest +public class ApplicationTests { + private static final Logger log = LoggerFactory.getLogger(ApplicationTests.class); + + @Resource + private UserService userService; + + /** + * 测试增删改查 + */ + @Test + public void test() { + // 核心数据库中的用户id=1 + User user = userService.findById(1); + assertThat(user.getUsername(), is("admin")); + + // biz数据库中的用户id=1 + User user1 = userService.findById1(1); + assertThat(user1.getUsername(), is("admin1")); + } +} diff --git a/接口防抖防重复提交/woniu-springboot-interface-demo-master/.gitignore b/接口防抖防重复提交/woniu-springboot-interface-demo-master/.gitignore new file mode 100644 index 0000000..c0c2ba3 --- /dev/null +++ b/接口防抖防重复提交/woniu-springboot-interface-demo-master/.gitignore @@ -0,0 +1,23 @@ + +# Build and Release Folders +bin-debug/ +bin-release/ +[Oo]bj/ +[Bb]in/ + +# Other files and folders +.settings/ + +# Executables +*.swf +*.air +*.ipa +*.apk +*.iml + +/.idea/ +/target/ + +# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` +# should NOT be excluded as they contain compiler settings and other important +# information for Eclipse / Flash Builder.
数据库数据源配置
说明:这个类中包含了许多默认配置,若这些配置符合您的情况,您可以不用管,若不符合,建议不要修改本类,建议直接在"application.yml"中配置即可