获取列信息的几种方式

最后更新:2024-05-16 05:30:02 | 状态:未完成
// 1直接获取元数据
//sql server 列元数据中不返回表名,所以查不到注释
LinkedHashMap<String,Column> columns = service.metadata("SELECT ID AS USER_ID, ID AS ID, CODE AS USER_CODE FROM CRM_USER WHERE ID = :ID ");
for(Column column:columns.values()){
	System.out.println(column);
}
//2.获取表结构的同时获取列数据
Table tab = service.metadata().table("CRM_USER");
columns = tab.getColumns();
for(Column column:columns.values()){
	System.out.println(column);
}
//3.通过查询结果获取元数据
DataSet set = service.querys("SELECT F.ID AS USER_ID, M.ID AS ID, M.CODE AS USER_CODE FROM CRM_USER AS M LEFT JOIN CRM_USER AS F ON M.ID = F.ID");
columns = set.getMetadatas();
for(Column column:columns.values()){
	System.out.println(column);
}
首页 最近更新 搜索 提交 回复