-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(codegen): support feature and test and table generation based on…
… template or generator - add param parse (#866) * feat(codegen): support feature and test and table generation based on template or generator * feat(codegen): support feature and test and table generation based on template or generator - add param parse * feat(codegen): support feature and test and table generation based on template or generator - add param parse - 1 * feat(codegen): support feature and test and table generation based on template or generator - add param parse - 2 * feat(codegen): support feature and test and table generation based on template or generator - add param parse - 3] --------- Co-authored-by: wangyingjie3 <[email protected]> Co-authored-by: wodiwudi <[email protected]>
- Loading branch information
1 parent
2bbdd85
commit 0527f0a
Showing
3 changed files
with
165 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,10 @@ | |
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import lombok.ToString; | ||
|
||
|
||
/** | ||
* @author [email protected], [email protected] | ||
* @date 7/12/24 14:10 | ||
|
@@ -14,11 +16,10 @@ | |
@AllArgsConstructor | ||
@Data | ||
@Builder | ||
@ToString | ||
public class FeatureGenerateBo { | ||
|
||
@Builder.Default | ||
private FeatureGeneratType type = FeatureGeneratType.CODE_WITH_GENERATOR; | ||
private FeatureGenerateType type = FeatureGenerateType.CODE_WITH_GENERATOR; | ||
|
||
@Builder.Default | ||
private String tableName = ""; | ||
|
@@ -42,6 +43,8 @@ public class FeatureGenerateBo { | |
@Builder.Default | ||
private String className = "Dummy"; | ||
|
||
private String testName = "T"; | ||
|
||
@Builder.Default | ||
private String auth = ""; | ||
|
||
|
@@ -75,6 +78,7 @@ public class FeatureGenerateBo { | |
@Builder.Default | ||
private boolean createController = false; | ||
|
||
|
||
/** | ||
* 目前使用module所在的绝对路径 | ||
*/ | ||
|
42 changes: 42 additions & 0 deletions
42
jcommon/codegen/src/main/java/run/mone/ai/codegen/bo/FeatureGenerateType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package run.mone.ai.codegen.bo; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.function.Function; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author [email protected], [email protected] | ||
* @date 7/12/24 14:15 | ||
*/ | ||
public enum FeatureGenerateType { | ||
|
||
CODE_WITH_GENERATOR(1, "使用mybatis-flex-generator生成"), | ||
|
||
CODE_WITH_TEMPLATE(2, "使用预制模板生成"), | ||
|
||
TABLE(3, "创建表"); | ||
|
||
private final int code; | ||
|
||
private final String desc; | ||
|
||
private static final Map<Integer, FeatureGenerateType> valMap = Arrays.stream(values()).collect(Collectors.toMap(FeatureGenerateType::getCode, Function.identity())); | ||
|
||
FeatureGenerateType(int code, String desc) { | ||
this.code = code; | ||
this.desc = desc; | ||
} | ||
|
||
public int getCode() { | ||
return code; | ||
} | ||
|
||
public String getDesc() { | ||
return desc; | ||
} | ||
|
||
public static FeatureGenerateType getGenerateTypeByCode(int code) { | ||
return valMap.getOrDefault(code, CODE_WITH_TEMPLATE); | ||
} | ||
} |