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
703129b9
Commit
703129b9
authored
3 years ago
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部分生成代码逻辑
parent
6fac8380
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
157 deletions
+12
-157
appbuild-manage-ui/admin/src/views/system/gentable/genInfoForm.vue
...manage-ui/admin/src/views/system/gentable/genInfoForm.vue
+4
-4
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/model/GentableEntity.java
...ortals/xhx/base/system/gentable/model/GentableEntity.java
+1
-1
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/service/impl/GentableServiceImpl.java
...ase/system/gentable/service/impl/GentableServiceImpl.java
+7
-152
No files found.
appbuild-manage-ui/admin/src/views/system/gentable/genInfoForm.vue
View file @
703129b9
...
@@ -98,7 +98,7 @@
...
@@ -98,7 +98,7 @@
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
prop=
"isShowControl"
>
<el-form-item
prop=
"isShowControl"
>
<span
slot=
"label"
<span
slot=
"label"
>
是否request Mapping
>
request Mapping方式
<el-tooltip
<el-tooltip
content=
"是否显示的生成Controller Mapping"
content=
"是否显示的生成Controller Mapping"
placement=
"top"
placement=
"top"
...
@@ -108,9 +108,9 @@
...
@@ -108,9 +108,9 @@
</span>
</span>
<el-select
v-model=
"info.isShowControl"
>
<el-select
v-model=
"info.isShowControl"
>
<el-option
label=
"RequestBody"
value=
"2"
/>
<el-option
label=
"Request
Json
Body"
value=
"2"
/>
<el-option
label=
"Request
Form
"
value=
"1"
/>
<el-option
label=
"Request
POSTMapping
"
value=
"1"
/>
<el-option
label=
"RequestForm
Two
"
value=
"0"
/>
<el-option
label=
"RequestForm"
value=
"0"
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/model/GentableEntity.java
View file @
703129b9
...
@@ -493,7 +493,7 @@ public class GentableEntity extends GentableEntityExt{
...
@@ -493,7 +493,7 @@ public class GentableEntity extends GentableEntityExt{
this
.
feignAppName
=
""
;
this
.
feignAppName
=
""
;
this
.
genApi
=
null
;
this
.
genApi
=
null
;
this
.
isGenExport
=
null
;
this
.
isGenExport
=
null
;
this
.
isShowControl
=
null
;
this
.
isShowControl
=
2
;
this
.
genPath
=
"/"
;
this
.
genPath
=
"/"
;
this
.
options
=
null
;
this
.
options
=
null
;
this
.
remark
=
null
;
this
.
remark
=
null
;
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/service/impl/GentableServiceImpl.java
View file @
703129b9
...
@@ -104,7 +104,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -104,7 +104,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
GenUtils
.
initTable
(
table
,
operName
);
GenUtils
.
initTable
(
table
,
operName
);
table
.
setGenType
(
0
);
table
.
setGenType
(
0
);
table
.
setIsGenExport
(
0
);
table
.
setIsGenExport
(
0
);
table
.
setIsShowControl
(
0
);
table
.
setIsShowControl
(
2
);
table
.
setGenPath
(
"/"
);
table
.
setGenPath
(
"/"
);
table
.
setTplCategory
(
"crud"
);
table
.
setTplCategory
(
"crud"
);
table
.
setAppId
(
appId
);
table
.
setAppId
(
appId
);
...
@@ -210,15 +210,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -210,15 +210,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
List
<
GentableEntity
>
tableList
=
new
ArrayList
<>();
List
<
GentableEntity
>
tableList
=
new
ArrayList
<>();
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
ZipOutputStream
zip
=
new
ZipOutputStream
(
outputStream
);
ZipOutputStream
zip
=
new
ZipOutputStream
(
outputStream
);
// FreeMarkerUtils.menuSql = new StringBuilder();
// FreeMarkerUtils.paramsSql = new StringBuilder();
// FreeMarkerUtils.dbSql = new StringBuilder();
// FreeMarkerUtils.apimd = new StringBuilder();
// FreeMarkerUtils.apitwomd = new StringBuilder();
// FreeMarkerUtils.apidict = new StringBuilder();
// FreeMarkerUtils.apidict.append("## 字典附录\n");
// FreeMarkerUtils.apimd.append(headStr);
// FreeMarkerUtils.apitwomd.append(headStr);
GentableEntity
gentableEntity
=
generatorCode
(
tableId
,
genTypes
,
zip
);
GentableEntity
gentableEntity
=
generatorCode
(
tableId
,
genTypes
,
zip
);
tableList
.
add
(
gentableEntity
);
tableList
.
add
(
gentableEntity
);
...
@@ -230,34 +221,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -230,34 +221,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
/*if (StringUtils.isNotEmpty(FreeMarkerUtils.menuSql)) {
zip.putNextEntry(new ZipEntry("db/menu.sql"));
IOUtils.write(FreeMarkerUtils.menuSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.dbSql)) {
zip.putNextEntry(new ZipEntry("db/db.sql"));
IOUtils.write(FreeMarkerUtils.dbSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.paramsSql)) {
zip.putNextEntry(new ZipEntry("db/params.sql"));
IOUtils.write(FreeMarkerUtils.paramsSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apimd)) {
zip.putNextEntry(new ZipEntry("doc/api.md"));
IOUtils.write(FreeMarkerUtils.apimd.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apitwomd)) {
// zip.putNextEntry(new ZipEntry("doc/api-two.md"));
zip.putNextEntry(new ZipEntry("doc/api.md"));
IOUtils.write(FreeMarkerUtils.apitwomd.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apidict)) {
zip.putNextEntry(new ZipEntry("doc/dict.md"));
IOUtils.write(FreeMarkerUtils.apidict.toString(), zip, Constant.UTF8);
}*/
IOUtils
.
closeQuietly
(
zip
);
IOUtils
.
closeQuietly
(
zip
);
return
outputStream
.
toByteArray
();
return
outputStream
.
toByteArray
();
}
}
...
@@ -266,16 +229,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -266,16 +229,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
@Override
@Override
public
byte
[]
downloadCode
(
Long
[]
tableIds
,
String
genTypes
)
{
public
byte
[]
downloadCode
(
Long
[]
tableIds
,
String
genTypes
)
{
List
<
GentableEntity
>
tableList
=
new
ArrayList
<>();
List
<
GentableEntity
>
tableList
=
new
ArrayList
<>();
// FreeMarkerUtils.menuSql = new StringBuilder();
// FreeMarkerUtils.dbSql = new StringBuilder();
// FreeMarkerUtils.paramsSql = new StringBuilder();
// FreeMarkerUtils.apimd = new StringBuilder();
// FreeMarkerUtils.apitwomd = new StringBuilder();
// FreeMarkerUtils.apidict = new StringBuilder();
// FreeMarkerUtils.apidict.append("## 字典附录\n");
// FreeMarkerUtils.apimd.append(headStr);
// FreeMarkerUtils.apitwomd.append(headStr);
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
ZipOutputStream
zip
=
new
ZipOutputStream
(
outputStream
);
ZipOutputStream
zip
=
new
ZipOutputStream
(
outputStream
);
for
(
Long
tableId
:
tableIds
)
{
for
(
Long
tableId
:
tableIds
)
{
...
@@ -289,84 +242,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -289,84 +242,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
zipTemplate
(
"db.sql.ftl"
,
"db/db.sql"
,
data
,
zip
);
zipTemplate
(
"db.sql.ftl"
,
"db/db.sql"
,
data
,
zip
);
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
/* try {
StringWriter sw = new StringWriter();
Template template = FreeMarkerUtils.getTemplate(temp);
template.process(data, sw);
zip.putNextEntry(new ZipEntry("db/menu.sql"));
IOUtils.write(sw.toString(), zip, Constant.UTF8);
if (template.getName().equals("menu.sql.ftl")) {
FreeMarkerUtils.menuSql.append(sw.toString());
} else if (template.getName().equals("db.sql.ftl")) {
FreeMarkerUtils.dbSql.append(sw.toString());
} else if (template.getName().equals("params.sql.ftl")) {
FreeMarkerUtils.paramsSql.append(sw.toString());
} else if (template.getName().equals("api.md.ftl")) {
FreeMarkerUtils.apimd.append(sw.toString());
} else if (template.getName().equals("api-two.md.ftl")) {
FreeMarkerUtils.apitwomd.append(sw.toString());
} else if (template.getName().equals("apidict.md.ftl")) {
FreeMarkerUtils.apidict.append(sw.toString() + "\n");
} else {
zip.putNextEntry(new ZipEntry(FreeMarkerUtils.getFileName(template.getName(), gentableEntity)));
IOUtils.write(sw.toString(), zip, Constant.UTF8);
}
IOUtils.closeQuietly(sw);
zip.flush();
zip.closeEntry();
} catch (Exception e) {
log.error("渲染模板失败,表名:" + gentableEntity.getTableName(), e);
}
zip.putNextEntry(new ZipEntry("db/menu.sql"));
StringWriter sw = new StringWriter();
Template template = FreeMarkerUtils.getTemplate(temp);
template.process(data, sw);
if (StringUtils.isNotEmpty(FreeMarkerUtils.menuSql)) {
zip.putNextEntry(new ZipEntry("db/menu.sql"));
StringWriter sw = new StringWriter();
Template template = FreeMarkerUtils.getTemplate(temp);
template.process(data, sw);
IOUtils.write(FreeMarkerUtils.menuSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.dbSql)) {
zip.putNextEntry(new ZipEntry("db/db.sql"));
IOUtils.write(FreeMarkerUtils.dbSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.paramsSql)) {
zip.putNextEntry(new ZipEntry("db/params.sql"));
IOUtils.write(FreeMarkerUtils.paramsSql.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apimd)) {
FreeMarkerUtils.apimd.append(FreeMarkerUtils.apidict);
zip.putNextEntry(new ZipEntry("doc/api.md"));
IOUtils.write(FreeMarkerUtils.apimd.toString(), zip, Constant.UTF8);
}
if (StringUtils.isNotEmpty(FreeMarkerUtils.apitwomd)) {
FreeMarkerUtils.apitwomd.append(FreeMarkerUtils.apidict);
zip.putNextEntry(new ZipEntry("doc/api-two.md"));
IOUtils.write(FreeMarkerUtils.apitwomd.toString(), zip, Constant.UTF8);
}*/
// if (StringUtils.isNotEmpty(FreeMarkerUtils.apidict)) {
// zip.putNextEntry(new ZipEntry("doc/dict.md"));
// IOUtils.write(FreeMarkerUtils.apidict.toString(), zip, Constant.UTF8);
// }
//
IOUtils
.
closeQuietly
(
zip
);
IOUtils
.
closeQuietly
(
zip
);
return
outputStream
.
toByteArray
();
return
outputStream
.
toByteArray
();
}
}
...
@@ -459,7 +334,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -459,7 +334,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
table
.
setAppId
(
appId
);
table
.
setAppId
(
appId
);
table
.
setGenType
(
0
);
table
.
setGenType
(
0
);
table
.
setIsGenExport
(
0
);
table
.
setIsGenExport
(
0
);
table
.
setIsShowControl
(
0
);
table
.
setIsShowControl
(
2
);
table
.
setGenPath
(
"/"
);
table
.
setGenPath
(
"/"
);
table
.
setTplCategory
(
"crud"
);
table
.
setTplCategory
(
"crud"
);
table
.
setCacheServiceType
(
CacheServiceTypeEnum
.
NORMAL_SERVICE
.
getValue
());
table
.
setCacheServiceType
(
CacheServiceTypeEnum
.
NORMAL_SERVICE
.
getValue
());
...
@@ -468,16 +343,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -468,16 +343,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
GentableEntity
gentableEntity
=
this
.
selectOne
(
new
GentableQuery
().
tableName
(
table
.
getTableName
()).
appId
(
appId
));
GentableEntity
gentableEntity
=
this
.
selectOne
(
new
GentableQuery
().
tableName
(
table
.
getTableName
()).
appId
(
appId
));
if
(!
ObjectUtils
.
isEmpty
(
gentableEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
gentableEntity
))
{
synchDb
(
gentableEntity
.
getId
(),
table
.
getColumns
());
synchDb
(
gentableEntity
.
getId
(),
table
.
getColumns
());
// //删除表
// this.remove(gentableEntity.getId(), context);
// //删除列
// List<GentableColumnEntity> gentableColumnEntities = gentableColumnService.find(new GentableColumnQuery().tableId(gentableEntity.getId()));
// if (ObjectUtils.isEmpty(gentableColumnEntities)) {
// gentableEntity.setColumns(gentableColumnEntities);
// gentableColumnService.remove(gentableEntity.getColumns().stream().map(item -> item.getId()).toArray(Long[]::new), context);
// }
}
else
{
}
else
{
//保存表
//保存表
this
.
save
(
table
);
this
.
save
(
table
);
//保存列
//保存列
...
@@ -599,7 +465,12 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -599,7 +465,12 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
if
(
temp
.
contains
(
"web.java.ftl"
)
||
temp
.
contains
(
"webForm.java.ftl"
))
{
if
(
temp
.
contains
(
"web.java.ftl"
)
||
temp
.
contains
(
"webForm.java.ftl"
))
{
continue
;
continue
;
}
}
}
else
{
if
(
temp
.
contains
(
"webBody.java.ftl"
))
{
continue
;
}
}
}
if
(
temp
.
equals
(
"menu.sql.ftl"
))
{
if
(
temp
.
equals
(
"menu.sql.ftl"
))
{
continue
;
continue
;
}
}
...
@@ -614,22 +485,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -614,22 +485,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
StringWriter
sw
=
new
StringWriter
();
StringWriter
sw
=
new
StringWriter
();
Template
template
=
FreeMarkerUtils
.
getTemplate
(
temp
);
Template
template
=
FreeMarkerUtils
.
getTemplate
(
temp
);
template
.
process
(
data
,
sw
);
template
.
process
(
data
,
sw
);
// 添加到zip
/* if (template.getName().equals("menu.sql.ftl")) {
FreeMarkerUtils.menuSql.append(sw.toString());
} else if (template.getName().equals("db.sql.ftl")) {
FreeMarkerUtils.dbSql.append(sw.toString());
} else if (template.getName().equals("params.sql.ftl")) {
FreeMarkerUtils.paramsSql.append(sw.toString());
} else if (template.getName().equals("api.md.ftl")) {
FreeMarkerUtils.apimd.append(sw.toString());
} else if (template.getName().equals("api-two.md.ftl")) {
FreeMarkerUtils.apitwomd.append(sw.toString());
} else if (template.getName().equals("apidict.md.ftl")) {
FreeMarkerUtils.apidict.append(sw.toString() + "\n");
} else {
}*/
zip
.
putNextEntry
(
new
ZipEntry
(
FreeMarkerUtils
.
getFileName
(
template
.
getName
(),
gentableEntity
)));
zip
.
putNextEntry
(
new
ZipEntry
(
FreeMarkerUtils
.
getFileName
(
template
.
getName
(),
gentableEntity
)));
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constant
.
UTF8
);
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constant
.
UTF8
);
...
...
This diff is collapsed.
Click to expand it.
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