提交 40291e49 authored 作者: ww1xhqc's avatar ww1xhqc

[数据模型] 添加根据表名得到列和引用

上级 092051e0
......@@ -6,11 +6,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.tykj.base.result.ApiException;
import com.tykj.model_layer.dao.ColumnInfoDao;
import com.tykj.model_layer.dao.QuoteDao;
import com.tykj.model_layer.dao.TableInfoDao;
import com.tykj.model_layer.entity.ColumnInfo;
import com.tykj.model_layer.entity.Quote;
import com.tykj.model_layer.entity.TableInfo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -30,6 +33,8 @@ public class ModelHelper {
@Autowired
private ColumnInfoDao columnInfoDao;
@Autowired
private QuoteDao quoteDao;
/**
* 获取指定数据模型的json格式数据示例
......@@ -58,4 +63,20 @@ public class ModelHelper {
throw new ApiException("json转换时出现异常");
}
}
public Map<String, Object> getQuoteList(String tableName) {
Map<String, Object> map = new HashMap<>();
TableInfo byModelName = tableInfoDao.findByModelName(tableName);
List<ColumnInfo> allByDbId = columnInfoDao.findAllByDbId(byModelName.getId());
Map<String, Object> map1 = new HashMap<>();
for (ColumnInfo columnInfo : allByDbId) {
List<Quote> quoteList = quoteDao.findAllByColumnId(columnInfo.getId());
map1.put(columnInfo.getFieldName(), quoteList);
}
map.put(byModelName.getModelName(), map1);
return map;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论