Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
1b302b9b
Commit
1b302b9b
authored
Aug 28, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复自动去除表前缀配置无效问题
parent
5c7f6b7c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
+3
-3
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
+18
-1
ruoyi-generator/src/main/resources/generator.yml
+3
-2
No files found.
ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java
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
;
}
...
...
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
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
()));
...
...
@@ -153,6 +153,23 @@ public class GenUtils
}
/**
* 表名转换成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
);
}
/**
* 关键字替换
*
* @param name 需要被替换的名字
...
...
ruoyi-generator/src/main/resources/generator.yml
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
Write
Preview
Markdown
is supported
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