@Override
    public List<DatabaseTableRespVO> getDatabaseTableList(Long dataSourceConfigId, String name, String comment) {
        List<TableInfo> tables = databaseTableService.getTableList(dataSourceConfigId, name, comment);
        // 移除在 Codegen 中，已经存在的
        Set<String> existsTables = convertSet(
                codegenTableMapper.selectListByDataSourceConfigId(dataSourceConfigId), CodegenTableDO::getTableName);
        tables.removeIf(table -> existsTables.contains(table.getName()));
        return BeanUtils.toBean(tables, DatabaseTableRespVO.class);
    }
@Test
    public void testGetDatabaseTableList() {
        // 准备参数
        Long dataSourceConfigId = randomLongId();
        String name = randomString();
        String comment = randomString();
        // mock 方法
        TableInfo tableInfo01 = mock(TableInfo.class);
        when(tableInfo01.getName()).thenReturn("t_yunai");
        when(tableInfo01.getComment()).thenReturn("芋艿");
        TableInfo tableInfo02 = mock(TableInfo.class);
        when(tableInfo02.getName()).thenReturn("t_yunai_02");
        when(tableInfo02.getComment()).thenReturn("芋艿_02");
        when(databaseTableService.getTableList(eq(dataSourceConfigId), eq(name), eq(comment)))
                .thenReturn(ListUtil.toList(tableInfo01, tableInfo02));
        // mock 数据
        CodegenTableDO tableDO = randomPojo(CodegenTableDO.class,
                o -> o.setScene(CodegenSceneEnum.ADMIN.getScene())
                        .setTableName("t_yunai_02")
                        .setDataSourceConfigId(dataSourceConfigId));
        codegenTableMapper.insert(tableDO);

        // 调用
        List<DatabaseTableRespVO> result = codegenService.getDatabaseTableList(dataSourceConfigId, name, comment);
        // 断言
        assertEquals(1, result.size());
        assertEquals("t_yunai", result.get(0).getName());
        assertEquals("芋艿", result.get(0).getComment());
    }