2
0

feat: code gen

This commit is contained in:
caiyuchao
2024-12-19 17:47:13 +08:00
parent 2dcf1afe7f
commit cfbdb84261
2 changed files with 101 additions and 3 deletions

View File

@@ -18,11 +18,20 @@ import java.util.Collections;
*/
public class GenPlusUtils {
// 生成代码输出路径
public static final String OUTPUT_PATH = "D://gencode/test4";
// 模块名system/user
public static final String MODULE_NAME = "system";
// 数据库URL
public static final String URL = "jdbc:mysql://localhost:3306/wfc_system_db?useUnicode=true&useSSL=false&characterEncoding=utf8";
// 表名
public static final String TABLE_NAME = "sys_rate_limit";
public static void main(String[] args) {
FastAutoGenerator.create("jdbc:mysql://localhost:3306/wfc-user-db?useUnicode=true&useSSL=false&characterEncoding=utf8", "root", "123456")
FastAutoGenerator.create(URL, "root", "123456")
.globalConfig(builder -> {
builder.author("cyc") // 设置作者
builder.author("sys") // 设置作者
.enableSpringdoc()
.dateType(DateType.ONLY_DATE)
.outputDir("D://gencode"); // 指定输出目录
@@ -43,7 +52,7 @@ public class GenPlusUtils {
)
.packageConfig(builder ->
builder.parent("org.wfc") // 设置父包名
.moduleName("user") // 设置父包模块名
.moduleName(MODULE_NAME) // 设置父包模块名
.entity("domain")
.pathInfo(Collections.singletonMap(OutputFile.xml, "D://gencode")) // 设置mapperXml生成路径
)
@@ -63,6 +72,8 @@ public class GenPlusUtils {
.addTableFills(new Column("update_by", FieldFill.INSERT_UPDATE))
.controllerBuilder()
.enableRestStyle()
.template("/templates/controller.java.vm")
.enableFileOverride()
.serviceBuilder()
.enableFileOverride()
.mapperBuilder()