mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
feat: 生成 Java、Kotlin 两种代码。
This commit is contained in:
parent
b5a1ee6521
commit
9bde89f428
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* Copyright (c) 2022-2024, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ public class ControllerGenerator implements IGenerator {
|
||||
|
||||
String controllerPackagePath = packageConfig.getControllerPackage().replace(".", "/");
|
||||
File controllerJavaFile = new File(sourceDir, controllerPackagePath + "/" +
|
||||
table.buildControllerClassName() + ".java");
|
||||
table.buildControllerClassName() + globalConfig.getFileType());
|
||||
|
||||
|
||||
if (controllerJavaFile.exists() && !controllerConfig.isOverwriteEnable()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* Copyright (c) 2022-2024, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -72,7 +72,7 @@ public class EntityGenerator implements IGenerator {
|
||||
String entityPackagePath = packageConfig.getEntityPackage().replace(".", "/");
|
||||
String entityClassName = table.buildEntityClassName();
|
||||
|
||||
File entityJavaFile = new File(sourceDir, entityPackagePath + "/" + entityClassName + ".java");
|
||||
File entityJavaFile = new File(sourceDir, entityPackagePath + "/" + entityClassName + globalConfig.getFileType());
|
||||
|
||||
if (entityJavaFile.exists() && !entityConfig.isOverwriteEnable()) {
|
||||
return;
|
||||
@ -97,6 +97,10 @@ public class EntityGenerator implements IGenerator {
|
||||
|
||||
// 开启生成 baseClass
|
||||
if (entityConfig.isWithBaseClassEnable()) {
|
||||
if (globalConfig.getFileType() == GlobalConfig.FileType.KOTLIN) {
|
||||
throw new UnsupportedOperationException("暂不支持 Kotlin 生成 WithBaseClass 模式。");
|
||||
}
|
||||
|
||||
templatePath = this.entityWithBaseTemplatePath;
|
||||
|
||||
String baseClassName = table.buildEntityClassName() + entityConfig.getWithBaseClassSuffix();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* Copyright (c) 2022-2024, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ public class MapperGenerator implements IGenerator {
|
||||
|
||||
String mapperPackagePath = packageConfig.getMapperPackage().replace(".", "/");
|
||||
File mapperJavaFile = new File(sourceDir, mapperPackagePath + "/" +
|
||||
table.buildMapperClassName() + ".java");
|
||||
table.buildMapperClassName() + globalConfig.getFileType());
|
||||
|
||||
|
||||
if (mapperJavaFile.exists() && !mapperConfig.isOverwriteEnable()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* Copyright (c) 2022-2024, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ public class ServiceGenerator implements IGenerator {
|
||||
|
||||
String servicePackagePath = packageConfig.getServicePackage().replace(".", "/");
|
||||
File serviceJavaFile = new File(sourceDir, servicePackagePath + "/" +
|
||||
table.buildServiceClassName() + ".java");
|
||||
table.buildServiceClassName() + globalConfig.getFileType());
|
||||
|
||||
|
||||
if (serviceJavaFile.exists() && !serviceConfig.isOverwriteEnable()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* Copyright (c) 2022-2024, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ public class ServiceImplGenerator implements IGenerator {
|
||||
|
||||
String serviceImplPackagePath = packageConfig.getServiceImplPackage().replace(".", "/");
|
||||
File serviceImplJavaFile = new File(sourceDir, serviceImplPackagePath + "/" +
|
||||
table.buildServiceImplClassName() + ".java");
|
||||
table.buildServiceImplClassName() + globalConfig.getFileType());
|
||||
|
||||
|
||||
if (serviceImplJavaFile.exists() && !serviceImplConfig.isOverwriteEnable()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* Copyright (c) 2022-2024, Mybatis-Flex (fuhai999@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -59,7 +59,7 @@ public class TableDefGenerator implements IGenerator {
|
||||
|
||||
String tableDefPackagePath = packageConfig.getTableDefPackage().replace(".", "/");
|
||||
File tableDefJavaFile = new File(sourceDir, tableDefPackagePath + "/" +
|
||||
table.buildTableDefClassName() + ".java");
|
||||
table.buildTableDefClassName() + globalConfig.getFileType());
|
||||
|
||||
|
||||
if (tableDefJavaFile.exists() && !tableDefConfig.isOverwriteEnable()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user