标签:io ar java for sp 数据 on bs ad
public List<DatasetColumn> queryDatasetColumns(String datasetId) { if(StringUtil.isEmpty(datasetId)) { return new ArrayList<DatasetColumn>(); } DatasetDefine dataSet = this.findById(DatasetDefine.class, datasetId); String sql = "select * from (" + dataSet.getSql() + ") where 1=0"; List<DatasetColumn> list = getJdbcTemplate().query(sql, new ResultSetExtractor<List<DatasetColumn>>() { @Override public List<DatasetColumn> extractData(ResultSet rs) throws SQLException, DataAccessException { ResultSetMetaData metaData = rs.getMetaData(); int count = metaData.getColumnCount(); List<DatasetColumn> l = new ArrayList<DatasetColumn>(); for (int i = 0; i < count; i++) { String fieldName = metaData.getColumnName(i + 1).toLowerCase(); // int type = metaData.getColumnType(i + 1); String typeName = metaData.getColumnTypeName(i + 1).toLowerCase(); l.add(new DatasetColumn(fieldName, typeName)); } return l; } }); return list; }
标签:io ar java for sp 数据 on bs ad
原文地址:http://my.oschina.net/darkness/blog/339107