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
d7a0d715
Commit
d7a0d715
authored
3 years ago
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部分生成代码逻辑
parent
c478037d
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
288 additions
and
150 deletions
+288
-150
appbuild-manage-ui/admin/src/views/app/list.vue
appbuild-manage-ui/admin/src/views/app/list.vue
+0
-11
appbuild-manager/pom.xml
appbuild-manager/pom.xml
+61
-1
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/model/GentableColumnEntity.java
.../xhx/base/system/gentable/model/GentableColumnEntity.java
+9
-9
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/service/impl/GentableServiceImpl.java
...ase/system/gentable/service/impl/GentableServiceImpl.java
+49
-21
appbuild-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
...va/com/mortals/xhx/base/system/user/model/UserEntity.java
+26
-0
appbuild-manager/src/main/java/com/mortals/xhx/common/utils/FreeMarkerUtils.java
...in/java/com/mortals/xhx/common/utils/FreeMarkerUtils.java
+19
-9
appbuild-manager/src/main/java/com/mortals/xhx/common/utils/ReadDoc.java
...r/src/main/java/com/mortals/xhx/common/utils/ReadDoc.java
+105
-62
appbuild-manager/src/main/resources/sqlmap/base/system/gentableExt.xml
...ger/src/main/resources/sqlmap/base/system/gentableExt.xml
+2
-2
appbuild-manager/src/main/resources/template/doc/api-two.md.ftl
...ld-manager/src/main/resources/template/doc/api-two.md.ftl
+6
-31
appbuild-manager/src/main/resources/template/java/httpclient.test.ftl
...ager/src/main/resources/template/java/httpclient.test.ftl
+5
-0
appbuild-manager/src/main/resources/template/java/serviceImpl-tree.java.ftl
...rc/main/resources/template/java/serviceImpl-tree.java.ftl
+1
-1
appbuild-manager/src/main/resources/template/java/web.java.ftl
...ild-manager/src/main/resources/template/java/web.java.ftl
+2
-2
pom.xml
pom.xml
+3
-1
No files found.
appbuild-manage-ui/admin/src/views/app/list.vue
View file @
d7a0d715
...
@@ -68,17 +68,6 @@ export default {
...
@@ -68,17 +68,6 @@ export default {
>
>
代码构建
代码构建
<
/el-button
>
<
/el-button
>
<
el
-
button
type
=
"
primary
"
icon
=
"
el-icon-s-order
"
size
=
"
mini
"
onClick
=
{()
=>
{
this
.
test
(
row
);
}}
>
测试抓包
<
/el-button
>
<
/div
>
<
/div
>
);
);
},
},
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/pom.xml
View file @
d7a0d715
...
@@ -94,16 +94,76 @@
...
@@ -94,16 +94,76 @@
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.deepoove
</groupId>
<artifactId>
poi-tl
</artifactId>
<version>
1.12.0
</version>
</dependency>
<!--
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>5.3.18</version>
<scope>provided</scope>
</dependency>-->
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-scratchpad
</artifactId>
<version>
5.2.2
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<resources>
<resources>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.xml
</include>
<include>
**/*.properties
</include>
</includes>
</resource>
<resource>
<resource>
<directory>
src/main/resources
</directory>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
<filtering>
true
</filtering>
<includes>
<include>
**/*.xml
</include>
<include>
**/*.properties
</include>
<include>
**/*.json
</include>
<include>
**/*.yml
</include>
<include>
**/*.js
</include>
<include>
**/*.html
</include>
<include>
**/*.css
</include>
<include>
**/*.svg
</include>
<include>
**/*.jpg
</include>
<include>
**/*.jpeg
</include>
<include>
**/*.png
</include>
<include>
**/*.ico
</include>
<include>
**/*.woff2
</include>
<include>
**/*.txt
</include>
<include>
**/*.xlsx
</include>
<include>
**/*.xls
</include>
</includes>
<excludes>
<exclude>
env/*.properties
</exclude>
</excludes>
</resource>
</resource>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
false
</filtering>
<includes>
<include>
**/*.docx
</include>
<include>
**/*.ftl
</include>
</includes>
</resource>
</resources>
</resources>
<plugins>
<plugins>
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/model/GentableColumnEntity.java
View file @
d7a0d715
...
@@ -634,18 +634,18 @@ public class GentableColumnEntity extends GentableColumnEntityExt {
...
@@ -634,18 +634,18 @@ public class GentableColumnEntity extends GentableColumnEntityExt {
public
void
initAttrValue
()
{
public
void
initAttrValue
()
{
this
.
tableId
=
null
;
this
.
tableId
=
null
;
this
.
columnName
=
null
;
this
.
columnName
=
"1231"
;
this
.
columnComment
=
null
;
this
.
columnComment
=
"1313131"
;
this
.
columnType
=
null
;
this
.
columnType
=
null
;
this
.
javaType
=
null
;
this
.
javaType
=
null
;
this
.
javaField
=
null
;
this
.
javaField
=
null
;
this
.
isPrimaryKey
=
null
;
this
.
isPrimaryKey
=
0
;
this
.
isIncrement
=
null
;
this
.
isIncrement
=
0
;
this
.
isRequired
=
null
;
this
.
isRequired
=
0
;
this
.
isInsert
=
null
;
this
.
isInsert
=
0
;
this
.
isEdit
=
null
;
this
.
isEdit
=
0
;
this
.
isList
=
null
;
this
.
isList
=
0
;
this
.
isQuery
=
null
;
this
.
isQuery
=
0
;
this
.
htmlType
=
null
;
this
.
htmlType
=
null
;
this
.
defaultValue
=
null
;
this
.
defaultValue
=
null
;
this
.
sort
=
null
;
this
.
sort
=
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 @
d7a0d715
...
@@ -2,8 +2,11 @@ package com.mortals.xhx.base.system.gentable.service.impl;
...
@@ -2,8 +2,11 @@ package com.mortals.xhx.base.system.gentable.service.impl;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.deepoove.poi.XWPFTemplate
;
import
com.deepoove.poi.config.Configure
;
import
com.deepoove.poi.config.ConfigureBuilder
;
import
com.deepoove.poi.plugin.table.MultipleRowTableRenderPolicy
;
import
com.mortals.framework.common.code.YesNo
;
import
com.mortals.framework.common.code.YesNo
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
...
@@ -11,7 +14,6 @@ import com.mortals.framework.model.ParamDto;
...
@@ -11,7 +14,6 @@ import com.mortals.framework.model.ParamDto;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.EntityUtil
;
import
com.mortals.framework.util.EntityUtil
;
import
com.mortals.framework.util.FileUtil
;
import
com.mortals.xhx.base.system.gentable.dao.GentableDao
;
import
com.mortals.xhx.base.system.gentable.dao.GentableDao
;
import
com.mortals.xhx.base.system.gentable.model.*
;
import
com.mortals.xhx.base.system.gentable.model.*
;
import
com.mortals.xhx.base.system.gentable.service.GentableColumnService
;
import
com.mortals.xhx.base.system.gentable.service.GentableColumnService
;
...
@@ -29,12 +31,14 @@ import freemarker.template.Template;
...
@@ -29,12 +31,14 @@ import freemarker.template.Template;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.StringWriter
;
import
java.io.StringWriter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -55,9 +59,9 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -55,9 +59,9 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
@Autowired
@Autowired
private
GentableColumnService
gentableColumnService
;
private
GentableColumnService
gentableColumnService
;
String
headStr
=
"版本 | 创建时间 | 作者 | 备注信息\n"
+
String
headStr
=
"版本 | 创建时间 | 作者 | 备注信息\n"
+
"---|---|---|---\n"
+
"---|---|---|---\n"
+
"v1.0|"
+
DateUtils
.
getCurrStrDate
()+
"|zxfei| 接口文档\n\n"
+
"v1.0|"
+
DateUtils
.
getCurrStrDate
()
+
"|zxfei| 接口文档\n\n"
+
"## 数据类型\n"
+
"## 数据类型\n"
+
"类型名称|类型描述|参考样例\n"
+
"类型名称|类型描述|参考样例\n"
+
"---|---|---\n"
+
"---|---|---\n"
+
...
@@ -142,8 +146,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -142,8 +146,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
GentableEntity
gentableEntity
=
this
.
get
(
id
);
GentableEntity
gentableEntity
=
this
.
get
(
id
);
List
<
GentableColumnEntity
>
columnEntities
=
this
.
gentableColumnService
.
find
(
new
GentableColumnQuery
().
tableId
(
gentableEntity
.
getId
())).
stream
().
map
(
column
->
{
List
<
GentableColumnEntity
>
columnEntities
=
this
.
gentableColumnService
.
find
(
new
GentableColumnQuery
().
tableId
(
gentableEntity
.
getId
())).
stream
().
map
(
column
->
{
//拆解枚举类,格式必须为(1.啊啊啊,2.不不不)
//拆解枚举类,格式必须为(1.啊啊啊,2.不不不)
String
temp1
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
String
temp1
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
String
temp2
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
String
temp2
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
GenUtils
.
checkDict
(
column
,
temp1
);
GenUtils
.
checkDict
(
column
,
temp1
);
GenUtils
.
checkDict
(
column
,
temp2
);
GenUtils
.
checkDict
(
column
,
temp2
);
return
column
;
return
column
;
...
@@ -182,7 +186,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -182,7 +186,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
template
.
process
(
data
,
sw
);
template
.
process
(
data
,
sw
);
dataMap
.
put
(
temp
,
sw
.
toString
());
dataMap
.
put
(
temp
,
sw
.
toString
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
log
.
error
(
"异常"
,
e
);
}
}
}
}
return
dataMap
;
return
dataMap
;
...
@@ -328,7 +332,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -328,7 +332,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
}
public
void
synchDb
(
Long
tableId
,
List
<
GentableColumnEntity
>
dbTableColumns
)
{
public
void
synchDb
(
Long
tableId
,
List
<
GentableColumnEntity
>
dbTableColumns
)
{
GentableEntity
table
=
this
.
get
(
tableId
);
GentableEntity
table
=
this
.
get
(
tableId
);
List
<
GentableColumnEntity
>
tableColumns
=
gentableColumnService
.
find
(
new
GentableColumnQuery
().
tableId
(
table
.
getId
()));
List
<
GentableColumnEntity
>
tableColumns
=
gentableColumnService
.
find
(
new
GentableColumnQuery
().
tableId
(
table
.
getId
()));
...
@@ -344,10 +348,10 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -344,10 +348,10 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
if
(!
tableColumnNames
.
contains
(
column
.
getColumnName
()))
{
if
(!
tableColumnNames
.
contains
(
column
.
getColumnName
()))
{
GenUtils
.
initColumnField
(
column
,
table
);
GenUtils
.
initColumnField
(
column
,
table
);
gentableColumnService
.
save
(
column
);
gentableColumnService
.
save
(
column
);
}
else
{
}
else
{
//todo 更新列
//todo 更新列
GentableColumnEntity
columnEntity
=
tableColumns
.
stream
().
filter
(
f
->
f
.
getColumnName
().
equals
(
column
.
getColumnName
())).
findFirst
().
orElseGet
(()
->
null
);
GentableColumnEntity
columnEntity
=
tableColumns
.
stream
().
filter
(
f
->
f
.
getColumnName
().
equals
(
column
.
getColumnName
())).
findFirst
().
orElseGet
(()
->
null
);
if
(!
ObjectUtils
.
isEmpty
(
columnEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
columnEntity
))
{
columnEntity
.
setColumnComment
(
column
.
getColumnComment
());
columnEntity
.
setColumnComment
(
column
.
getColumnComment
());
columnEntity
.
setDefaultValue
(
column
.
getDefaultValue
());
columnEntity
.
setDefaultValue
(
column
.
getDefaultValue
());
columnEntity
.
setColumnType
(
column
.
getColumnType
());
columnEntity
.
setColumnType
(
column
.
getColumnType
());
...
@@ -384,7 +388,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -384,7 +388,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);
// this.remove(gentableEntity.getId(), context);
// //删除列
// //删除列
...
@@ -416,7 +420,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -416,7 +420,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"异常:"
,
e
);
log
.
error
(
"异常:"
,
e
);
throw
new
AppException
(
"导入失败:"
+
e
.
getMessage
());
throw
new
AppException
(
"导入失败:"
+
e
.
getMessage
());
}
}
...
@@ -458,8 +462,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -458,8 +462,8 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
Set
<
String
>
types
=
StrUtil
.
splitTrim
(
genTypes
,
","
.
charAt
(
0
),
-
1
).
stream
().
collect
(
Collectors
.
toSet
());
Set
<
String
>
types
=
StrUtil
.
splitTrim
(
genTypes
,
","
.
charAt
(
0
),
-
1
).
stream
().
collect
(
Collectors
.
toSet
());
if
(!
ObjectUtils
.
isEmpty
(
gentableEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
gentableEntity
))
{
List
<
GentableColumnEntity
>
columnEntities
=
this
.
gentableColumnService
.
find
(
new
GentableColumnQuery
().
tableId
(
gentableEntity
.
getId
())).
stream
().
map
(
column
->
{
List
<
GentableColumnEntity
>
columnEntities
=
this
.
gentableColumnService
.
find
(
new
GentableColumnQuery
().
tableId
(
gentableEntity
.
getId
())).
stream
().
map
(
column
->
{
String
temp1
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
String
temp1
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
String
temp2
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
String
temp2
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
GenUtils
.
checkDict
(
column
,
temp1
);
GenUtils
.
checkDict
(
column
,
temp1
);
GenUtils
.
checkDict
(
column
,
temp2
);
GenUtils
.
checkDict
(
column
,
temp2
);
return
column
;
return
column
;
...
@@ -498,17 +502,13 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -498,17 +502,13 @@ 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
(
enumData
,
sw
);
template
.
process
(
enumData
,
sw
);
String
enumFileName
=
FreeMarkerUtils
.
getEnumFileName
(
item
.
getColumnName
());
String
enumFileName
=
FreeMarkerUtils
.
getEnumFileName
(
item
.
getColumnName
());
File
file
=
new
File
(
enumFileName
);
File
file
=
new
File
(
enumFileName
);
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
return
item
;
return
item
;
}
}
zip
.
putNextEntry
(
new
ZipEntry
(
enumFileName
));
zip
.
putNextEntry
(
new
ZipEntry
(
enumFileName
));
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constant
.
UTF8
);
IOUtils
.
write
(
sw
.
toString
(),
zip
,
Constant
.
UTF8
);
IOUtils
.
closeQuietly
(
sw
);
IOUtils
.
closeQuietly
(
sw
);
zip
.
flush
();
zip
.
flush
();
zip
.
closeEntry
();
zip
.
closeEntry
();
...
@@ -539,7 +539,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -539,7 +539,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
else
if
(
template
.
getName
().
equals
(
"api-two.md.ftl"
))
{
}
else
if
(
template
.
getName
().
equals
(
"api-two.md.ftl"
))
{
FreeMarkerUtils
.
apitwomd
.
append
(
sw
.
toString
());
FreeMarkerUtils
.
apitwomd
.
append
(
sw
.
toString
());
}
else
if
(
template
.
getName
().
equals
(
"apidict.md.ftl"
))
{
}
else
if
(
template
.
getName
().
equals
(
"apidict.md.ftl"
))
{
FreeMarkerUtils
.
apidict
.
append
(
sw
.
toString
()
+
"\n"
);
FreeMarkerUtils
.
apidict
.
append
(
sw
.
toString
()
+
"\n"
);
}
else
{
}
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
);
...
@@ -576,9 +576,37 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -576,9 +576,37 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
list
.
add
(
gentableEntity
);
list
.
add
(
gentableEntity
);
}
}
}
}
Map
data
=
FreeMarkerUtils
.
prepareSetFreeMarkerDataByDoc
(
list
,
projectInfo
);
Map
data
=
FreeMarkerUtils
.
prepareSetFreeMarkerDataByDoc
(
list
,
projectInfo
);
ConfigureBuilder
builder
=
Configure
.
builder
();
builder
.
bind
(
"columns"
,
new
MultipleRowTableRenderPolicy
());
Configure
config
=
Configure
.
builder
().
useSpringEL
().
bind
(
"columns"
,
new
MultipleRowTableRenderPolicy
()).
build
();
XWPFTemplate
template
=
null
;
ByteArrayOutputStream
byteArrayOutputStream
=
null
;
try
{
ClassPathResource
classPathResource
=
new
ClassPathResource
(
"template/doc/base.docx"
);
// InputStream inputStream = classPathResource.getInputStream();
template
=
XWPFTemplate
.
compile
(
classPathResource
.
getInputStream
(),
config
).
render
(
data
);
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
template
.
write
(
byteArrayOutputStream
);
return
byteArrayOutputStream
.
toByteArray
();
}
catch
(
Exception
e
)
{
log
.
error
(
"渲染模板失败:"
,
e
);
return
null
;
}
finally
{
try
{
template
.
close
();
byteArrayOutputStream
.
close
();
}
catch
(
IOException
e
)
{
log
.
error
(
"ioEx:"
,
e
);
}
}
//通过模板生成不同的业务类
//通过模板生成不同的业务类
String
temp
=
"db.doc.ftl"
;
/*
String temp = "db.doc.ftl";
try {
try {
FreeMarkerUtils.initFreeMarker(genFreePath(temp));
FreeMarkerUtils.initFreeMarker(genFreePath(temp));
StringWriter sw = new StringWriter();
StringWriter sw = new StringWriter();
...
@@ -588,7 +616,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -588,7 +616,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
} catch (Exception e) {
} catch (Exception e) {
log.error("渲染模板失败:" , e);
log.error("渲染模板失败:" , e);
return null;
return null;
}
}
*/
}
}
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
View file @
d7a0d715
...
@@ -306,6 +306,32 @@ public class UserEntity extends UserEntityExt implements IUser {
...
@@ -306,6 +306,32 @@ public class UserEntity extends UserEntityExt implements IUser {
public
Integer
getUserType
()
{
public
Integer
getUserType
()
{
return
this
.
userType
;
return
this
.
userType
;
}
}
@Override
public
String
getToken
()
{
return
null
;
}
@Override
public
Long
getLoginTime
()
{
return
null
;
}
@Override
public
Long
getExpireTime
()
{
return
null
;
}
@Override
public
void
setExpireTime
(
Long
expireTime
)
{
}
@Override
public
String
getMenuUrl
()
{
return
null
;
}
/**
/**
* 设置 用户类型,0:系统用户 1:普通用户 2:工作人员,默认2
* 设置 用户类型,0:系统用户 1:普通用户 2:工作人员,默认2
* @param userType
* @param userType
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/java/com/mortals/xhx/common/utils/FreeMarkerUtils.java
View file @
d7a0d715
...
@@ -113,7 +113,8 @@ public class FreeMarkerUtils {
...
@@ -113,7 +113,8 @@ public class FreeMarkerUtils {
templates
.
add
(
"entityQuery.java.ftl"
);
templates
.
add
(
"entityQuery.java.ftl"
);
templates
.
add
(
"dao.java.ftl"
);
templates
.
add
(
"dao.java.ftl"
);
templates
.
add
(
"daoImpl.java.ftl"
);
templates
.
add
(
"daoImpl.java.ftl"
);
templates
.
add
(
"web.java.ftl"
);
// templates.add("web.java.ftl");
templates
.
add
(
"webBody.java.ftl"
);
templates
.
add
(
"webForm.java.ftl"
);
templates
.
add
(
"webForm.java.ftl"
);
templates
.
add
(
"sqlMap.xml.ftl"
);
templates
.
add
(
"sqlMap.xml.ftl"
);
templates
.
add
(
"db.sql.ftl"
);
templates
.
add
(
"db.sql.ftl"
);
...
@@ -128,7 +129,7 @@ public class FreeMarkerUtils {
...
@@ -128,7 +129,7 @@ public class FreeMarkerUtils {
templates
.
add
(
"serviceImpl.java.ftl"
);
templates
.
add
(
"serviceImpl.java.ftl"
);
templates
.
add
(
"webVueList.vue.ftl"
);
templates
.
add
(
"webVueList.vue.ftl"
);
templates
.
add
(
"VueDialogShow.vue.ftl"
);
templates
.
add
(
"VueDialogShow.vue.ftl"
);
templates
.
add
(
"webVueShow.vue.ftl"
);
//
templates.add("webVueShow.vue.ftl");
}
else
if
(
GenConstants
.
TPL_TREE
.
equals
(
tplCategory
))
{
}
else
if
(
GenConstants
.
TPL_TREE
.
equals
(
tplCategory
))
{
templates
.
add
(
"entity-tree.java.ftl"
);
templates
.
add
(
"entity-tree.java.ftl"
);
templates
.
add
(
"service-tree.java.ftl"
);
templates
.
add
(
"service-tree.java.ftl"
);
...
@@ -139,10 +140,10 @@ public class FreeMarkerUtils {
...
@@ -139,10 +140,10 @@ public class FreeMarkerUtils {
templates
.
add
(
"service.java.ftl"
);
templates
.
add
(
"service.java.ftl"
);
templates
.
add
(
"serviceImpl.java.ftl"
);
templates
.
add
(
"serviceImpl.java.ftl"
);
templates
.
add
(
"webVueList.vue.ftl"
);
templates
.
add
(
"webVueList.vue.ftl"
);
templates
.
add
(
"webVueShow.vue.ftl"
);
//
templates.add("webVueShow.vue.ftl");
templates
.
add
(
"VueDialogShow.vue.ftl"
);
templates
.
add
(
"VueDialogShow.vue.ftl"
);
}
}
templates
.
add
(
"webVueView.vue.ftl"
);
//
templates.add("webVueView.vue.ftl");
return
templates
;
return
templates
;
}
}
...
@@ -444,9 +445,14 @@ public class FreeMarkerUtils {
...
@@ -444,9 +445,14 @@ public class FreeMarkerUtils {
fileName
=
StringUtils
.
format
(
"{}/{}/service/impl/{}ServiceImpl.java"
,
javaPath
,
businessName
,
className
);
fileName
=
StringUtils
.
format
(
"{}/{}/service/impl/{}ServiceImpl.java"
,
javaPath
,
businessName
,
className
);
}
else
if
(
template
.
contains
(
"serviceImpl-tree.java.ftl"
))
{
}
else
if
(
template
.
contains
(
"serviceImpl-tree.java.ftl"
))
{
fileName
=
StringUtils
.
format
(
"{}/{}/service/impl/{}ServiceImpl.java"
,
javaPath
,
businessName
,
className
);
fileName
=
StringUtils
.
format
(
"{}/{}/service/impl/{}ServiceImpl.java"
,
javaPath
,
businessName
,
className
);
}
else
if
(
template
.
contains
(
"web.java.ftl"
))
{
}
// else if (template.contains("web.java.ftl")) {
// fileName = StringUtils.format("{}/{}/web/{}Controller.java", javaPath, businessName, className);
// }
else
if
(
template
.
contains
(
"webBody.java.ftl"
))
{
fileName
=
StringUtils
.
format
(
"{}/{}/web/{}Controller.java"
,
javaPath
,
businessName
,
className
);
fileName
=
StringUtils
.
format
(
"{}/{}/web/{}Controller.java"
,
javaPath
,
businessName
,
className
);
}
else
if
(
template
.
contains
(
"webForm.java.ftl"
))
{
}
else
if
(
template
.
contains
(
"webForm.java.ftl"
))
{
fileName
=
StringUtils
.
format
(
"{}/{}/web/{}Form.java"
,
javaPath
,
businessName
,
className
);
fileName
=
StringUtils
.
format
(
"{}/{}/web/{}Form.java"
,
javaPath
,
businessName
,
className
);
}
else
if
(
template
.
contains
(
"sqlMap.xml.ftl"
))
{
}
else
if
(
template
.
contains
(
"sqlMap.xml.ftl"
))
{
fileName
=
StringUtils
.
format
(
"{}/{}/{}Mapper.xml"
,
mybatisPath
,
businessName
,
className
);
fileName
=
StringUtils
.
format
(
"{}/{}/{}Mapper.xml"
,
mybatisPath
,
businessName
,
className
);
...
@@ -454,15 +460,19 @@ public class FreeMarkerUtils {
...
@@ -454,15 +460,19 @@ public class FreeMarkerUtils {
String
businessNameExt
=
getBusinessNameExt
(
genTable
.
getTableName
());
String
businessNameExt
=
getBusinessNameExt
(
genTable
.
getTableName
());
businessNameExt
=
StringUtils
.
replace
(
businessNameExt
,
"."
,
"/"
);
businessNameExt
=
StringUtils
.
replace
(
businessNameExt
,
"."
,
"/"
);
fileName
=
StringUtils
.
format
(
"{}/views/{}/list.vue"
,
vuePath
,
businessNameExt
);
fileName
=
StringUtils
.
format
(
"{}/views/{}/list.vue"
,
vuePath
,
businessNameExt
);
}
else
if
(
template
.
contains
(
"webVueShow.vue.ftl"
))
{
}
/* else if (template.contains("webVueShow.vue.ftl")) {
String businessNameExt = getBusinessNameExt(genTable.getTableName());
String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/show.vue", vuePath, businessNameExt);
fileName = StringUtils.format("{}/views/{}/show.vue", vuePath, businessNameExt);
}
else
if
(
template
.
contains
(
"webVueView.vue.ftl"
))
{
}
else if (template.contains("webVueView.vue.ftl")) {
String businessNameExt = getBusinessNameExt(genTable.getTableName());
String businessNameExt = getBusinessNameExt(genTable.getTableName());
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
businessNameExt = StringUtils.replace(businessNameExt, ".", "/");
fileName = StringUtils.format("{}/views/{}/view.vue", vuePath, businessNameExt);
fileName = StringUtils.format("{}/views/{}/view.vue", vuePath, businessNameExt);
}
else
if
(
template
.
contains
(
"webVueTreeList.vue.ftl"
))
{
}*/
else
if
(
template
.
contains
(
"webVueTreeList.vue.ftl"
))
{
String
businessNameExt
=
getBusinessNameExt
(
genTable
.
getTableName
());
String
businessNameExt
=
getBusinessNameExt
(
genTable
.
getTableName
());
businessNameExt
=
StringUtils
.
replace
(
businessNameExt
,
"."
,
"/"
);
businessNameExt
=
StringUtils
.
replace
(
businessNameExt
,
"."
,
"/"
);
fileName
=
StringUtils
.
format
(
"{}/views/{}/list.vue"
,
vuePath
,
businessNameExt
);
fileName
=
StringUtils
.
format
(
"{}/views/{}/list.vue"
,
vuePath
,
businessNameExt
);
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/java/com/mortals/xhx/common/utils/ReadDoc.java
View file @
d7a0d715
...
@@ -4,6 +4,8 @@ import cn.hutool.core.io.FileUtil;
...
@@ -4,6 +4,8 @@ import cn.hutool.core.io.FileUtil;
import
com.mortals.xhx.base.system.gentable.model.GentableColumnEntity
;
import
com.mortals.xhx.base.system.gentable.model.GentableColumnEntity
;
import
com.mortals.xhx.base.system.gentable.model.GentableEntity
;
import
com.mortals.xhx.base.system.gentable.model.GentableEntity
;
import
lombok.experimental.UtilityClass
;
import
lombok.experimental.UtilityClass
;
import
org.apache.poi.hwpf.HWPFDocument
;
import
org.apache.poi.hwpf.usermodel.*
;
import
org.apache.poi.poifs.filesystem.POIFSFileSystem
;
import
org.apache.poi.poifs.filesystem.POIFSFileSystem
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.apache.poi.xwpf.usermodel.XWPFDocument
;
import
org.apache.poi.xwpf.usermodel.XWPFTable
;
import
org.apache.poi.xwpf.usermodel.XWPFTable
;
...
@@ -79,7 +81,7 @@ public class ReadDoc {
...
@@ -79,7 +81,7 @@ public class ReadDoc {
}
}
docTable
.
setTableName
(
tableName
.
trim
());
docTable
.
setTableName
(
tableName
.
trim
());
docTable
.
setTableComment
(
split
[
0
].
replace
(
",表名"
,
""
).
trim
());
docTable
.
setTableComment
(
split
[
0
].
replace
(
",表名"
,
""
).
trim
());
// System.out.println("这是第" + num + "个表的数据");
// System.out.println("这是第" + num + "个表的数据");
List
<
XWPFTableRow
>
rows
=
table
.
getRows
();
List
<
XWPFTableRow
>
rows
=
table
.
getRows
();
//读取每一行数据,每一行为一列
//读取每一行数据,每一行为一列
...
@@ -118,9 +120,9 @@ public class ReadDoc {
...
@@ -118,9 +120,9 @@ public class ReadDoc {
column
.
setIsQuery
(
"是"
.
equals
(
cell
.
getText
().
trim
())
?
1
:
0
);
column
.
setIsQuery
(
"是"
.
equals
(
cell
.
getText
().
trim
())
?
1
:
0
);
//默认值
//默认值
cell
=
cells
.
get
(
9
);
cell
=
cells
.
get
(
9
);
if
(!
ObjectUtils
.
isEmpty
(
cell
.
getText
().
trim
()))
{
if
(!
ObjectUtils
.
isEmpty
(
cell
.
getText
().
trim
()))
{
column
.
setDefaultValue
(
cell
.
getText
().
trim
());
column
.
setDefaultValue
(
cell
.
getText
().
trim
());
}
else
{
}
else
{
column
.
setDefaultValue
(
""
);
column
.
setDefaultValue
(
""
);
}
}
//备注信息
//备注信息
...
@@ -135,64 +137,105 @@ public class ReadDoc {
...
@@ -135,64 +137,105 @@ public class ReadDoc {
}
}
}
else
{
}
else
{
// 处理doc格式 即office2003版本
// 处理doc格式 即office2003版本
// POIFSFileSystem pfs = new POIFSFileSystem(file.getInputStream());
POIFSFileSystem
pfs
=
new
POIFSFileSystem
(
file
.
getInputStream
());
//
// HWPFDocument hwpf = new HWPFDocument(pfs);
HWPFDocument
hwpf
=
new
HWPFDocument
(
pfs
);
// Range range = hwpf.getRange();//得到文档的读取范围
Range
range
=
hwpf
.
getRange
();
//得到文档的读取范围
// TableIterator it = new TableIterator(range);
TableIterator
it
=
new
TableIterator
(
range
);
// while (it.hasNext()) {
while
(
it
.
hasNext
())
{
// List<DocTableModel> docTableModels = new ArrayList<DocTableModel>();
List
<
GentableColumnEntity
>
columns
=
new
ArrayList
<
GentableColumnEntity
>();
//
// Table tb = it.next();
Table
table
=
it
.
next
();
//
// XWPFTable table = (XWPFTable) next;
// DocTable docTable = new DocTable();
GentableEntity
docTable
=
new
GentableEntity
();
//
TableRow
firstRow
=
table
.
getRow
(
0
);
// TableRow firstRow = tb.getRow(0);
TableCell
firstTdCell
=
firstRow
.
getCell
(
0
);
//
String
firstStr
=
firstTdCell
.
text
();
// TableCell firstTdCell = firstRow.getCell(0);
String
[]
split
=
firstStr
.
split
(
":"
);
//
if
(
split
.
length
<
2
)
{
// Paragraph firstTdCellParagraph = firstTdCell.getParagraph(0);
continue
;
// String firstStr = firstTdCellParagraph.text();
}
// //去除后面的特殊符号
// if (null != firstStr && !"".equals(firstStr)) {
String
tableName
=
split
[
1
];
// firstStr = firstStr.substring(0, firstStr.length() - 1);
String
[]
vals
=
tableName
.
split
(
"_"
);
// }
// String[] split = firstStr.split(":");
if
(
tableName
.
indexOf
(
"yyyymmdd"
)
!=
-
1
)
{
// docTable.setDataTableName(split[1]);
docTable
.
setDividedTableType
(
3
);
//
}
else
if
(
tableName
.
indexOf
(
"yyyymm"
)
!=
-
1
)
{
// //System.out.println("这是第" + num + "个表的数据");
docTable
.
setDividedTableType
(
2
);
// //迭代行,默认从0开始,可以依据需要设置i的值,改变起始行数,也可设置读取到那行,只需修改循环的判断条件即可
}
else
if
(
tableName
.
indexOf
(
"yyyy"
)
!=
-
1
)
{
// for (int i = 1; i < tb.numRows(); i++) {
docTable
.
setDividedTableType
(
1
);
// DocTableModel docTableModel = new DocTableModel();
}
else
{
// TableRow tr = tb.getRow(i);
docTable
.
setDividedTableType
(
0
);
//
}
// if("".equals(tr.getCell(0).text().trim())){
if
(
vals
[
vals
.
length
-
1
].
startsWith
(
"yyyy"
))
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
vals
.
length
-
1
;
i
++)
{
sb
.
append
(
vals
[
i
]);
if
(
i
<
vals
.
length
-
2
)
{
sb
.
append
(
"_"
);
}
}
tableName
=
sb
.
toString
();
}
docTable
.
setTableName
(
tableName
.
trim
());
docTable
.
setTableComment
(
split
[
0
].
replace
(
",表名"
,
""
).
trim
());
// System.out.println("这是第" + num + "个表的数据");
int
rows
=
table
.
numRows
();
//读取每一行数据,每一行为一列
for
(
int
i
=
2
;
i
<
rows
;
i
++)
{
GentableColumnEntity
column
=
new
GentableColumnEntity
();
TableRow
row
=
table
.
getRow
(
i
);
//判断是否第一个列数据为空 如果为空 跳过
// if ("".equals(row.getCell(0).getText().trim())) {
// continue;
// continue;
// }
// }
// //迭代列,默认从0开始
//读取每一列数据
// for (int j = 0; j < tr.numCells(); j++) {
// List<TableCell> cells = row.getCell();
// TableCell td = tr.getCell(j);//取得单元格
//列名
// //获取需要设置的属性名称
TableCell
cell
=
row
.
getCell
(
1
);
// String att = vars[j];
column
.
setColumnName
(
cell
.
text
().
trim
());
//
//数据类型
// //取得单元格的内容
cell
=
row
.
getCell
(
2
);
// for (int k = 0; k < td.numParagraphs(); k++) {
column
.
setColumnType
(
cell
.
text
().
trim
());
// Paragraph para = td.getParagraph(k);
//是否必填
// String s = para.text();
cell
=
row
.
getCell
(
3
);
// //去除后面的特殊符号
column
.
setIsRequired
(
"是"
.
equals
(
cell
.
text
().
trim
())
?
1
:
0
);
// if (null != s && !"".equals(s)) {
//是否主键
// s = s.substring(0, s.length() - 1);
cell
=
row
.
getCell
(
4
);
// }
column
.
setIsPrimaryKey
(
"是"
.
equals
(
cell
.
text
().
trim
())
?
1
:
0
);
//
//是否自增
// setFieldValueByFieldName(att, docTableModel, s);
cell
=
row
.
getCell
(
5
);
// }
column
.
setIsIncrement
(
"是"
.
equals
(
cell
.
text
().
trim
())
?
1
:
0
);
// }
//是否列表
//
cell
=
row
.
getCell
(
6
);
// docTableModels.add(docTableModel);
column
.
setIsList
(
"是"
.
equals
(
cell
.
text
().
trim
())
?
1
:
0
);
// }
//是否导入导出
// docTable.setModelList(docTableModels);
cell
=
row
.
getCell
(
7
);
// docTables.add(docTable);
column
.
setIsExport
(
"是"
.
equals
(
cell
.
text
().
trim
())
?
1
:
0
);
// }
//是否查询
cell
=
row
.
getCell
(
8
);
column
.
setIsQuery
(
"是"
.
equals
(
cell
.
text
().
trim
())
?
1
:
0
);
//默认值
cell
=
row
.
getCell
(
9
);
if
(!
ObjectUtils
.
isEmpty
(
cell
.
text
().
trim
()))
{
column
.
setDefaultValue
(
cell
.
text
().
trim
());
}
else
{
column
.
setDefaultValue
(
""
);
}
//备注信息
cell
=
row
.
getCell
(
10
);
column
.
setColumnComment
(
cell
.
text
().
trim
());
columns
.
add
(
column
);
}
docTable
.
setColumns
(
columns
);
docTables
.
add
(
docTable
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/resources/sqlmap/base/system/gentableExt.xml
View file @
d7a0d715
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
where table_schema = (select database())
where table_schema = (select database())
AND table_name NOT LIKE 'act_%'
AND table_name NOT LIKE 'act_%'
<!--过滤初始系统表-->
<!--过滤初始系统表-->
AND table_name NOT IN (
<!--
AND table_name NOT IN (
'mortals_xhx_gentable',
'mortals_xhx_gentable',
'mortals_xhx_gentable_column',
'mortals_xhx_gentable_column',
'mortals_xhx_idgenerator',
'mortals_xhx_idgenerator',
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
'mortals_xhx_user',
'mortals_xhx_user',
'mortals_xhx_valid_code',
'mortals_xhx_valid_code',
'mortals_xhx_area'
'mortals_xhx_area'
)
)
-->
<!-- AND table_name NOT LIKE 'mortals_xhx_gen%'-->
<!-- AND table_name NOT LIKE 'mortals_xhx_gen%'-->
AND table_name NOT IN (select tableName from mortals_xhx_gentable
AND table_name NOT IN (select tableName from mortals_xhx_gentable
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/resources/template/doc/api-two.md.ftl
View file @
d7a0d715
...
@@ -16,16 +16,19 @@
...
@@ -16,16 +16,19 @@
参数名称|类型|备注|必填|其它
参数名称|类型|备注|必填|其它
---|---|---|---|---
---|---|---|---|---
page|Integer|当前页|否|-
page|Integer|当前页|否|-
size|Integer|每页条数|否|
-
size|Integer|每页条数|否|
值为-1,查询所有记录
<#list columns as column>
<#list columns as column>
<#if column.isQuery == 1>
<#if column.isQuery == 1>
<#if column.javaType=="String" >
${column.javaField}|${column.javaType}|${column.columnComment}|否|字段前后添加%%模糊查询
<#else>
${column.javaField}|${column.javaType}|${column.columnComment}|否|-
${column.javaField}|${column.javaType}|${column.columnComment}|否|-
</#if>
</#if>
</#if>
</#list>
</#list>
**请求样例:**
**请求样例:**
```
```
{
{
<#list columns as column>
<#list columns as column>
<#if column.isQuery == 1>
<#if column.isQuery == 1>
...
@@ -70,15 +73,6 @@ dict|object|字典对象|-
...
@@ -70,15 +73,6 @@ dict|object|字典对象|-
{
{
"code":1,
"code":1,
"data":{
"data":{
"per_page":10,
"total":0,
"data":[],
"last_page":0,
"current_page":1
},
"query":{
"modelCode":"phxt1",
"modelName":"排号系统"
}
}
}
}
```
```
...
@@ -101,9 +95,7 @@ ${pkColumn.javaField}|${pkColumn.javaType}|主键,唯一|是|-
...
@@ -101,9 +95,7 @@ ${pkColumn.javaField}|${pkColumn.javaType}|主键,唯一|是|-
**请求样例:**
**请求样例:**
```
```
http://localhost/${RequestMapping}/edit?id=549
http://localhost/${RequestMapping}/edit?id=549
```
```
**响应参数:**
**响应参数:**
...
@@ -125,7 +117,6 @@ dict|object|字典对象|-
...
@@ -125,7 +117,6 @@ dict|object|字典对象|-
**响应消息样例:**
**响应消息样例:**
```
```
{
{
"code": 1,
"code": 1,
"data": {
"data": {
...
@@ -139,7 +130,6 @@ dict|object|字典对象|-
...
@@ -139,7 +130,6 @@ dict|object|字典对象|-
</#list>
</#list>
}
}
}
}
```
```
### 查看${functionName}
### 查看${functionName}
...
@@ -160,9 +150,7 @@ ${pkColumn.javaField}|${pkColumn.javaType}|主键,唯一|是|-
...
@@ -160,9 +150,7 @@ ${pkColumn.javaField}|${pkColumn.javaType}|主键,唯一|是|-
**请求样例:**
**请求样例:**
```
```
http://localhost/${RequestMapping}/info?id=549
http://localhost/${RequestMapping}/info?id=549
```
```
**响应参数:**
**响应参数:**
...
@@ -205,7 +193,6 @@ dict|object|字典对象|-
...
@@ -205,7 +193,6 @@ dict|object|字典对象|-
**请求方式:** POST
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**内容类型:** application/json;charset=utf-8
**简要描述:** 保存或更新${functionName}:id为空时为新增保存,否则为更新提交
**简要描述:** 保存或更新${functionName}:id为空时为新增保存,否则为更新提交
...
@@ -222,7 +209,6 @@ ${column.javaField}|${column.javaType}|${column.columnComment}|是|-
...
@@ -222,7 +209,6 @@ ${column.javaField}|${column.javaType}|${column.columnComment}|是|-
**请求样例:**
**请求样例:**
```
```
{
{
<#list columns as column>
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
<#if !column.isSuperColumn(column.javaField)>
...
@@ -252,19 +238,10 @@ data|object|数据对象|-
...
@@ -252,19 +238,10 @@ data|object|数据对象|-
**响应消息样例:**
**响应消息样例:**
```
```
{
{
"msg":"新增模块成功",
"msg":"新增模块成功",
"code":1,
"code":1,
"data":{
"data":{
"__mortals_form_state__":"ADD",
"id":4,
"entity":{
"createTime":1642486776780,
"id":4,
"modelCode":"phxt1",
"modelName":"排号系统4",
"updateTime":1642486776780
}
}
}
}
}
}
...
@@ -276,7 +253,7 @@ data|object|数据对象|-
...
@@ -276,7 +253,7 @@ data|object|数据对象|-
**请求URL:** ${RequestMapping}/delete
**请求URL:** ${RequestMapping}/delete
**请求方式:**
POS
T
**请求方式:**
GE
T
**内容类型:** application/json;charset=utf-8
**内容类型:** application/json;charset=utf-8
...
@@ -290,9 +267,7 @@ id|String|字符串,多个逗号分隔|是|-
...
@@ -290,9 +267,7 @@ id|String|字符串,多个逗号分隔|是|-
**请求样例:**
**请求样例:**
```
```
http://localhost:8080/${RequestMapping}/delete?id=1'
http://localhost:8080/${RequestMapping}/delete?id=1'
```
```
**响应参数:**
**响应参数:**
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/resources/template/java/httpclient.test.ftl
View file @
d7a0d715
###${functionName}列表
###${functionName}列表
POST {{baseUrl}}/${RequestMapping}/list
POST {{baseUrl}}/${RequestMapping}/list
Authorization: {{authToken}}
Content-Type: application/json
Content-Type: application/json
{
{
...
@@ -21,6 +22,7 @@ Content-Type: application/json
...
@@ -21,6 +22,7 @@ Content-Type: application/json
###${functionName}更新与保存
###${functionName}更新与保存
POST {{baseUrl}}/${RequestMapping}/save
POST {{baseUrl}}/${RequestMapping}/save
Authorization: {{authToken}}
Content-Type: application/json
Content-Type: application/json
{
{
...
@@ -42,15 +44,18 @@ client.global.set("${ClassName}_id", JSON.parse(response.body).data.id);
...
@@ -42,15 +44,18 @@ client.global.set("${ClassName}_id", JSON.parse(response.body).data.id);
###${functionName}查看
###${functionName}查看
GET {{baseUrl}}/${RequestMapping}/info?id={{${ClassName}_id}}
GET {{baseUrl}}/${RequestMapping}/info?id={{${ClassName}_id}}
Authorization: {{authToken}}
Accept: application/json
Accept: application/json
###${functionName}编辑
###${functionName}编辑
GET {{baseUrl}}/${RequestMapping}/edit?id={{${ClassName}_id}}
GET {{baseUrl}}/${RequestMapping}/edit?id={{${ClassName}_id}}
Authorization: {{authToken}}
Accept: application/json
Accept: application/json
###${functionName}删除
###${functionName}删除
GET {{baseUrl}}/${RequestMapping}/delete?id={{${ClassName}_id}}
GET {{baseUrl}}/${RequestMapping}/delete?id={{${ClassName}_id}}
Authorization: {{authToken}}
Accept: application/json
Accept: application/json
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/resources/template/java/serviceImpl-tree.java.ftl
View file @
d7a0d715
...
@@ -151,7 +151,7 @@ public class ${ClassName}ServiceImpl extends ${Service}<${ClassName}Dao, ${Class
...
@@ -151,7 +151,7 @@ public class ${ClassName}ServiceImpl extends ${Service}<${ClassName}Dao, ${Class
for
(
Iterator
<${
ClassName
}
Entity
>
iterator
=
list
.
iterator
();
iterator
.
hasNext
();
)
{
for
(
Iterator
<${
ClassName
}
Entity
>
iterator
=
list
.
iterator
();
iterator
.
hasNext
();
)
{
${
ClassName
}
Entity
${
ClassName
?
uncap_first
}
Entity
=
iterator
.
next
();
${
ClassName
}
Entity
${
ClassName
?
uncap_first
}
Entity
=
iterator
.
next
();
//
如果是顶级节点
,
遍历该父节点的所有子节点
if
(
!tempList.contains(${ClassName?uncap_first}Entity.get${treeParentCode?cap_first}())) {
if
(
!tempList.contains(${ClassName?uncap_first}Entity.get${treeParentCode?cap_first}())) {
recursionFn
(
list
,
${
ClassName
?
uncap_first
}
Entity
);
recursionFn
(
list
,
${
ClassName
?
uncap_first
}
Entity
);
returnList
.
add
(${
ClassName
?
uncap_first
}
Entity
);
returnList
.
add
(${
ClassName
?
uncap_first
}
Entity
);
...
...
This diff is collapsed.
Click to expand it.
appbuild-manager/src/main/resources/template/java/web.java.ftl
View file @
d7a0d715
...
@@ -5,11 +5,11 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -5,11 +5,11 @@ import org.springframework.web.multipart.MultipartFile;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
<#
assign
Controller
=
"BaseCRUDJsonController"
>
<#
assign
Controller
=
"BaseCRUDJsonController"
>
<#
elseif
table
.
isShowControl
==
2
>
<#
elseif
table
.
isShowControl
==
2
>
<#
assign
Controller
=
"BaseCRUDJson
Php
Controller"
>
<#
assign
Controller
=
"BaseCRUDJson
BodyMapping
Controller"
>
<#
else
>
<#
else
>
<#
assign
Controller
=
"BaseCRUDJsonMappingController"
>
<#
assign
Controller
=
"BaseCRUDJsonMappingController"
>
</#
if
>
</#
if
>
import
com
.
mortals
.
framework
.
web
.
BaseCRUDJsonBodyMappingController
;
import
com
.
mortals
.
xhx
.
base
.
system
.
param
.
service
.
ParamService
;
import
com
.
mortals
.
xhx
.
base
.
system
.
param
.
service
.
ParamService
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMapping
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMapping
;
...
...
This diff is collapsed.
Click to expand it.
pom.xml
View file @
d7a0d715
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<parent>
<parent>
<groupId>
com.mortals
</groupId>
<groupId>
com.mortals
</groupId>
<artifactId>
mortals-common
</artifactId>
<artifactId>
mortals-common
</artifactId>
<version>
1.1.
4
-SNAPSHOT
</version>
<version>
1.1.
5
-SNAPSHOT
</version>
</parent>
</parent>
<groupId>
com.mortals.xhx
</groupId>
<groupId>
com.mortals.xhx
</groupId>
<artifactId>
appbuild-platform
</artifactId>
<artifactId>
appbuild-platform
</artifactId>
...
@@ -115,6 +115,7 @@
...
@@ -115,6 +115,7 @@
</dependencies>
</dependencies>
<build>
<build>
<!--
<resources>
<resources>
<resource>
<resource>
<directory>src/main/resources</directory>
<directory>src/main/resources</directory>
...
@@ -124,6 +125,7 @@
...
@@ -124,6 +125,7 @@
<filtering>true</filtering>
<filtering>true</filtering>
</resource>
</resource>
</resources>
</resources>
-->
<plugins>
<plugins>
<plugin>
<plugin>
...
...
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