feat: 提供一个代码自动生成的示例方法

提供一个代码自动生成的示例方法
This commit is contained in:
yangjiyu
2022-11-23 16:28:03 +08:00
parent 3d6e4abbaa
commit 4376af0601
@@ -0,0 +1,57 @@
package com.aos.starter.devtools;
import com.aos.element.basic.basic.util.StringPool;
import com.aos.element.common.constant.App;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Test;
/**
* <p>Company: 成都返空汇网络技术有限公司</p>
* <p>Description: </p>
*
* @author dong4j
* @version 1.0.0
* @email "mailto:dongshijie@fkhwl.com"
* @date 2019.12.26 21:45
* @since 1.0.0
*/
public class AutoCodeTest {
/**
* Simple auto generator code
*
* @since 1.0.0
*/
@Test
public void simpleAutoGeneratorCode() {
AutoGeneratorCodeBuilder.onAutoGeneratorCode()
// 设置存放自动生成的代码路径, 不填则默认当前项目下
.withModelPath("")
.withVersion("1.3.1")
// 设置谁作者名, 默认读取 user.name 变量
.withAuthor(App.FKH_NAME_SPACE)
// 设置包名 (前缀默认为 com.fkhwl, 因此最终的包名为: com.fkhwl.${packageName})
.withPackageName("com.fkhwl.center.payment.module.orders")
// 设置根据哪张表生成代码, 可写多张表
// 忽略前缀
.withPrefix(ArrayUtils.toArray(StringPool.EMPTY))
.withTables(new String[] {
"auth_library_personal",
"auth_library_bankcard",
"auth_library_enterprise"
})
// 设置需要生成的模板 不设置则全部生成
.withTemplate(TemplatesConfig.DAO,
TemplatesConfig.ENTITY,
TemplatesConfig.XML,
TemplatesConfig.DTO,
//TemplatesConfig.VO,
TemplatesConfig.CONVERTER,
TemplatesConfig.SERVICE,
TemplatesConfig.IMPL)
//TemplatesConfig.CONTROLLER)
// 设置需要生成的配置
.withComponets()
.build();
}
}