未验证 提交 2b316d16 编写于 作者: 查尔斯-BUG万象集's avatar 查尔斯-BUG万象集 提交者: GitHub

Merge pull request #12 from Bull-BCLS/dev

fix: 修复查询数据库表按修改时间排序时,修改时间为空导致的 NPE 问题
......@@ -19,10 +19,7 @@ package top.charles7c.cnadmin.tool.service.impl;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -91,7 +88,9 @@ public class GeneratorServiceImpl implements GeneratorService {
}
tableList.removeIf(table -> StrUtil.equalsAny(table.getTableName(), generatorProperties.getExcludeTables()));
CollUtil.sort(tableList,
Comparator.comparing(Table::getCreateTime).thenComparing(Table::getUpdateTime).reversed());
Comparator.comparing(Table::getCreateTime)
.thenComparing(table -> Optional.ofNullable(table.getUpdateTime()).orElse(table.getCreateTime()))
.reversed());
List<TableVO> tableVOList = BeanUtil.copyToList(tableList, TableVO.class);
PageDataVO<TableVO> pageDataVO = PageDataVO.build(pageQuery.getPage(), pageQuery.getSize(), tableVOList);
for (TableVO tableVO : pageDataVO.getList()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册