|
@@ -83,7 +83,7 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
String[] whereTerm = tableSql.getTableCondition().split("AND");
|
|
|
List<String> test = Arrays.asList(whereTerm);
|
|
|
// 拼接条件
|
|
|
- conditions.forEach((key, val) -> {
|
|
|
+ if (conditions != null) conditions.forEach((key, val) -> {
|
|
|
// 把前端回传的查询参数值名称驼峰转下划线命名,进行筛选是否存在匹配项
|
|
|
String sqlWhere = test.stream().filter(item -> item.contains(toUnderScoreCase(key))).findAny().get();
|
|
|
if (sqlWhere.indexOf("#{timeframe}") != -1) { // 时间范围查询拼接
|
|
@@ -103,21 +103,21 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void export(HttpServletResponse response, String tableName,String sqlKey) throws Exception{
|
|
|
+ public void export(HttpServletResponse response, String tableName, String sqlKey) throws Exception {
|
|
|
//查询标题信息
|
|
|
TableSql tableSql = tableSqlMapper.selectTableSqlByTSqlKey(sqlKey);
|
|
|
//查询列表信息
|
|
|
List<CommonEntity> commonEntities = commonMapper.selectList(tableName, new HashMap<>());
|
|
|
|
|
|
//获取列表标题和字段
|
|
|
- Map<String,String> map = (Map)JSONObject.parseObject(tableSql.getTableExportField());
|
|
|
+ Map<String, String> map = (Map) JSONObject.parseObject(tableSql.getTableExportField());
|
|
|
// 创建Excel文档
|
|
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
|
XSSFSheet sheet = workbook.createSheet("Sheet1");
|
|
|
// 创建表头
|
|
|
XSSFRow header = sheet.createRow(0);
|
|
|
int i = 0;
|
|
|
- for (Map.Entry<String,String> entry : map.entrySet()){
|
|
|
+ for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
header.createCell(i).setCellValue(entry.getValue());
|
|
|
i++;
|
|
|
}
|