Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
appbuild
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
appbuild
Commits
963ff10a
Commit
963ff10a
authored
Aug 03, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加blob,clob数据库映射
parent
b6c04ef0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
8 deletions
+21
-8
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/service/impl/GentableServiceImpl.java
...ase/system/gentable/service/impl/GentableServiceImpl.java
+1
-2
appbuild-manager/src/main/java/com/mortals/xhx/common/key/GenConstants.java
...rc/main/java/com/mortals/xhx/common/key/GenConstants.java
+12
-0
appbuild-manager/src/main/java/com/mortals/xhx/common/utils/GenUtils.java
.../src/main/java/com/mortals/xhx/common/utils/GenUtils.java
+6
-4
appbuild-manager/src/main/resources/template/java/serviceImpl.java.ftl
...ger/src/main/resources/template/java/serviceImpl.java.ftl
+2
-2
No files found.
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/service/impl/GentableServiceImpl.java
View file @
963ff10a
...
...
@@ -401,7 +401,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
this
.
save
(
table
);
//保存列
List
<
GentableColumnEntity
>
genTableColumns
=
table
.
getColumns
();
//校验是否有主键列,如果没有,默认第一列为主键
GentableColumnEntity
columnEntity
=
genTableColumns
.
stream
().
filter
(
f
->
f
.
getIsPrimaryKey
()
!=
null
).
filter
(
f
->
f
.
getIsPrimaryKey
()
==
1
).
findFirst
().
orElseGet
(()
->
null
);
if
(
ObjectUtils
.
isEmpty
(
columnEntity
))
{
...
...
@@ -411,10 +410,10 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
for
(
GentableColumnEntity
column
:
genTableColumns
)
{
//初始化列数据
GenUtils
.
initColumnField
(
column
,
table
);
gentableColumnService
.
save
(
column
);
}
}
}
}
catch
(
Exception
e
)
{
...
...
appbuild-manager/src/main/java/com/mortals/xhx/common/key/GenConstants.java
View file @
963ff10a
...
...
@@ -57,6 +57,13 @@ public class GenConstants {
*/
public
static
final
String
[]
COLUMNTYPE_TIME
=
{
"datetime"
,
"time"
,
"date"
,
"timestamp"
};
/**
* 数据库blob类型
*/
public
static
final
String
[]
COLUMNTYPE_BLOB
=
{
"blob"
,
"clob"
};
/**
* 数据库数字类型
*/
...
...
@@ -166,6 +173,11 @@ public class GenConstants {
*/
public
static
final
String
TYPE_DATE
=
"Date"
;
/**
* byte[]类型
*/
public
static
final
String
TYPE_BYTEARRAY
=
"byte[]"
;
/**
* 模糊查询
*/
...
...
appbuild-manager/src/main/java/com/mortals/xhx/common/utils/GenUtils.java
View file @
963ff10a
...
...
@@ -64,8 +64,8 @@ public class GenUtils {
Integer
htmlType
=
columnLength
>=
255
||
arraysContains
(
GenConstants
.
COLUMNTYPE_TEXT
,
dataType
)
?
HtmlTypeEnum
.
HTML_TEXTAREA
.
getValue
()
:
HtmlTypeEnum
.
HTML_INPUT
.
getValue
();
column
.
setHtmlType
(
htmlType
);
}
else
if
(
arraysContains
(
GenConstants
.
COLUMNTYPE_TIME
,
dataType
))
{
//时间类型
column
.
setJavaType
(
GenConstants
.
TYPE_DATE
);
column
.
setHtmlType
(
HtmlTypeEnum
.
HTML_DATETIME
.
getValue
());
}
else
if
(
arraysContains
(
GenConstants
.
COLUMNTYPE_NUMBER
,
dataType
))
{
column
.
setHtmlType
(
HtmlTypeEnum
.
HTML_INPUT
.
getValue
());
...
...
@@ -82,6 +82,10 @@ public class GenUtils {
else
{
column
.
setJavaType
(
GenConstants
.
TYPE_LONG
);
}
}
else
if
(
arraysContains
(
GenConstants
.
COLUMNTYPE_BLOB
,
dataType
))
{
//大数据字段
column
.
setJavaType
(
GenConstants
.
TYPE_BYTEARRAY
);
column
.
setHtmlType
(
HtmlTypeEnum
.
HTML_TEXTAREA
.
getValue
());
}
// 插入字段(默认所有字段都需要插入)
...
...
@@ -92,7 +96,7 @@ public class GenUtils {
if
(!
arraysContains
(
GenConstants
.
COLUMNNAME_NOT_EDIT
,
columnName
)
&&
column
.
getIsPrimaryKey
()
!=
YesNo
.
YES
.
getValue
())
{
column
.
setIsEdit
(
GenConstants
.
REQUIRE
);
}
else
{
column
.
setIsEdit
(
GenConstants
.
NOREQUIRE
);
}
}
// 列表字段
...
...
@@ -123,13 +127,11 @@ public class GenUtils {
checkDict
(
column
,
temp1
);
//checkDict(column, temp2);
if
(!
ObjectUtils
.
isEmpty
(
column
.
getDict
())){
if
(
column
.
getDict
().
size
()>
2
){
column
.
setHtmlType
(
HtmlTypeEnum
.
HTML_SELECT
.
getValue
());
}
else
{
column
.
setHtmlType
(
HtmlTypeEnum
.
HTML_RADIO
.
getValue
());
}
//radio
}
...
...
appbuild-manager/src/main/resources/template/java/serviceImpl.java.ftl
View file @
963ff10a
...
...
@@ -10,12 +10,12 @@ package ${packageName}.service.impl;
</#
if
>
import
org
.
springframework
.
stereotype
.
Service
;
import
com
.
mortals
.
framework
.
service
.
impl
.${
Service
};
import
com
.
mortals
.
framework
.
exception
.
AppException
;
import
com
.
mortals
.
framework
.
model
.
Context
;
import
${
packageName
}.
dao
.${
ClassName
}
Dao
;
import
${
packageName
}.
model
.${
ClassName
}
Entity
;
import
${
packageName
}.
service
.${
ClassName
}
Service
;
<#
if
table
.
tplCategory
==
"sub"
||
table
.
tplCategory
==
"subone"
>
import
com
.
mortals
.
framework
.
exception
.
AppException
;
import
com
.
mortals
.
framework
.
model
.
Context
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
${
subPackageName
}.
model
.${
subClassName
}
Entity
;
import
${
subPackageName
}.
model
.${
subClassName
}
Query
;
...
...
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