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
May 31, 2022
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 @@
<el-col
:span=
"12"
>
<el-form-item
prop=
"isShowControl"
>
<span
slot=
"label"
>
是否request Mapping
>
request Mapping方式
<el-tooltip
content=
"是否显示的生成Controller Mapping"
placement=
"top"
...
...
@@ -108,9 +108,9 @@
</span>
<el-select
v-model=
"info.isShowControl"
>
<el-option
label=
"RequestBody"
value=
"2"
/>
<el-option
label=
"Request
Form
"
value=
"1"
/>
<el-option
label=
"RequestForm
Two
"
value=
"0"
/>
<el-option
label=
"Request
Json
Body"
value=
"2"
/>
<el-option
label=
"Request
POSTMapping
"
value=
"1"
/>
<el-option
label=
"RequestForm"
value=
"0"
/>
</el-select>
</el-form-item>
...
...
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{
this
.
feignAppName
=
""
;
this
.
genApi
=
null
;
this
.
isGenExport
=
null
;
this
.
isShowControl
=
null
;
this
.
isShowControl
=
2
;
this
.
genPath
=
"/"
;
this
.
options
=
null
;
this
.
remark
=
null
;
...
...
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
GenUtils
.
initTable
(
table
,
operName
);
table
.
setGenType
(
0
);
table
.
setIsGenExport
(
0
);
table
.
setIsShowControl
(
0
);
table
.
setIsShowControl
(
2
);
table
.
setGenPath
(
"/"
);
table
.
setTplCategory
(
"crud"
);
table
.
setAppId
(
appId
);
...
...
@@ -210,15 +210,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
List
<
GentableEntity
>
tableList
=
new
ArrayList
<>();
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
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
);
tableList
.
add
(
gentableEntity
);
...
...
@@ -230,34 +221,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
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
);
return
outputStream
.
toByteArray
();
}
...
...
@@ -266,16 +229,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
@Override
public
byte
[]
downloadCode
(
Long
[]
tableIds
,
String
genTypes
)
{
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
();
ZipOutputStream
zip
=
new
ZipOutputStream
(
outputStream
);
for
(
Long
tableId
:
tableIds
)
{
...
...
@@ -289,84 +242,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
zipTemplate
(
"db.sql.ftl"
,
"db/db.sql"
,
data
,
zip
);
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
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
);
return
outputStream
.
toByteArray
();
}
...
...
@@ -459,7 +334,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
table
.
setAppId
(
appId
);
table
.
setGenType
(
0
);
table
.
setIsGenExport
(
0
);
table
.
setIsShowControl
(
0
);
table
.
setIsShowControl
(
2
);
table
.
setGenPath
(
"/"
);
table
.
setTplCategory
(
"crud"
);
table
.
setCacheServiceType
(
CacheServiceTypeEnum
.
NORMAL_SERVICE
.
getValue
());
...
...
@@ -468,16 +343,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
GentableEntity
gentableEntity
=
this
.
selectOne
(
new
GentableQuery
().
tableName
(
table
.
getTableName
()).
appId
(
appId
));
if
(!
ObjectUtils
.
isEmpty
(
gentableEntity
))
{
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
{
//保存表
this
.
save
(
table
);
//保存列
...
...
@@ -599,7 +465,12 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
if
(
temp
.
contains
(
"web.java.ftl"
)
||
temp
.
contains
(
"webForm.java.ftl"
))
{
continue
;
}
}
else
{
if
(
temp
.
contains
(
"webBody.java.ftl"
))
{
continue
;
}
}
if
(
temp
.
equals
(
"menu.sql.ftl"
))
{
continue
;
}
...
...
@@ -614,22 +485,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
StringWriter
sw
=
new
StringWriter
();
Template
template
=
FreeMarkerUtils
.
getTemplate
(
temp
);
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
)));
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constant
.
UTF8
);
...
...
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