import {BaseService} from '@/lib/services/core'; import type {DBOverview, ExecuteSQLResponse, TableDataResponse} from './types'; /** * 数据库管理服务类 */ export class DbManageService extends BaseService { protected static readonly basePath = '/api/v1/admin/db-manage'; /** * 获取数据库运行概览 */ static async getOverview(): Promise { return this.get('/overview'); } /** * 获取数据库所有物理表名 */ static async listTables(): Promise { return this.get('/tables'); } /** * 获取某张数据表的数据(分页) */ static async getTableData(params: { table: string; page: number; pageSize: number; }): Promise { return this.get('/table-data', params as unknown as Record); } /** * 在数据库中执行自定义 SQL 语句 */ static async executeSQL(sql: string): Promise { return this.post('/query', { sql }); } }