|
|
@ -1,10 +1,12 @@
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.ModevType;
|
|
|
|
import com.xydl.cac.entity.NiecPoint;
|
|
|
|
import com.xydl.cac.entity.NiecPoint;
|
|
|
|
import com.xydl.cac.entity.NiecSensor;
|
|
|
|
import com.xydl.cac.entity.NiecSensor;
|
|
|
|
import com.xydl.cac.model.ColumnModel;
|
|
|
|
import com.xydl.cac.model.ColumnModel;
|
|
|
|
import com.xydl.cac.model.ConditionModel;
|
|
|
|
import com.xydl.cac.model.ConditionModel;
|
|
|
|
import com.xydl.cac.model.OnePage;
|
|
|
|
import com.xydl.cac.model.OnePage;
|
|
|
|
|
|
|
|
import com.xydl.cac.repository.ModevTypeRepository;
|
|
|
|
import com.xydl.cac.service.DataService;
|
|
|
|
import com.xydl.cac.service.DataService;
|
|
|
|
import com.xydl.cac.util.DateUtil;
|
|
|
|
import com.xydl.cac.util.DateUtil;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@ -28,15 +30,26 @@ public class DataServiceImpl implements DataService {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
ModevTypeRepository modevTypeRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<String> getDataTables() throws Exception {
|
|
|
|
public List<ColumnModel> getDataTables() throws Exception {
|
|
|
|
List<String> tables = new ArrayList<>();
|
|
|
|
List<ModevType> typeList = modevTypeRepository.findAll();
|
|
|
|
|
|
|
|
List<ColumnModel> tables = new ArrayList<>();
|
|
|
|
String sql = "SHOW TABLES";
|
|
|
|
String sql = "SHOW TABLES";
|
|
|
|
List<String> list = jdbcTemplate.queryForList(sql, String.class);
|
|
|
|
List<String> list = jdbcTemplate.queryForList(sql, String.class);
|
|
|
|
for (String table : list) {
|
|
|
|
for (String name : list) {
|
|
|
|
if (table.startsWith("data_")) {
|
|
|
|
if (name.startsWith("data_")) {
|
|
|
|
tables.add(table);
|
|
|
|
ColumnModel item = new ColumnModel();
|
|
|
|
|
|
|
|
item.setName(name);
|
|
|
|
|
|
|
|
for (ModevType type : typeList) {
|
|
|
|
|
|
|
|
if (name.equals(type.getTablename())) {
|
|
|
|
|
|
|
|
item.setComment(type.getMc());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tables.add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return tables;
|
|
|
|
return tables;
|
|
|
|