1.新建模块
1.新增新的模块:在项目顶级目录上右击新增模块,选择普通的java maven项目即可,如图。然后删除多余文件
2.添加对应模块的依赖
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.dota.boot</groupId>
<artifactId>yudao</artifactId>
<version>${revision}</version> <!-- 1. 修改 version 为 ${revision} -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-demo</artifactId>
<packaging>jar</packaging> <!-- 2. 新增 packaging 为 jar -->
<name>${project.artifactId}</name> <!-- 3. 新增 name 为 ${project.artifactId} -->
<description> <!-- 4. 新增 description 为该模块的描述 -->
demo 模块,主要实现 XXX、YYY、ZZZ 等功能。
</description>
<dependencies> <!-- 5. 新增依赖,这里引入的都是比较常用的业务组件、技术组件 -->
<!-- Web 相关 -->
<dependency>
<groupId>com.dota.boot</groupId>
<artifactId>dota-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.dota.boot</groupId>
<artifactId>dota-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>com.dota.boot</groupId>
<artifactId>dota-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>com.dota.boot</groupId>
<artifactId>dota-spring-boot-starter-test</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>com.dota.boot</groupId>
<artifactId>dota-spring-boot-starter-excel</artifactId>
</dependency>
</dependencies>
</project>
- 引入 demo 模块 在server模块下引入
- 根目录的pom里面加入这一段
<module>xxx-module-模块名</module>
6. 在如图的位置加上新模块的错误码区间
7.刷新maven重启项目
2.代码生成
- 新增了字典类型要在前端的/src/utils/dict.ts 文件中的 enum DICT_TYPE 字段加上对应的类型如图
- 代码生成之后如果是新模块,要手动创建ErrorCodeConstants的接口文件,表示是对应模块业务错误码的枚举接口。生成之后的手动操作的代码就复制在这个接口里面。具体的错误码区间参考上面新建模块的第6步即可。
- 代码生成的作者读取的是当前登录用户的昵称。