Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
git test
RuoYi
Commits
1b302b9b
Commit
1b302b9b
authored
5 years ago
by
RuoYi
Browse files
Options
Download
Email Patches
Plain Diff
修复自动去除表前缀配置无效问题
parent
5c7f6b7c
master
v4.7.5
v4.7.4
v4.7.3
v4.7.2
v4.7.1
v4.7.0
v4.6.2
v4.6.1
v4.6.0
v4.5.1
v4.5.0
v4.4
v4.3.1
v4.3
v4.2
v4.1
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
+3
-3
...r/src/main/java/com/ruoyi/generator/config/GenConfig.java
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
+18
-1
...ator/src/main/java/com/ruoyi/generator/util/GenUtils.java
ruoyi-generator/src/main/resources/generator.yml
+2
-2
ruoyi-generator/src/main/resources/generator.yml
with
23 additions
and
6 deletions
+23
-6
ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
+
3
-
3
View file @
1b302b9b
...
...
@@ -22,7 +22,7 @@ public class GenConfig
public
static
String
packageName
;
/** 自动去除表前缀,默认是true */
public
static
String
autoRemovePre
;
public
static
boolean
autoRemovePre
;
/** 表前缀(类名不会包含表前缀) */
public
static
String
tablePrefix
;
...
...
@@ -49,13 +49,13 @@ public class GenConfig
GenConfig
.
packageName
=
packageName
;
}
public
static
String
getAutoRemovePre
()
public
static
boolean
getAutoRemovePre
()
{
return
autoRemovePre
;
}
@Value
(
"${autoRemovePre}"
)
public
void
setAutoRemovePre
(
String
autoRemovePre
)
public
void
setAutoRemovePre
(
boolean
autoRemovePre
)
{
GenConfig
.
autoRemovePre
=
autoRemovePre
;
}
...
...
This diff is collapsed.
Click to expand it.
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
+
18
-
1
View file @
1b302b9b
...
...
@@ -19,7 +19,7 @@ public class GenUtils
*/
public
static
void
initTable
(
GenTable
genTable
,
String
operName
)
{
genTable
.
setClassName
(
StringUtils
.
convertToCamelCas
e
(
genTable
.
getTableName
()));
genTable
.
setClassName
(
convertClassNam
e
(
genTable
.
getTableName
()));
genTable
.
setPackageName
(
GenConfig
.
getPackageName
());
genTable
.
setModuleName
(
getModuleName
(
GenConfig
.
getPackageName
()));
genTable
.
setBusinessName
(
getBusinessName
(
genTable
.
getTableName
()));
...
...
@@ -152,6 +152,23 @@ public class GenUtils
return
businessName
;
}
/**
* 表名转换成Java类名
*
* @param tableName 表名称
* @return 类名
*/
public
static
String
convertClassName
(
String
tableName
)
{
boolean
autoRemovePre
=
GenConfig
.
getAutoRemovePre
();
String
tablePrefix
=
GenConfig
.
getTablePrefix
();
if
(
autoRemovePre
&&
StringUtils
.
isNotEmpty
(
tablePrefix
))
{
tableName
=
tableName
.
replaceFirst
(
tablePrefix
,
""
);
}
return
StringUtils
.
convertToCamelCase
(
tableName
);
}
/**
* 关键字替换
*
...
...
This diff is collapsed.
Click to expand it.
ruoyi-generator/src/main/resources/generator.yml
+
2
-
2
View file @
1b302b9b
...
...
@@ -5,7 +5,7 @@ gen:
author
:
ruoyi
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName
:
com.ruoyi.system
# 自动去除表前缀,默认是
tru
e
autoRemovePre
:
tru
e
# 自动去除表前缀,默认是
fals
e
autoRemovePre
:
fals
e
# 表前缀(类名不会包含表前缀)
tablePrefix
:
sys_
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help