diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ff1a94d..e12957a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 3.0.14 + +`2023-11-20` + +**Changelog** + +- 🐞【Fixed】Team paging problem +- 🐞【Fixed】Oracle service name bug +- 🐞【Fixed】Oracle datatype error +- 🐞【Fixed】Fixed an issue where MySQL changed table structure without displaying comments. +- ⚡️【Optimize】Support database or schema +- 【Developer】Friends don't worry, the company has some things recently, and is preparing 3.1.0, be patient + ## 3.0.13 `2023-11-15` diff --git a/CHANGELOG_CN.md b/CHANGELOG_CN.md index 8a452fc3..7f2d67ad 100644 --- a/CHANGELOG_CN.md +++ b/CHANGELOG_CN.md @@ -1,3 +1,15 @@ +## 3.0.14 + +`2023-11-20` + +**更新日志** + +- 🐞【修复】团队分页问题 +- 🐞【修复】Oracle服务名称错误 +- 🐞【修复】Oracle数据类型错误 +- 🐞【修复】修复MySQL修改表结构,不回显注释的问题。 +- ⚡️【优化】支持数据库或模式 +- 【开发者】友友们不要着急呀,最近公司有些事情,并且在准备3.1.0,耐心等待哦 ## 3.0.13 `2023-11-15` diff --git a/README.md b/README.md index e5adcc36..69060e0a 100644 --- a/README.md +++ b/README.md @@ -179,12 +179,18 @@ $ npm run build:web:prod / cp -r dist ../chat2db-server/chat2db-server-start/src ## ☎️ Contact Us -Please star and fork on GitHub before joining the group. -Follow our WeChat public account. +### WeChat - Click and join discord server +### Discord + +[![Discord](https://img.shields.io/badge/-Join%20us%20on%20Discord-%237289DA.svg?style=flat&logo=discord&logoColor=white)](https://discord.gg/N6JscF7q) + +## LICENSE + +The primary license used by this software is the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), supplemented by the [Chat2DB License](./Chat2DB_LICENSE). + ## ❤️ Acknowledgements diff --git a/chat2db-client/src/pages/main/team/datasource-management/index.tsx b/chat2db-client/src/pages/main/team/datasource-management/index.tsx index f34acffc..b78f5733 100644 --- a/chat2db-client/src/pages/main/team/datasource-management/index.tsx +++ b/chat2db-client/src/pages/main/team/datasource-management/index.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { Button, Input, Table, Popconfirm, message, Drawer } from 'antd'; import { SearchOutlined, PlusOutlined } from '@ant-design/icons'; -import ConnectionServer from '@/service/connection' +import ConnectionServer from '@/service/connection'; import { createDataSource, deleteDataSource, getDataSourceList, updateDataSource } from '@/service/team'; import { IConnectionDetails } from '@/typings'; import { AffiliationType, IDataSourceVO } from '@/typings/team'; @@ -24,12 +24,12 @@ function DataSourceManagement() { // pageSizeOptions: ['10', '20', '30', '40'], }); const [showCreateConnection, setShowCreateConnection] = useState(false) - const connectionInfo = useRef(null); + const connectionInfo = useRef(null); const [drawerInfo, setDrawerInfo] = useState<{ open: boolean; type: AffiliationType; id?: number }>({ open: false, - type: AffiliationType['DATASOURCE_USER/TEAM'] - }) + type: AffiliationType['DATASOURCE_USER/TEAM'], + }); const columns = useMemo( () => [ @@ -49,18 +49,24 @@ function DataSourceManagement() { width: 300, render: (_: any, record: IDataSourceVO) => ( <> - - { const { searchKey, current: pageNo, pageSize } = pagination; - let res = await getDataSourceList({ searchKey, pageNo, pageSize }); + const res = await getDataSourceList({ searchKey, pageNo, pageSize }); if (res) { setDataSource(res?.data ?? []); + setPagination({ + ...pagination, + total: res?.total ?? 0, + } as any); } }; @@ -100,7 +110,6 @@ function DataSourceManagement() { }; const handleTableChange = (p: any) => { - setPagination({ ...pagination, ...p, @@ -110,7 +119,7 @@ function DataSourceManagement() { const handleAddDataSource = () => { connectionInfo.current = null; setShowCreateConnection(true); - } + }; const handleEdit = async (record: IDataSourceVO) => { const { id } = record; @@ -118,14 +127,14 @@ function DataSourceManagement() { return; } - let detail = await ConnectionServer.getDetails({ id }) + const detail = await ConnectionServer.getDetails({ id }); connectionInfo.current = detail; - setShowCreateConnection(true) - } + setShowCreateConnection(true); + }; const handleDelete = async (id?: number) => { if (isNumber(id)) { - await deleteDataSource({ id }) + await deleteDataSource({ id }); message.success(i18n('common.text.successfullyDelete')); queryDataSourceList(); } @@ -140,14 +149,12 @@ function DataSourceManagement() { const isUpdate = isValid(connectionInfo?.current?.id); const requestApi = isUpdate ? updateDataSource : createDataSource; try { - await requestApi({ ...connectionInfo.current }) - message.success(isUpdate ? i18n('common.tips.updateSuccess') : i18n('common.tips.createSuccess')) - setShowCreateConnection(false) - queryDataSourceList() - } catch { - - } - } + await requestApi({ ...connectionInfo.current }); + message.success(isUpdate ? i18n('common.tips.updateSuccess') : i18n('common.tips.createSuccess')); + setShowCreateConnection(false); + queryDataSourceList(); + } catch {} + }; return (
@@ -163,6 +170,11 @@ function DataSourceManagement() {
{ setDrawerInfo({ ...drawerInfo, - open: false - }) + open: false, + }); }} /> - + ); } diff --git a/chat2db-client/src/pages/main/team/index.less b/chat2db-client/src/pages/main/team/index.less index 3f464307..f6b05a87 100644 --- a/chat2db-client/src/pages/main/team/index.less +++ b/chat2db-client/src/pages/main/team/index.less @@ -1,4 +1,9 @@ .teamWrapper { height: 100vh; - padding: 24px 36px; + padding: 14px 16px; + box-sizing: border-box; +} + +.teamTabsBox{ + height: 100%; } diff --git a/chat2db-client/src/pages/main/team/index.tsx b/chat2db-client/src/pages/main/team/index.tsx index 84b94d17..9ba1c4f9 100644 --- a/chat2db-client/src/pages/main/team/index.tsx +++ b/chat2db-client/src/pages/main/team/index.tsx @@ -33,6 +33,7 @@ const Team = () => { return (
setActiveKey(activeKey)} items={tabList.map((tab, index) => { diff --git a/chat2db-client/src/pages/main/team/team-management/index.tsx b/chat2db-client/src/pages/main/team/team-management/index.tsx index 8db55191..bfe6bf1d 100644 --- a/chat2db-client/src/pages/main/team/team-management/index.tsx +++ b/chat2db-client/src/pages/main/team/team-management/index.tsx @@ -17,7 +17,7 @@ const requireRule = { required: true, message: i18n('common.form.error.required' function TeamManagement() { const [form] = Form.useForm(); - const [loadding, setLoading] = useState(false) + const [loadding, setLoading] = useState(false); const [dataSource, setDataSource] = useState([]); const [pagination, setPagination] = useState({ searchKey: '', @@ -66,7 +66,7 @@ function TeamManagement() { ...drawerInfo, open: true, teamId: record.id, - type: AffiliationType.TEAM_USER + type: AffiliationType.TEAM_USER, }); }} > @@ -79,9 +79,10 @@ function TeamManagement() { ...drawerInfo, open: true, teamId: record.id, - type: AffiliationType.TEAM_DATASOURCE + type: AffiliationType.TEAM_DATASOURCE, }); - }}> + }} + > {i18n('team.action.affiliation.datasource')}
{ form.scrollToField(errorInfo.errorFields[0].name); form.setFields(errorInfo.errorFields); - }) + }); }} onCancel={() => { form.resetFields(); diff --git a/chat2db-client/src/pages/main/team/user-management/index.tsx b/chat2db-client/src/pages/main/team/user-management/index.tsx index 967fbc12..b827290d 100644 --- a/chat2db-client/src/pages/main/team/user-management/index.tsx +++ b/chat2db-client/src/pages/main/team/user-management/index.tsx @@ -116,6 +116,10 @@ function UserManagement() { let res = await getUserManagementList({ searchKey, pageNo, pageSize }); if (res) { setDataSource(res?.data ?? []); + setPagination({ + ...pagination, + total: res?.total ?? 0, + } as any); } }; @@ -178,6 +182,11 @@ function UserManagement() {
> headerConsumer, - Consumer> rowConsumer,ValueHandler valueHandler) { - executeSql(connection, sql, headerConsumer, rowConsumer, true,valueHandler); + Consumer> rowConsumer, ValueHandler valueHandler) { + executeSql(connection, sql, headerConsumer, rowConsumer, true, valueHandler); } public void executeSql(Connection connection, String sql, Consumer> headerConsumer, - Consumer> rowConsumer, boolean limitSize,ValueHandler valueHandler) { + Consumer> rowConsumer, boolean limitSize, ValueHandler valueHandler) { Assert.notNull(sql, "SQL must not be null"); log.info("execute:{}", sql); try (Statement stmt = connection.createStatement();) { @@ -147,8 +143,8 @@ public class SQLExecutor { * @return * @throws SQLException */ - public ExecuteResult execute(final String sql, Connection connection,ValueHandler valueHandler) throws SQLException { - return execute(sql, connection, true, null, null,valueHandler); + public ExecuteResult execute(final String sql, Connection connection, ValueHandler valueHandler) throws SQLException { + return execute(sql, connection, true, null, null, valueHandler); } public ExecuteResult executeUpdate(final String sql, Connection connection, int n) @@ -162,7 +158,7 @@ public class SQLExecutor { if (affectedRows != n) { executeResult.setSuccess(false); executeResult.setMessage("Update error " + sql + " update affectedRows = " + affectedRows + ", Each SQL statement should update no more than one record. Please use a unique key for updates."); - // connection.rollback(); + // connection.rollback(); } } return executeResult; @@ -270,12 +266,12 @@ public class SQLExecutor { * @return * @throws SQLException */ - public ExecuteResult execute(Connection connection, String sql,ValueHandler valueHandler) throws SQLException { - return execute(sql, connection, true, null, null,valueHandler); + public ExecuteResult execute(Connection connection, String sql, ValueHandler valueHandler) throws SQLException { + return execute(sql, connection, true, null, null, valueHandler); } public ExecuteResult execute(Connection connection, String sql) throws SQLException { - return execute(sql, connection, true, null, null,new DefaultValueHandler()); + return execute(sql, connection, true, null, null, new DefaultValueHandler()); } /** @@ -342,8 +338,33 @@ public class SQLExecutor { */ public List
tables(Connection connection, String databaseName, String schemaName, String tableName, String types[]) { - try (ResultSet resultSet = connection.getMetaData().getTables(databaseName, schemaName, tableName, - types)) { + + try { + DatabaseMetaData metadata = connection.getMetaData(); + ResultSet resultSet = metadata.getTables(databaseName, schemaName, tableName, + types); + // 如果connection为mysql + if ("MySQL".equalsIgnoreCase(metadata.getDatabaseProductName())) { + // 获取mysql表的comment + List
tables = ResultSetUtils.toObjectList(resultSet, Table.class); + if (CollectionUtils.isNotEmpty(tables)) { + for (Table table : tables) { + String sql = "show table status where name = '" + table.getName() + "'"; + try (Statement stmt = connection.createStatement()) { + boolean query = stmt.execute(sql); + if (query) { + try (ResultSet rs = stmt.getResultSet();) { + while (rs.next()) { + table.setComment(rs.getString("Comment")); + } + } + } + } + } + + return tables; + } + } return ResultSetUtils.toObjectList(resultSet, Table.class); } catch (SQLException e) { throw new RuntimeException(e);