Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-generator
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-generator
提交
dc7ff27d
提交
dc7ff27d
编写于
12月 16, 2021
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
函数
上级
5a97114a
变更
4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
37 行增加
和
3 行删除
+37
-3
CodegenConfig.java
...-core/src/main/java/cn/ibizlab/codegen/CodegenConfig.java
+18
-1
DefaultGenerator.java
...re/src/main/java/cn/ibizlab/codegen/DefaultGenerator.java
+2
-1
StringAdvUtils.java
...rc/main/java/cn/ibizlab/codegen/utils/StringAdvUtils.java
+1
-1
{{entities}}.java
...java/{{packageName}}/{{modules}}/domain/{{entities}}.java
+16
-0
未找到文件。
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/CodegenConfig.java
浏览文件 @
dc7ff27d
...
@@ -20,6 +20,7 @@ package cn.ibizlab.codegen;
...
@@ -20,6 +20,7 @@ package cn.ibizlab.codegen;
import
cn.ibizlab.codegen.config.GlobalSettings
;
import
cn.ibizlab.codegen.config.GlobalSettings
;
import
cn.ibizlab.codegen.templating.TemplateDefinition
;
import
cn.ibizlab.codegen.templating.TemplateDefinition
;
import
cn.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
cn.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
cn.ibizlab.codegen.templating.mustache.*
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
cn.ibizlab.codegen.utils.StringAdvUtils
;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Cache
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
import
com.github.benmanes.caffeine.cache.Caffeine
;
...
@@ -40,7 +41,6 @@ import java.util.regex.Pattern;
...
@@ -40,7 +41,6 @@ import java.util.regex.Pattern;
@Getter
@Getter
@Setter
@Setter
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
CodegenConfig
{
public
class
CodegenConfig
{
...
@@ -108,6 +108,21 @@ public class CodegenConfig {
...
@@ -108,6 +108,21 @@ public class CodegenConfig {
return
templateDefinitions
;
return
templateDefinitions
;
}
}
public
CodegenConfig
addLambda
()
{
additionalProperties
.
put
(
"lowercase"
,
new
LowercaseLambda
().
generator
(
this
));
additionalProperties
.
put
(
"uppercase"
,
new
UppercaseLambda
());
additionalProperties
.
put
(
"snakecase"
,
new
SnakecaseLambda
());
additionalProperties
.
put
(
"titlecase"
,
new
TitlecaseLambda
());
additionalProperties
.
put
(
"camelcase"
,
new
CamelCaseLambda
(
true
).
generator
(
this
));
additionalProperties
.
put
(
"pascalcase"
,
new
CamelCaseLambda
(
false
).
generator
(
this
));
additionalProperties
.
put
(
"indented"
,
new
IndentedLambda
());
additionalProperties
.
put
(
"indented_8"
,
new
IndentedLambda
(
8
,
" "
));
additionalProperties
.
put
(
"indented_12"
,
new
IndentedLambda
(
12
,
" "
));
additionalProperties
.
put
(
"indented_16"
,
new
IndentedLambda
(
16
,
" "
));
return
this
;
}
private
void
scanTemplate
(
File
file
,
List
<
TemplateDefinition
>
templateDefinitions
)
private
void
scanTemplate
(
File
file
,
List
<
TemplateDefinition
>
templateDefinitions
)
{
{
if
(
file
.
isDirectory
())
if
(
file
.
isDirectory
())
...
@@ -121,6 +136,8 @@ public class CodegenConfig {
...
@@ -121,6 +136,8 @@ public class CodegenConfig {
}
}
}
}
@SuppressWarnings
(
"static-method"
)
@SuppressWarnings
(
"static-method"
)
public
String
sanitizeName
(
String
name
)
{
public
String
sanitizeName
(
String
name
)
{
return
sanitizeName
(
name
,
"\\W"
);
return
sanitizeName
(
name
,
"\\W"
);
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/DefaultGenerator.java
浏览文件 @
dc7ff27d
...
@@ -24,6 +24,7 @@ import cn.ibizlab.codegen.templating.*;
...
@@ -24,6 +24,7 @@ import cn.ibizlab.codegen.templating.*;
import
cn.ibizlab.codegen.templating.TemplatePathLocator
;
import
cn.ibizlab.codegen.templating.TemplatePathLocator
;
import
cn.ibizlab.codegen.templating.TemplateProcessor
;
import
cn.ibizlab.codegen.templating.TemplateProcessor
;
import
cn.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
cn.ibizlab.codegen.templating.TemplatingEngineAdapter
;
import
cn.ibizlab.codegen.templating.mustache.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.*
;
import
java.io.*
;
...
@@ -50,6 +51,7 @@ public class DefaultGenerator implements Generator {
...
@@ -50,6 +51,7 @@ public class DefaultGenerator implements Generator {
@Override
@Override
public
Generator
opts
(
CodegenConfig
opts
)
{
public
Generator
opts
(
CodegenConfig
opts
)
{
this
.
config
=
opts
;
this
.
config
=
opts
;
this
.
config
.
addLambda
();
modelStorage
=
ModelStorage
.
getInstance
().
config
(
config
);
modelStorage
=
ModelStorage
.
getInstance
().
config
(
config
);
...
@@ -70,7 +72,6 @@ public class DefaultGenerator implements Generator {
...
@@ -70,7 +72,6 @@ public class DefaultGenerator implements Generator {
this
.
ignoreProcessor
=
CodegenIgnoreProcessor
.
getInstance
(
ignoreFileLocation
,
this
.
config
.
getOutputDir
(),
this
.
config
.
getTemplateDir
());
this
.
ignoreProcessor
=
CodegenIgnoreProcessor
.
getInstance
(
ignoreFileLocation
,
this
.
config
.
getOutputDir
(),
this
.
config
.
getTemplateDir
());
return
this
;
return
this
;
}
}
...
...
modules/ibizlab-generator-core/src/main/java/cn/ibizlab/codegen/utils/StringAdvUtils.java
浏览文件 @
dc7ff27d
...
@@ -124,7 +124,7 @@ public class StringAdvUtils {
...
@@ -124,7 +124,7 @@ public class StringAdvUtils {
* @return camelized string
* @return camelized string
*/
*/
public
static
String
camelize
(
final
String
inputWord
,
boolean
lowercaseFirstLetter
)
{
public
static
String
camelize
(
final
String
inputWord
,
boolean
lowercaseFirstLetter
)
{
Pair
<
String
,
Boolean
>
key
=
new
ImmutablePair
<>(
inputWord
,
lowercaseFirstLetter
);
Pair
<
String
,
Boolean
>
key
=
new
ImmutablePair
<>(
underscore
(
inputWord
)
,
lowercaseFirstLetter
);
return
camelizedWordsCache
.
get
(
key
,
pair
->
{
return
camelizedWordsCache
.
get
(
key
,
pair
->
{
String
word
=
pair
.
getKey
();
String
word
=
pair
.
getKey
();
...
...
modules/ibizlab-generator-core/src/main/resources/templ/r7/{{projectName}}-core/src/main/java/{{packageName}}/{{modules}}/domain/{{entities}}.java
浏览文件 @
dc7ff27d
...
@@ -3,5 +3,21 @@ package {{packageName}}.{{module}}.domain;
...
@@ -3,5 +3,21 @@ package {{packageName}}.{{module}}.domain;
// {{entity.dataAccCtrlArch}}
// {{entity.dataAccCtrlArch}}
public
class
{{
entity
.
codeName
}}
public
class
{{
entity
.
codeName
}}
{
{
{{
#
pascalcase
}}{{
entity
.
codeName
}}{{/
pascalcase
}}
{{
#
camelcase
}}{{
entity
.
codeName
}}{{/
camelcase
}}
{{
#
snakecase
}}{{
entity
.
codeName
}}{{/
snakecase
}}
{{
#
snakecase
}}
SNAKECASE
{{/
snakecase
}}
{{
#
snakecase
}}
snakeCase
{{/
snakecase
}}
{{
#
snakecase
}}
snake_case
{{/
snakecase
}}
{{
#
camelcase
}}
camelCase
{{/
camelcase
}}
{{
#
camelcase
}}
Camel_case
{{/
camelcase
}}
{{
#
camelcase
}}
CAMELCase
{{/
camelcase
}}
{{
#
camelcase
}}
CAMELCASE
{{/
camelcase
}}
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录