一.项目结构图
注:其他模块中的resources文件夹已删除
二.除了common和jfzt-system模块的pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
jfzt-system模块里的pom.xml
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>dashboard-jfzt</artifactId>
<groupId>com.jfzt.dashboard</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>jfzt-system</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>jfzt-system</name>
<description>Demo project for Spring Boot</description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.jfzt.dashboard</groupId>
<artifactId>common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.jfzt.dashboard</groupId>
<artifactId>jfzt-electricity</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.jfzt.dashboard</groupId>
<artifactId>jfzt-entrance</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.jfzt.dashboard</groupId>
<artifactId>jfzt-building-manager</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.jfzt.dashboard</groupId>
<artifactId>jfzt-air-conditioning</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.jfzt.dashboard</groupId>
<artifactId>jfzt-video-surveillance</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.jfzt.dashboard.jfztintegratedsecurity</groupId>
<artifactId>jfzt-integrated-security</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<!--Druid连接池-->
<!-- <dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.3</version>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- JWT -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.7.12</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>2.3.2</version>
</dependency>
<!--核心包-->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.2</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!--工具-->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.3.2</version>
</dependency>
<!--添加Scheduled坐标-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!--Spring tx 坐标-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<!--MD5加密 对铭文信息进行加密操作-->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.25</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.jfzt.dashboard.jfztsystem.JfztSystemApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
父模块中
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.jfzt.dashboard</groupId> <artifactId>dashboard-jfzt</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.6.2</version> <relativePath/> <!-- lookup parent from repository --> </parent> <modules> <module>jfzt-electricity</module> <module>jfzt-entrance</module> <module>jfzt-system</module> <module>jfzt-air-conditioning</module> <module>jfzt-building-manager</module> <module>jfzt-video-surveillance</module> <module>common</module> <module>jfzt-integrated-security</module> </modules> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <log4j2.version>2.17.2</log4j2.version> </properties> <name>dashboard-jfzt</name> <description>Demo project for Spring Boot</description> <dependencies> <!-- SpringBoot-starter-web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.6.2</version> </dependency> <!-- lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.20</version> </dependency> <!-- SpringBoot-Validation --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> <version>2.7.8</version> </dependency> <!--添加redis功能--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.5.14</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> </project>
三.yml配置
spring:
main:
allow-circular-references: true
profiles:
active: dev
datasource:
dynamic:
primary: slave
strict: false
datasource:
master_jieLink:
url: jdbc:mysql://XXX:3306/XXX?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&useSSL=false
username: XXX
password: XXX
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
driver-class-name: com.mysql.cj.jdbc.Driver
master_ba:
url: jdbc:mysql://XXX:3306/XXX?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&useSSL=false
username: XXX
password: XXX
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
driver-class-name: com.mysql.cj.jdbc.Driver
slave_1:
url: jdbc:mysql://XXX:3306/XXX?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&useSSL=false&allowMultiQueries=true
username: XXX
password: XXX
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
driver-class-name: com.mysql.cj.jdbc.Driver
redis:
# 先暂时使用jedis不考虑高并发
# lettuce:
jedis:
pool:
# 最大连接数(使用负值表示没有限制) 默认为 8
max-active: 10
# 最大阻塞等待时间(使用负值表示没有限制) 默认为 -1 ms
max-wait: -1
# 最大空闲连接 默认为 8
max-idle: 5
# 最小空闲连接 默认为 0
min-idle: 0
password: XXX
sentinel:
nodes: XXX:26379,XXX:26380,XXX:26381
master: mymaster
database: 14
mybatis-plus:
global-config:
banner: false
#configuration:
#map-underscore-to-camel-case: false
logging:
level:
#防止刷新打印log,从而加大耗时操作
com.jfzt.dashboard.jfztsystem.mapper: info
com.jfzt.dashboard.jfztentrance.mapper: DEBUG
com.jfzt.dashboard.jfztairconditioning.mapper: DEBUG
com.jfzt.dashboard.jfztbuildingmanager.mapper: DEBUG