1. 项目背景
近几年来人口出生率、新生人口数量总体呈下滑态势,但由于人口基数较大,我国0-3岁婴幼儿群体数量依然处于较高水平。预计随着“三胎”政策的不断落实,婴幼儿群体数量将有所扩大。随着我国三胎政策的放开,中国小学生数量呈几何式增长。据不完全统计:中国拥有 3 亿适龄儿童,中等规模城市中3-6岁学前儿童有近3-5万人,7-12岁小学生约5-8万人,年人均业余教育支出约为3000元,其中90%以上家庭需要课外培训。
随着时代不断变化,现代的父母承受越来越多的经济压力,用于照料和教育孩子的时间明显不足;加上社会安全形势日趋复杂,因此催生了学校家庭之外的孩子的第三归宿——托管班。
据企查查数据显示,目前我国共有1.7万家少儿托管相关企业,2019年新注册企业3千余家,比十年前数据增长了25倍。截至9月底,今年托育相关企业注册量已达8849家,同比增长了330%。托管班已经是创业者竞相抢占的新蛋糕。
2. 建库建表
drop database if exists star_system;
create database star_system;
use star_system;
create table user_role
(
user_id int,
role_id int
);
create table role_menu
(
role_id int not null,
menu_id int not null
);
create table sys_menu
(
menu_id int not null auto_increment,
menu_name varchar(40),
parent_id int,
order_num int,
路由路径
component varchar(40),
组件存放路径
perms varchar(40),
icon varchar(40),
表示菜单 C表示组件 F表示按钮
primary key (menu_id)
);
create table sys_role
(
role_id int not null auto_increment,
role_name varchar(40),
home_path varchar(40),
primary key (role_id)
);
create table sys_user
(
user_id int not null auto_increment,
username varchar(40),
password varchar(40),
realname varchar(40),
photo varchar(200),
primary key (user_id)
);
drop database if exists star_child;
create database star_child;
use star_child;
create table care_bed
(
bed_id int not null,
bed_layer_count int not null,
bed_layer_max_count int,
use_child_own_bedding int,
bed_photo int,
child_id int,
room_id int,
primary key (bed_layer_count, bed_id)
);
create table care_child
(
child_id int not null auto_increment,
child_name varchar(40),
child_gender varchar(40),
child_birthday date,
child_photo varchar(40),
child_school varchar(40),
child_grade varchar(40),
child_class varchar(40),
child_mark varchar(200),
child_fathar_name varchar(40),
child_mother_name varchar(40),
child_father_cellphone varchar(40),
child_mother_cellphone varchar(40),
child_address varchar(200),
user_id int,
type_id int,
room_id int,
teacher_id int,
primary key (child_id)
);
create table child_attendance
(
attendance_id int not null auto_increment,
attendance_date time,
attendance_photo varchar(200),
attendance_video varchar(200),
child_id int,
primary key (attendance_id)
);
create table care_type
(
type_id int not null auto_increment,
type_name varchar(40),
type_desc varchar(200),
primary key (type_id)
);
create table care_room
(
room_id int not null auto_increment,
room_name varchar(40),
room_gender varchar(40),
room_max_count int,
room_current_count int,
room_grade varchar(40),
primary key (room_id)
);
create table care_order
(
order_id int not null auto_increment,
oder_date date,
order_duration_in_month int,
order_duration_in_day int,
has_noon int,
has_afternoon int,
has_homework int,
total decimal(6,2),
child_id int,
primary key (order_id)
);
drop database if exists star_meal;
create database star_meal;
use star_meal;
create table care_meal_plan
(
meal_plan_id int not null auto_increment,
meal_plan_name varchar(40),
meal_plan_date date,
primary key (meal_plan_id)
);
create table care_meal
(
meal_id int not null auto_increment,
meal_name varchar(40),
meal_photo varchar(200),
meal_vedio varchar(200),
meal_date date,
primary key (meal_id)
);
create table care_job
(
job_id int not null auto_increment,
job_name varchar(40),
job_min_sal int,
job_max_sal int,
primary key (job_id)
);
create table care_emp
(
emp_id int not null auto_increment,
emp_name varchar(40),
emp_gender varchar(40),
emp_birthday date,
emp_sal int,
job_id int,
primary key (emp_id)
);
drop database if exists star_naire;
create database star_naire;
use star_naire;
create table naire_question_type
(
question_type_id int not null auto_increment,
question_type_name varchar(40),
primary key (question_type_id)
);
create table naire_question
(
question_id int not null auto_increment,
question_content varchar(40),
has_option int,
question_type_id int,
primary key (question_id)
);
create table naire_question_option
(
question_option_id int not null auto_increment,
question_option_index int,
question_option_content varchar(100),
question_id int,
primary key (question_option_id)
);
create table naire_paper
(
paper_id int not null auto_increment,
paper_title varchar(40),
paper_status int,
paper_date date,
被调查老师的id
被调查老师的姓名
primary key (paper_id)
);
create table naire_answer
(
answer_id int not null auto_increment,
answer_question_option_id varchar(40),
answer_text varchar(200),
user_id int,
question_id int,
paper_id int,
primary key (answer_id)
);
create table paper_question
(
paper_id int not null,
question_id int not null,
primary key (question_id, paper_id)
);
drop database if exists star_teacher;
create database star_teacher;
use star_teacher;
create table care_homework_guidance_type
(
homework_guidance_type_id int not null auto_increment,
homework_guidance_type_max_count int,
老师提成
学生缴费
primary key (homework_guidance_type_id)
);
create table care_teacher
(
teacher_id int not null auto_increment,
teacher_name varchar(40),
teacher_gender varchar(40),
老师对应的问卷总数
老师所带学生数量
teacher_sal int,
homework_guidance_type_id int,
teacher_level_id int,
primary key (teacher_id)
);
create table care_teacher_level
(
teacher_level_id int primary key auto_increment,
teacher_level_name varchar(40),
teacher_level_comm int
);
本次贯穿项目,重点完成2个模块:教师模块和问卷调查模块
3. 搭建环境
父项目是不需要编码的,删除掉父项目的src目录。
pom.xml
<?xml versinotallow="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:schemaLocatinotallow="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gao</groupId>
<artifactId>star</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.7.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
3.1 创建star-common
pom.xml
<?xml versinotallow="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:schemaLocatinotallow="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>star</artifactId>
<groupId>com.gao</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>star-common</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.6</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.79</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/test/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>
在star-comon的src/test/resources/mybatis下添加逆向工程配置类:star_teacher_generator.xml
<?xml versinotallow="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="ctx1">
配置pojo的序列化 -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
<commentGenerator>
是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
数据库连接的信息:驱动类、连接地址、用户名、密码,这里配置的是mysql的,当然也可以配置oracle等数据库 -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
cnotallow="jdbc:mysql://localhost:3306/star_teacher?characterEncoding=utf8&serverTimeznotallow=Asia/Shanghai" userId="root"
password="123">
<!--
在MySQL 8.0 以上的版本中,在生成 User 表的实体类时,Mybatis Generator 会找到多张 User表,
包括 MySQL information schemas 中的多张 User 表,生成了多个 User 相关的实体类。
添加以下配置,保证只生成自己需要的 User类
-->
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
生成PO类的位置 -->
<javaModelGenerator targetPackage="com.gao.entity"
targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
映射文件生成的位置 -->
<sqlMapGenerator targetPackage="com.gao.mapper"
targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
:mapper接口生成的位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.gao.mapper" targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
指定数据库表 -->
<table tableName="care_teacher" domainObjectName="Teacher"></table>
<table tableName="care_homework_guidance_type" domainObjectName="HomeworkGuidanceType"></table>
<table tableName="care_teacher_level" domainObjectName="TeacherLevel"></table>
</context>
</generatorConfiguration>
在star-comon的src/test/resources/mybatis下添加逆向工程配置类:star_naire_generator.xml
<?xml versinotallow="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="ctx1">
配置pojo的序列化 -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
<commentGenerator>
是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
数据库连接的信息:驱动类、连接地址、用户名、密码,这里配置的是mysql的,当然也可以配置oracle等数据库 -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
cnotallow="jdbc:mysql://localhost:3306/star_naire?characterEncoding=utf8&serverTimeznotallow=Asia/Shanghai"
userId="root"
password="123">
<!--
在MySQL 8.0 以上的版本中,在生成 User 表的实体类时,Mybatis Generator 会找到多张 User表,
包括 MySQL information schemas 中的多张 User 表,生成了多个 User 相关的实体类。
添加以下配置,保证只生成自己需要的 User类
-->
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
生成PO类的位置 -->
<javaModelGenerator targetPackage="com.gao.entity"
targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
映射文件生成的位置 -->
<sqlMapGenerator targetPackage="com.gao.mapper"
targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
:mapper接口生成的位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.gao.mapper" targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
指定数据库表 -->
<table tableName="naire_answer" domainObjectName="Answer"></table>
<table tableName="naire_paper" domainObjectName="Paper"></table>
<table tableName="naire_question" domainObjectName="Question"></table>
<table tableName="naire_question_option" domainObjectName="QuestionOption"></table>
<table tableName="naire_question_type" domainObjectName="QuestionType"></table>
</context>
</generatorConfiguration>
在star-comon的src/test/resources/mybatis下添加逆向工程配置类:star_auth_generator.xml
<?xml versinotallow="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="ctx1">
配置pojo的序列化 -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
<commentGenerator>
是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
数据库连接的信息:驱动类、连接地址、用户名、密码,这里配置的是mysql的,当然也可以配置oracle等数据库 -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
cnotallow="jdbc:mysql://localhost:3306/star_system?characterEncoding=utf8&serverTimeznotallow=Asia/Shanghai" userId="root"
password="123">
<!--
在MySQL 8.0 以上的版本中,在生成 User 表的实体类时,Mybatis Generator 会找到多张 User表,
包括 MySQL information schemas 中的多张 User 表,生成了多个 User 相关的实体类。
添加以下配置,保证只生成自己需要的 User类
-->
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
生成PO类的位置 -->
<javaModelGenerator targetPackage="com.gao.entity"
targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
映射文件生成的位置 -->
<sqlMapGenerator targetPackage="com.gao.mapper"
targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
:mapper接口生成的位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.gao.mapper" targetProject=".\star-common\src\main\java">
是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
指定数据库表 -->
<table tableName="sys_user" domainObjectName="User"></table>
<table tableName="sys_role" domainObjectName="Role"></table>
<table tableName="sys_menu" domainObjectName="Menu"></table>
</context>
</generatorConfiguration>
在star-comon的src/test/java/下,添加逆向工程执行类:
package com.gao.test;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author gao
* @date 2023/03/28 11:12:44
*/
public class GeneratorSqlmap {
private String[] configFiles = new String[]{
"star-common/src/test/resources/mybatis/star_teacher_generator.xml",
"star-common/src/test/resources/mybatis/star_naire_generator.xml",
"star-common/src/test/resources/mybatis/star_auth_generator.xml",
};
public void generator() throws Exception {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
for (String cf : configFiles) {
指定Mybatis逆向工程配置文件的位置
File configFile = new File(cf);
System.out.println(configFile.getAbsolutePath());
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
}
System.out.println("over");
}
public static void main(String[] args) throws Exception {
try {
GeneratorSqlmap t = new GeneratorSqlmap();
t.generator();
} catch (Exception e) {
e.printStackTrace();
}
}
}
逆向工程执行后,star-common中就会生成entity和mapper:
通用返回实体ResultVo (com.gao.util)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo {
private Integer code;
private String msg;
private Object data;
public static ResultVo success() {
操作成功");
}
public static ResultVo success(String msg) {
return success(msg, null);
}
public static ResultVo success(Object data) {
操作成功", data);
}
public static ResultVo success(String msg, Object data) {
return new ResultVo(200, msg, data);
}
public static ResultVo failure() {
操作失败");
}
public static ResultVO failure(String msg) {
return failure(msg, null);
}
public static ResultVo failure(Object data) {
操作失败", data);
}
public static ResultVo failure(String msg, Object data) {
return new ResultVo(500, msg, data);
}
}
star-common,全局异常处理类:
package com.gao.config;
import com.gao.util.ResultVO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
@ResponseBody
public ResultVO handleException(Exception e) {
// for debug
e.printStackTrace();
return ResultVO.failure(e.toString());
}
}
3.2 star-teacher
pom.xml
<?xml versinotallow="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:schemaLocatinotallow="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>star</artifactId>
<groupId>com.gao</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>star-teacher</artifactId>
<dependencies>
<dependency>
<groupId>com.gao</groupId>
<artifactId>star-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
star-teacher的application.yml
server:
port: 8081
spring:
application:
name: star-teacher
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql:///star_teacher?serverTimeznotallow=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: 123
启动类:
@SpringBootApplication
@MapperScan("com.gao.mapper")
public class TeacherApp {
public static void main(String[] args) {
SpringApplication.run(TeacherApp.class, args);
}
}
3.3 star-naire
star-naire的pom.xml
<?xml versinotallow="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:schemaLocatinotallow="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>star</artifactId>
<groupId>com.gao</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>star-naire</artifactId>
<dependencies>
<dependency>
<groupId>com.gao</groupId>
<artifactId>star-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
star-naire的application.yml
server:
port: 8091
spring:
application:
name: star-naire
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql:///star_naire?serverTimeznotallow=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: 123
启动类:
@SpringBootApplication
@MapperScan("com.gao.mapper")
public class NaireApp {
public static void main(String[] args) {
SpringApplication.run(NaireApp.class, args);
}
}
3.4 star-auth
star-auth的pom.xml
<?xml versinotallow="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:schemaLocatinotallow="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>star</artifactId>
<groupId>com.gao</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>star-auth</artifactId>
<dependencies>
<dependency>
<groupId>com.gao</groupId>
<artifactId>star-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
star-auth的application.yml
server:
port: 8071
spring:
application:
name: star-auth
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql:///star_system?serverTimeznotallow=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false
username: root
password: 123
启动类:
@SpringBootApplication
@MapperScan("com.gao.mapper")
public class AuthApp {
public static void main(String[] args) {
SpringApplication.run(AuthApp.class, args);
}
}