|
|
|
@ -2,12 +2,14 @@ package com.xydl.cac.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.NiecPoint;
|
|
|
|
|
import com.xydl.cac.entity.NiecSensor;
|
|
|
|
|
import com.xydl.cac.model.ColumnModel;
|
|
|
|
|
import com.xydl.cac.model.ConditionModel;
|
|
|
|
|
import com.xydl.cac.model.OnePage;
|
|
|
|
|
import com.xydl.cac.service.DataService;
|
|
|
|
|
import com.xydl.cac.util.DateUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -41,23 +43,25 @@ public class DataServiceImpl implements DataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getDataTableColumns(String tableName) throws Exception {
|
|
|
|
|
public List<ColumnModel> getDataTableColumns(String tableName) throws Exception {
|
|
|
|
|
if (StringUtils.isBlank(schema)) {
|
|
|
|
|
this.getDatabase();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> cols = new ArrayList<>();
|
|
|
|
|
String sql = "SELECT COLUMN_NAME FROM information_schema.columns WHERE TABLE_NAME='" + tableName + "' AND TABLE_SCHEMA='" + schema + "'";
|
|
|
|
|
List<String> list = jdbcTemplate.queryForList(sql, String.class);
|
|
|
|
|
for (String col : list) {
|
|
|
|
|
List<ColumnModel> result = new ArrayList<>();
|
|
|
|
|
String sql = "SELECT COLUMN_NAME name, COLUMN_COMMENT comment FROM information_schema.columns WHERE TABLE_NAME='"
|
|
|
|
|
+ tableName + "' AND TABLE_SCHEMA='" + schema + "'";
|
|
|
|
|
List<ColumnModel> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ColumnModel.class));
|
|
|
|
|
for (ColumnModel item : list) {
|
|
|
|
|
String col = item.getName();
|
|
|
|
|
if (!col.equals("id") && !col.equals("eqmid")
|
|
|
|
|
&& !col.equals("acquisitionTime") && !col.equals("d_time")
|
|
|
|
|
&& !col.equals("create_time") && !col.equals("update_time")
|
|
|
|
|
&& !col.equals("isupload")) {
|
|
|
|
|
cols.add(col);
|
|
|
|
|
result.add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cols;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void getDatabase() {
|
|
|
|
|