| | |
| | | private final GenTableColumnMapper genTableColumnMapper; |
| | | private final IdentifierGenerator identifierGenerator; |
| | | |
| | | private static final String[] TABLE_IGNORE = new String[]{"sj_", "act_", "flw_", "gen_"}; |
| | | private static final String[] TABLE_IGNORE = new String[]{"sj_", "flow_", "gen_"}; |
| | | |
| | | /** |
| | | * 查询业务字段列表 |
| | |
| | | .like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(table_comment)", StringUtils.lowerCase(genTable.getTableComment())) |
| | | .between(params.get("beginTime") != null && params.get("endTime") != null, |
| | | "create_time", params.get("beginTime"), params.get("endTime")) |
| | | .orderByDesc("update_time", "create_time"); |
| | | .orderByDesc("update_time"); |
| | | return wrapper; |
| | | } |
| | | |
| | |
| | | } |
| | | // 过滤并转换表格数据 |
| | | List<GenTable> tables = tablesMap.values().stream() |
| | | .filter(x -> !startWithAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> !StringUtils.startWithAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> { |
| | | if (CollUtil.isEmpty(tableNames)) { |
| | | return true; |
| | |
| | | GenTable gen = new GenTable(); |
| | | gen.setTableName(x.getName()); |
| | | gen.setTableComment(x.getComment()); |
| | | gen.setCreateTime(x.getCreateTime()); |
| | | // postgresql的表元数据没有创建时间这个东西(好奇葩) 只能new Date代替 |
| | | gen.setCreateTime(ObjectUtil.defaultIfNull(x.getCreateTime(), new Date())); |
| | | gen.setUpdateTime(x.getUpdateTime()); |
| | | return gen; |
| | | }).sorted(Comparator.comparing(GenTable::getCreateTime).reversed()) |
| | |
| | | // 手动分页 set数据 |
| | | page.setRecords(CollUtil.page((int) page.getCurrent() - 1, (int) page.getSize(), tables)); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | public static boolean startWithAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) { |
| | | // 判断是否是以指定字符串开头 |
| | | for (CharSequence searchCharSequence : searchCharSequences) { |
| | | if (StringUtils.startsWithIgnoreCase(cs, searchCharSequence)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | List<Table<?>> tableList = tablesMap.values().stream() |
| | | .filter(x -> !startWithAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> !StringUtils.startWithAnyIgnoreCase(x.getName(), TABLE_IGNORE)) |
| | | .filter(x -> tableNameSet.contains(x.getName())).toList(); |
| | | |
| | | if (CollUtil.isEmpty(tableList)) { |
| | |
| | | String tableName = table.getTableName(); |
| | | GenUtils.initTable(table); |
| | | table.setDataName(dataName); |
| | | table.setCreateTime(new Date()); |
| | | int row = baseMapper.insert(table); |
| | | if (row > 0) { |
| | | // 保存列信息 |