Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
2
议题
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow
Commits
c8ac74d4
提交
c8ac74d4
authored
4月 06, 2021
作者:
ww1xhqc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[数据模型] 返回聚合对象json。
上级
0b940794
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
33 行增加
和
7 行删除
+33
-7
AggregationController.java
...lowcore/model_layer/controller/AggregationController.java
+5
-1
AggregationImpl.java
...orkflowcore/model_layer/service/impl/AggregationImpl.java
+4
-3
WorkflowCoreApplicationTests.java
...a/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
+24
-3
没有找到文件。
src/main/java/com/tykj/workflowcore/model_layer/controller/AggregationController.java
浏览文件 @
c8ac74d4
package
com
.
tykj
.
workflowcore
.
model_layer
.
controller
;
import
com.tykj.workflowcore.base.result.ResultObj
;
import
com.tykj.workflowcore.base.result.ResultUtil
;
import
com.tykj.workflowcore.model_layer.entity.vo.AggregationVO
;
import
com.tykj.workflowcore.model_layer.service.AggregationService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -22,7 +25,8 @@ public class AggregationController {
AggregationService
aggregationService
;
@PostMapping
(
"aggregation/add"
)
public
void
add
(
@RequestBody
AggregationVO
aggregationVO
)
{
public
ResponseEntity
add
(
@RequestBody
AggregationVO
aggregationVO
)
{
aggregationService
.
addAggregation
(
aggregationVO
);
return
ResultUtil
.
success
(
""
,
"保存成功!"
);
}
}
src/main/java/com/tykj/workflowcore/model_layer/service/impl/AggregationImpl.java
浏览文件 @
c8ac74d4
package
com
.
tykj
.
workflowcore
.
model_layer
.
service
.
impl
;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.model_layer.dao.AggregationRelationshipDao
;
import
com.tykj.workflowcore.model_layer.dao.AggregationDao
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoDao
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoExDao
;
...
...
@@ -35,7 +36,7 @@ public class AggregationImpl implements AggregationService {
@Autowired
TableInfoExDao
tableInfoExDao
;
@Autowired
Aggregation
Relationship
Dao
aggregationRelationshipDao
;
AggregationDao
aggregationRelationshipDao
;
@Override
public
void
addAggregation
(
AggregationVO
aggregationVO
)
{
...
...
@@ -67,7 +68,7 @@ public class AggregationImpl implements AggregationService {
}
if
(
aggregationRelationship
.
getRelationship
().
equals
(
AggregationType
.
ONE_TO_MANY
)){
//如果是一对多需要 为 aggregationRelationship 生成连接的KEY
String
mainTableConnectionKey
=
sideTableById
.
get
().
getModelName
()
+
"_list"
;
String
mainTableConnectionKey
=
sideTableById
.
get
().
getModelName
();
Document
document
=
AggregationUtil
.
addOneToMany
(
sideTableById
.
get
().
getModelName
(),
mainTableConnectionKey
,
aggregationRelationship
.
getSideTableConnectionKey
(),
mainTableDocument
);
tableInfoEx
.
setXml
(
document
.
asXML
());
}
...
...
src/test/java/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
→
src/
main/
test/java/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
浏览文件 @
c8ac74d4
package
com
.
tykj
.
workflowcore
;
import
com.alibaba.fastjson.JSON
;
import
com.tykj.workflowcore.model_layer.controller.ModelController
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoDao
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoExDao
;
import
com.tykj.workflowcore.model_layer.entity.TableInfo
;
import
com.tykj.workflowcore.model_layer.entity.vo.TableAndColumnInfoVO
;
import
com.tykj.workflowcore.model_layer.myEnum.ModelType
;
import
com.tykj.workflowcore.model_layer.service.ModelService
;
import
com.tykj.workflowcore.model_layer.service.impl.ModelHelper
;
import
com.tykj.workflowcore.model_layer.utils.AggregationUtil
;
import
com.tykj.workflowcore.model_layer.utils.SessionUtil
;
import
org.aspectj.lang.annotation.Before
;
...
...
@@ -23,6 +26,7 @@ import org.hibernate.query.NativeQuery;
import
org.hibernate.query.Query
;
import
org.hibernate.tool.hbm2ddl.SchemaUpdate
;
import
org.hibernate.tool.schema.TargetType
;
import
org.json.JSONObject
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
;
...
...
@@ -77,6 +81,12 @@ class WorkflowCoreApplicationTests {
@Autowired
SessionUtil
sessionUtil
;
@Autowired
ModelHelper
modelHelper
;
@Autowired
TableInfoExDao
tableInfoExDao
;
@Before
(
""
)
public
void
setUp
()
{
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
modelController
).
build
();
...
...
@@ -314,7 +324,7 @@ class WorkflowCoreApplicationTests {
carMap
.
put
(
"card"
,
1
);
arrayList
.
add
(
carMap
);
SessionImpl
news
=
(
SessionImpl
)
session
;
SessionImpl
news
=
(
SessionImpl
)
session
;
hashMap
.
put
(
"carList"
,
arrayList
);
...
...
@@ -415,7 +425,7 @@ class WorkflowCoreApplicationTests {
//创建解析器
Document
document
=
DocumentHelper
.
parseText
(
xml
);
Element
classMapping
=
document
.
getRootElement
().
elements
().
get
(
0
);
String
set
=
" <set name=\"teacher\" table=\"stu_teacher_ref\">\n"
+
String
set
=
" <set name=\"teacher\" table=\"stu_teacher_ref\">\n"
+
" \t<key column=\"student_id\"/>\n"
+
" \t<many-to-many class=\"teacher\" column=\"teacher_id\"/>\n"
+
" </set>\n"
;
...
...
@@ -443,7 +453,7 @@ class WorkflowCoreApplicationTests {
}
}
// @Test
// @Test
// public void tsetCreateXml1(){
// TableInfo wife = tableInfoDao.findByModelName("car");
//// System.out.println(wife);
...
...
@@ -466,5 +476,16 @@ class WorkflowCoreApplicationTests {
// String s = AggregationUtil.addManyToMany("teacher", "stus", xml);
// System.out.println(s);
// }
@Test
public
void
testJSON
()
{
String
xml
=
tableInfoExDao
.
findById
(
3
).
get
().
getXml
();
sessionUtil
.
addXml
(
xml
);
Session
session
=
sessionUtil
.
getSession
();
List
list
=
session
.
createQuery
(
"from people_car"
).
list
();
System
.
out
.
println
(
list
);
String
jsonExample
=
modelHelper
.
getJsonExample
(
2
);
System
.
out
.
println
(
jsonExample
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论