From 9018f5e2ba1db31d0a076c5d1dfa6b9cddee3185 Mon Sep 17 00:00:00 2001 From: Lemon <1161030327@qq.com> Date: Sat, 12 Aug 2023 10:22:47 +0800 Subject: [PATCH] common-datasource --- .gitignore | 46 +++++++++++++++++++ pom.xml | 43 +++++++++++++++++ .../common/datasource/annotation/Master.java | 19 ++++++++ .../common/datasource/annotation/Slave.java | 22 +++++++++ 4 files changed, 130 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/com/luck/common/datasource/annotation/Master.java create mode 100644 src/main/java/com/luck/common/datasource/annotation/Slave.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09bdfea --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +###################################################################### +# Build Tools + +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +target/ +!.mvn/wrapper/maven-wrapper.jar + +###################################################################### +# IDE + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### JRebel ### +rebel.xml +### NetBeans ### +nbproject/private/ +build/* +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +###################################################################### +# Others +*.log +*.xml.versionsBackup +*.swp + +!*/build/*.java +!*/build/*.html +!*/build/*.xml \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..2e46311 --- /dev/null +++ b/pom.xml @@ -0,0 +1,43 @@ + + + + com.luck + luck-common + 3.6.3 + + 4.0.0 + + 3.6.3 + luck-common-datasource + + + luck-common-datasource多数据源 + + + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic-ds.version} + + + + + + yun-releases + yun-releases + http://192.10.29.103/repository/maven-releases/ + + + \ No newline at end of file diff --git a/src/main/java/com/luck/common/datasource/annotation/Master.java b/src/main/java/com/luck/common/datasource/annotation/Master.java new file mode 100644 index 0000000..5882b9f --- /dev/null +++ b/src/main/java/com/luck/common/datasource/annotation/Master.java @@ -0,0 +1,19 @@ +package com.luck.common.datasource.annotation; + +import com.baomidou.dynamic.datasource.annotation.DS; + +import java.lang.annotation.*; + +/** + * 主库数据源 + * + * @author ruoyi + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@DS("master") +public @interface Master +{ + +} \ No newline at end of file diff --git a/src/main/java/com/luck/common/datasource/annotation/Slave.java b/src/main/java/com/luck/common/datasource/annotation/Slave.java new file mode 100644 index 0000000..530a6a8 --- /dev/null +++ b/src/main/java/com/luck/common/datasource/annotation/Slave.java @@ -0,0 +1,22 @@ +package com.luck.common.datasource.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.baomidou.dynamic.datasource.annotation.DS; + +/** + * 从库数据源 + * + * @author ruoyi + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@DS("slave") +public @interface Slave +{ + +} \ No newline at end of file