Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow-core
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow-core
Commits
8a90de77
提交
8a90de77
authored
3月 10, 2021
作者:
HASEE
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
model layer 优化(2) 填补swagger文档
上级
ba353842
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
52 行增加
和
46 行删除
+52
-46
ModelController.java
.../workflowcore/model_layer/controller/ModelController.java
+52
-46
没有找到文件。
src/main/java/com/tykj/workflowcore/model_layer/controller/ModelController.java
浏览文件 @
8a90de77
package
com
.
tykj
.
workflowcore
.
model_layer
.
controller
;
import
com.tykj.workflowcore.base.result.ResultUtil
;
import
com.tykj.workflowcore.model_layer.model.ColumnInfo
;
import
com.tykj.workflowcore.model_layer.model.TableInfo
;
import
com.tykj.workflowcore.model_layer.model.TableVO
;
import
com.tykj.workflowcore.model_layer.service.ModelService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -23,21 +27,22 @@ import java.util.Map;
*/
@RestController
@RequestMapping
(
"/model"
)
@Api
(
"数据模型层接口"
)
public
class
ModelController
{
@Autowired
private
ModelService
modelService
;
@Autowired
private
ClassLoader
classLoader
;
/**
* @Author WWW
* @Description 得到所有数据库信息
* @Date 16:19 2021/3/4
* @param
* @return java.util.List<com.tykj.workflowcore.model_layer.model.TableInfo>
**/
/**
* @param
* @return java.util.List<com.tykj.workflowcore.model_layer.model.TableInfo>
* @Author WWW
* @Description 得到所有数据库信息
* @Date 16:19 2021/3/4
**/
@ApiOperation
(
"得到所有数据表信息"
)
@RequestMapping
(
"/getAllEntity"
)
public
List
<
TableInfo
>
getAllEntity
()
{
public
ResponseEntity
getAllEntity
()
{
List
<
TableInfo
>
tableInfos
=
null
;
try
{
...
...
@@ -46,62 +51,63 @@ public class ModelController {
throwables
.
printStackTrace
();
}
return
tableInfos
;
return
ResultUtil
.
success
(
tableInfos
)
;
}
/**
* @Author WWW
* @Description 根据表名得到所有字段名
* @Date 16:20 2021/3/4
* @param tableName
* @return java.util.List<com.tykj.workflowcore.model_layer.model.ColumnInfo>
**/
/**
* @param tableName
* @return java.util.List<com.tykj.workflowcore.model_layer.model.ColumnInfo>
* @Author WWW
* @Description 根据表名得到所有字段名
* @Date 16:20 2021/3/4
**/
@ApiOperation
(
"根据表名获得表所有字段"
)
@GetMapping
(
"/getAllField"
)
public
List
<
ColumnInfo
>
getFields
(
String
tableName
)
{
if
(
tableName
!=
null
&&
tableName
!=
""
)
{
return
modelService
.
showModelFields
(
tableName
);
public
ResponseEntity
getFields
(
String
tableName
)
{
if
(
tableName
!=
null
&&
tableName
!=
""
)
{
return
ResultUtil
.
failed
(
"没有表名"
);
}
return
null
;
return
ResultUtil
.
success
(
modelService
.
showModelFields
(
tableName
))
;
}
/**
* @Author WWW
* @Description 新增数据模型
* @Date 16:21 2021/3/4
* @param
* @return org.springframework.http.ResponseEntity
**/
/**
* @param
* @return org.springframework.http.ResponseEntity
* @Author WWW
* @Description 新增数据模型
* @Date 16:21 2021/3/4
**/
@ApiOperation
(
"新增数据模型"
)
@PostMapping
(
"/addModel"
)
//入参使用VO直接接收即可
//jsonStr -> TableVo
public
ResponseEntity
addModel
(
@RequestBody
TableVO
tableVO
)
throws
Exception
{
List
<
TableInfo
>
tableInfos
=
modelService
.
ListAllEntities
();
for
(
TableInfo
tableInfo
:
tableInfos
)
{
if
(
tableVO
.
getModelName
().
equals
(
tableInfo
.
getName
())){
return
new
ResponseEntity
(
HttpStatus
.
BAD_GATEWAY
);
if
(
tableVO
.
getModelName
().
equals
(
tableInfo
.
getName
()))
{
return
ResultUtil
.
failed
(
"表已经存在!"
);
}
}
modelService
.
NewTable
(
tableVO
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
ResultUtil
.
success
(
"新建成功"
);
}
/**
* @Author WWW
* @Description 对应表插入数据
* @param map
* @return int
* @Author WWW
* @Description 对应表插入数据
* map (表名,字段数据)
* @Date 16:22 2021/3/4
* @param map
* @return int
**/
* @Date 16:22 2021/3/4
**/
@ApiOperation
(
value
=
"根据表名表插入数据"
)
@PostMapping
(
"/insertValues"
)
public
int
insertValues
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
int
i
=
modelService
.
putValueByEntityName
(
map
);
return
i
;
public
ResponseEntity
insertValues
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
modelService
.
putValueByEntityName
(
map
);
return
ResultUtil
.
success
(
"数据插入成功"
)
;
}
@GetMapping
(
"/getPackge"
)
public
String
testPack
(){
String
name
=
this
.
getClass
().
getPackage
().
getName
();
return
name
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论