Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
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
liyang
sts网站
Commits
63992ac9
Commit
63992ac9
authored
Dec 29, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码生成数据库文本类型生成表单文本域
parent
01873447
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
GenConstants.java
...src/main/java/com/ruoyi/common/constant/GenConstants.java
+4
-2
GenUtils.java
...ator/src/main/java/com/ruoyi/generator/util/GenUtils.java
+4
-3
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
View file @
63992ac9
...
...
@@ -29,8 +29,10 @@ public class GenConstants
public
static
final
String
PARENT_MENU_NAME
=
"parentMenuName"
;
/** 数据库字符串类型 */
public
static
final
String
[]
COLUMNTYPE_STR
=
{
"char"
,
"varchar"
,
"nvarchar"
,
"varchar2"
,
"tinytext"
,
"text"
,
"mediumtext"
,
"longtext"
};
public
static
final
String
[]
COLUMNTYPE_STR
=
{
"char"
,
"varchar"
,
"nvarchar"
,
"varchar2"
};
/** 数据库文本类型 */
public
static
final
String
[]
COLUMNTYPE_TEXT
=
{
"tinytext"
,
"text"
,
"mediumtext"
,
"longtext"
};
/** 数据库时间类型 */
public
static
final
String
[]
COLUMNTYPE_TIME
=
{
"datetime"
,
"time"
,
"date"
,
"timestamp"
};
...
...
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
View file @
63992ac9
...
...
@@ -40,13 +40,14 @@ public class GenUtils
column
.
setCreateBy
(
table
.
getCreateBy
());
// 设置java字段名
column
.
setJavaField
(
StringUtils
.
toCamelCase
(
columnName
));
// 设置默认类型
column
.
setJavaType
(
GenConstants
.
TYPE_STRING
);
if
(
arraysContains
(
GenConstants
.
COLUMNTYPE_STR
,
dataType
))
if
(
arraysContains
(
GenConstants
.
COLUMNTYPE_STR
,
dataType
)
||
arraysContains
(
GenConstants
.
COLUMNTYPE_TEXT
,
dataType
)
)
{
column
.
setJavaType
(
GenConstants
.
TYPE_STRING
);
// 字符串长度超过500设置为文本域
Integer
columnLength
=
getColumnLength
(
column
.
getColumnType
());
String
htmlType
=
columnLength
>=
500
?
GenConstants
.
HTML_TEXTAREA
:
GenConstants
.
HTML_INPUT
;
String
htmlType
=
columnLength
>=
500
||
arraysContains
(
GenConstants
.
COLUMNTYPE_TEXT
,
dataType
)
?
GenConstants
.
HTML_TEXTAREA
:
GenConstants
.
HTML_INPUT
;
column
.
setHtmlType
(
htmlType
);
}
else
if
(
arraysContains
(
GenConstants
.
COLUMNTYPE_TIME
,
dataType
))
...
...
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