|
|
|
@ -13,6 +13,7 @@ import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class DataEaseModel {
|
|
|
|
@ -344,20 +345,17 @@ public class DataEaseModel {
|
|
|
|
|
* @param area_name
|
|
|
|
|
* @throws IOException
|
|
|
|
|
*/
|
|
|
|
|
public void exportExcel(int identity_id, String tableName, String dataSetName, String exportPath, String area_name) throws IOException {
|
|
|
|
|
public String exportExcel(int identity_id, String tableName, String dataSetName, String exportPath, String area_name) throws IOException {
|
|
|
|
|
//对此表中的数据进行直接导出EXCEL
|
|
|
|
|
String sql = "select * from `" + tableName + "`";
|
|
|
|
|
if (identity_id > 1) {
|
|
|
|
|
sql = sql + "where `行政区划`='" + area_name + "'";
|
|
|
|
|
}
|
|
|
|
|
List<Record> tableData = Db.use(DataEaseModel.DB_NAME).find(sql);
|
|
|
|
|
String excelFileName = "【" + area_name + "】" + dataSetName + ".xlsx";
|
|
|
|
|
String excelFileName = UUID.randomUUID().toString().toUpperCase() + ".xlsx";
|
|
|
|
|
String filePath = exportPath + excelFileName;
|
|
|
|
|
if (new File(filePath).exists()) {
|
|
|
|
|
//删除
|
|
|
|
|
new File(filePath).delete();
|
|
|
|
|
}
|
|
|
|
|
//导出
|
|
|
|
|
ExcelCommonUtil.writeExcel(tableData, filePath, true);
|
|
|
|
|
return excelFileName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|