| | |
| | | * |
| | | * @author Lion Li |
| | | */ |
| | | // @DS("#header.datasource") |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Service |
| | |
| | | * 查询据库列表 |
| | | * |
| | | * @param tableNames 表名称组 |
| | | * @param dataName |
| | | * @param dataName 数据源名称 |
| | | * @return 数据库表集合 |
| | | */ |
| | | @DS("#dataName") |
| | |
| | | * 修改业务 |
| | | * |
| | | * @param genTable 业务信息 |
| | | * @return 结果 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | |
| | | * 删除业务对象 |
| | | * |
| | | * @param tableIds 需要删除的数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void deleteGenTableByIds(Long[] tableIds) { |
| | | List<Long> ids = Arrays.asList(tableIds); |
| | | baseMapper.deleteBatchIds(ids); |
| | | baseMapper.deleteByIds(ids); |
| | | genTableColumnMapper.delete(new LambdaQueryWrapper<GenTableColumn>().in(GenTableColumn::getTableId, ids)); |
| | | } |
| | | |
| | |
| | | * 导入表结构 |
| | | * |
| | | * @param tableList 导入表列表 |
| | | * @param dataName |
| | | * @param dataName 数据源名称 |
| | | */ |
| | | @DSTransactional |
| | | @Override |
| | | public void importGenTable(List<GenTable> tableList, String dataName) { |
| | | String operName = LoginHelper.getUsername(); |
| | | Long operId = LoginHelper.getUserId(); |
| | | try { |
| | | for (GenTable table : tableList) { |
| | | String tableName = table.getTableName(); |
| | | GenUtils.initTable(table, operName); |
| | | GenUtils.initTable(table, operId); |
| | | table.setDataName(dataName); |
| | | int row = baseMapper.insert(table); |
| | | if (row > 0) { |
| | |
| | | if (CollUtil.isNotEmpty(delColumns)) { |
| | | List<Long> ids = StreamUtils.toList(delColumns, GenTableColumn::getColumnId); |
| | | if (CollUtil.isNotEmpty(ids)) { |
| | | genTableColumnMapper.deleteBatchIds(ids); |
| | | genTableColumnMapper.deleteByIds(ids); |
| | | } |
| | | } |
| | | } |