提交 0b940794 authored 作者: 黄承天's avatar 黄承天

[数据模型]以副表名为字段名

上级 9c8fea85
......@@ -9,6 +9,7 @@ import com.tykj.workflowcore.model_layer.dao.TableInfoDao;
import com.tykj.workflowcore.model_layer.dao.TableInfoExDao;
import com.tykj.workflowcore.model_layer.entity.Aggregation;
import com.tykj.workflowcore.model_layer.entity.ColumnInfo;
import com.tykj.workflowcore.model_layer.entity.TableInfo;
import com.tykj.workflowcore.model_layer.entity.TableInfoEx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -47,17 +48,19 @@ public class ModelHelper {
for (ColumnInfo subColumnInfo : subColumnInfos) {
subResult.put(subColumnInfo.getFieldName(), null);
}
String connectionTableName = aggregation.getSideTableConnectionKey();
String subTableName = tableInfoDao.findById(aggregation.getSideTableId())
.orElseThrow(() -> new RuntimeException(format("未找到该id的数据:%s", aggregation.getSideTableId())))
.getModelName();
Integer relationshipType = aggregation.getRelationship();
switch (relationshipType) {
case 0:
result.put(connectionTableName, subResult);
result.put(subTableName, subResult);
break;
case 1:
case 2:
List<Map<String, Object>> subResults = new ArrayList<>();
subResults.add(subResult);
result.put(connectionTableName, subResults);
result.put(subTableName, subResults);
break;
default:
throw new RuntimeException(format("未识别的聚合类型:%s", relationshipType));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论