main
黄海 9 months ago
commit ce2695a177

@ -81,9 +81,9 @@
cols: [[ cols: [[
{ title: '序号', align: 'center', width: "5%", type: 'numbers' }, { title: '序号', align: 'center', width: "5%", type: 'numbers' },
{ title: '分类', field: 'parent_name', align: 'center' }, { title: '分类', field: 'parent_name', align: 'center' },
{ title: '数据集', field: 'dataset_name', align: 'center'}, { title: '数据集', field: 'dataset_name', align: 'center' },
{ title: '表名', field: 'table_name', align: 'center'}, // { title: '表名', field: 'table_name', align: 'center' },
{ title: '操作', toolbar: '#table-bar', align: 'center'} { title: '操作', toolbar: '#table-bar', align: 'center' }
]], ]],
skin: 'line', skin: 'line',
defaultToolbar: [] defaultToolbar: []

@ -167,8 +167,6 @@
layer.msg("保存成功!", { layer.msg("保存成功!", {
icon: 1, icon: 1,
time: 1300 time: 1300
}, function () {
history.back();
}); });
} else { } else {
layer.msg(result.message, { layer.msg(result.message, {
@ -180,14 +178,12 @@
}); });
}); });
$("#back").click(function () { $("#back").click(function () {
history.back(); history.back();
}); });
function GetQueryString(name, istop) { function GetQueryString(name, istop) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg); var r = window.location.search.substr(1).match(reg);

@ -60,7 +60,7 @@ public class GenerateExcel {
for (int i = 1; i <= columnCount; i++) { for (int i = 1; i <= columnCount; i++) {
Cell cell = row.createCell(i - 1); Cell cell = row.createCell(i - 1);
Object value = resultSet.getObject(i); Object value = resultSet.getObject(i);
cell.setCellValue(value.toString()); if (value != null) cell.setCellValue(value.toString());
cell.setCellStyle(dataStyle); cell.setCellStyle(dataStyle);
} }
} }
@ -108,13 +108,13 @@ public class GenerateExcel {
List<String> files = getFiles(directoryPath); List<String> files = getFiles(directoryPath);
int cnt = 0;//有问题的查询个数 int cnt = 0;//有问题的查询个数
for (String file : files) { for (String file : files) {
if(!file.contains(".sql")) continue; if (!file.contains(".sql")) continue;
String sql = FileUtil.readUtf8String(file); String sql = FileUtil.readUtf8String(file);
try { try {
String excelFilePath = file.replace(".sql", ".xlsx"); String excelFilePath = file.replace(".sql", ".xlsx");
ResultSet rs = statement.executeQuery(sql); ResultSet rs = statement.executeQuery(sql);
//如果数据集是空的,返回 //如果数据集是空的,返回
if(!rs.isBeforeFirst()) continue; if (!rs.isBeforeFirst()) continue;
//否则导出 //否则导出
cnt++; cnt++;
exportResultSetToExcel(rs, excelFilePath); exportResultSetToExcel(rs, excelFilePath);

Loading…
Cancel
Save