From 6df5bd00604ce69a47bb02b50203575cbb8c534f Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Fri, 9 May 2025 14:40:00 +0800 Subject: [PATCH] feat: system and infra api --- .../src/api/infra/api-access-log/index.ts | 44 ++++ .../src/api/infra/api-error-log/index.ts | 55 +++++ apps/web-naive/src/api/infra/codegen/index.ts | 157 +++++++++++++++ apps/web-naive/src/api/infra/config/index.ts | 62 ++++++ .../src/api/infra/data-source-config/index.ts | 46 +++++ .../src/api/infra/demo/demo01/index.ts | 52 +++++ .../src/api/infra/demo/demo02/index.ts | 46 +++++ .../src/api/infra/demo/demo03/erp/index.ts | 137 +++++++++++++ .../src/api/infra/demo/demo03/inner/index.ts | 85 ++++++++ .../src/api/infra/demo/demo03/normal/index.ts | 87 ++++++++ .../src/api/infra/file-config/index.ts | 75 +++++++ apps/web-naive/src/api/infra/file/index.ts | 73 +++++++ apps/web-naive/src/api/infra/job-log/index.ts | 41 ++++ apps/web-naive/src/api/infra/job/index.ts | 70 +++++++ apps/web-naive/src/api/infra/redis/index.ts | 190 ++++++++++++++++++ apps/web-naive/src/api/system/area/index.ts | 24 +++ apps/web-naive/src/api/system/dept/index.ts | 47 +++++ .../src/api/system/dict/data/index.ts | 54 +++++ .../src/api/system/dict/type/index.ts | 48 +++++ .../src/api/system/login-log/index.ts | 33 +++ .../src/api/system/mail/account/index.ts | 57 ++++++ .../src/api/system/mail/log/index.ts | 46 +++++ .../src/api/system/mail/template/index.ts | 62 ++++++ apps/web-naive/src/api/system/menu/index.ts | 54 +++++ apps/web-naive/src/api/system/notice/index.ts | 52 +++++ .../src/api/system/notify/message/index.ts | 65 ++++++ .../src/api/system/notify/template/index.ts | 72 +++++++ .../src/api/system/oauth2/client/index.ts | 57 ++++++ .../src/api/system/oauth2/open/index.ts | 58 ++++++ .../src/api/system/oauth2/token/index.ts | 34 ++++ .../src/api/system/operate-log/index.ts | 39 ++++ .../src/api/system/permission/index.ts | 57 ++++++ apps/web-naive/src/api/system/post/index.ts | 58 ++++++ apps/web-naive/src/api/system/role/index.ts | 58 ++++++ .../src/api/system/sms/channel/index.ts | 60 ++++++ .../web-naive/src/api/system/sms/log/index.ts | 45 +++++ .../src/api/system/sms/template/index.ts | 70 +++++++ .../src/api/system/social/client/index.ts | 48 +++++ .../src/api/system/social/user/index.ts | 66 ++++++ .../src/api/system/tenant-package/index.ts | 57 ++++++ apps/web-naive/src/api/system/tenant/index.ts | 69 +++++++ apps/web-naive/src/api/system/user/index.ts | 83 ++++++++ .../src/api/system/user/profile/index.ts | 56 ++++++ 43 files changed, 2749 insertions(+) create mode 100644 apps/web-naive/src/api/infra/api-access-log/index.ts create mode 100644 apps/web-naive/src/api/infra/api-error-log/index.ts create mode 100644 apps/web-naive/src/api/infra/codegen/index.ts create mode 100644 apps/web-naive/src/api/infra/config/index.ts create mode 100644 apps/web-naive/src/api/infra/data-source-config/index.ts create mode 100644 apps/web-naive/src/api/infra/demo/demo01/index.ts create mode 100644 apps/web-naive/src/api/infra/demo/demo02/index.ts create mode 100644 apps/web-naive/src/api/infra/demo/demo03/erp/index.ts create mode 100644 apps/web-naive/src/api/infra/demo/demo03/inner/index.ts create mode 100644 apps/web-naive/src/api/infra/demo/demo03/normal/index.ts create mode 100644 apps/web-naive/src/api/infra/file-config/index.ts create mode 100644 apps/web-naive/src/api/infra/file/index.ts create mode 100644 apps/web-naive/src/api/infra/job-log/index.ts create mode 100644 apps/web-naive/src/api/infra/job/index.ts create mode 100644 apps/web-naive/src/api/infra/redis/index.ts create mode 100644 apps/web-naive/src/api/system/area/index.ts create mode 100644 apps/web-naive/src/api/system/dept/index.ts create mode 100644 apps/web-naive/src/api/system/dict/data/index.ts create mode 100644 apps/web-naive/src/api/system/dict/type/index.ts create mode 100644 apps/web-naive/src/api/system/login-log/index.ts create mode 100644 apps/web-naive/src/api/system/mail/account/index.ts create mode 100644 apps/web-naive/src/api/system/mail/log/index.ts create mode 100644 apps/web-naive/src/api/system/mail/template/index.ts create mode 100644 apps/web-naive/src/api/system/menu/index.ts create mode 100644 apps/web-naive/src/api/system/notice/index.ts create mode 100644 apps/web-naive/src/api/system/notify/message/index.ts create mode 100644 apps/web-naive/src/api/system/notify/template/index.ts create mode 100644 apps/web-naive/src/api/system/oauth2/client/index.ts create mode 100644 apps/web-naive/src/api/system/oauth2/open/index.ts create mode 100644 apps/web-naive/src/api/system/oauth2/token/index.ts create mode 100644 apps/web-naive/src/api/system/operate-log/index.ts create mode 100644 apps/web-naive/src/api/system/permission/index.ts create mode 100644 apps/web-naive/src/api/system/post/index.ts create mode 100644 apps/web-naive/src/api/system/role/index.ts create mode 100644 apps/web-naive/src/api/system/sms/channel/index.ts create mode 100644 apps/web-naive/src/api/system/sms/log/index.ts create mode 100644 apps/web-naive/src/api/system/sms/template/index.ts create mode 100644 apps/web-naive/src/api/system/social/client/index.ts create mode 100644 apps/web-naive/src/api/system/social/user/index.ts create mode 100644 apps/web-naive/src/api/system/tenant-package/index.ts create mode 100644 apps/web-naive/src/api/system/tenant/index.ts create mode 100644 apps/web-naive/src/api/system/user/index.ts create mode 100644 apps/web-naive/src/api/system/user/profile/index.ts diff --git a/apps/web-naive/src/api/infra/api-access-log/index.ts b/apps/web-naive/src/api/infra/api-access-log/index.ts new file mode 100644 index 00000000..656e3808 --- /dev/null +++ b/apps/web-naive/src/api/infra/api-access-log/index.ts @@ -0,0 +1,44 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace InfraApiAccessLogApi { + /** API 访问日志信息 */ + export interface ApiAccessLog { + id: number; + traceId: string; + userId: number; + userType: number; + applicationName: string; + requestMethod: string; + requestParams: string; + responseBody: string; + requestUrl: string; + userIp: string; + userAgent: string; + operateModule: string; + operateName: string; + operateType: number; + beginTime: string; + endTime: string; + duration: number; + resultCode: number; + resultMsg: string; + createTime: string; + } +} + +/** 查询 API 访问日志列表 */ +export function getApiAccessLogPage(params: PageParam) { + return requestClient.get>( + '/infra/api-access-log/page', + { params }, + ); +} + +/** 导出 API 访问日志 */ +export function exportApiAccessLog(params: any) { + return requestClient.download('/infra/api-access-log/export-excel', { + params, + }); +} diff --git a/apps/web-naive/src/api/infra/api-error-log/index.ts b/apps/web-naive/src/api/infra/api-error-log/index.ts new file mode 100644 index 00000000..863f73e9 --- /dev/null +++ b/apps/web-naive/src/api/infra/api-error-log/index.ts @@ -0,0 +1,55 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace InfraApiErrorLogApi { + /** API 错误日志信息 */ + export interface ApiErrorLog { + id: number; + traceId: string; + userId: number; + userType: number; + applicationName: string; + requestMethod: string; + requestParams: string; + requestUrl: string; + userIp: string; + userAgent: string; + exceptionTime: string; + exceptionName: string; + exceptionMessage: string; + exceptionRootCauseMessage: string; + exceptionStackTrace: string; + exceptionClassName: string; + exceptionFileName: string; + exceptionMethodName: string; + exceptionLineNumber: number; + processUserId: number; + processStatus: number; + processTime: string; + resultCode: number; + createTime: string; + } +} + +/** 查询 API 错误日志列表 */ +export function getApiErrorLogPage(params: PageParam) { + return requestClient.get>( + '/infra/api-error-log/page', + { params }, + ); +} + +/** 更新 API 错误日志的处理状态 */ +export function updateApiErrorLogStatus(id: number, processStatus: number) { + return requestClient.put( + `/infra/api-error-log/update-status?id=${id}&processStatus=${processStatus}`, + ); +} + +/** 导出 API 错误日志 */ +export function exportApiErrorLog(params: any) { + return requestClient.download('/infra/api-error-log/export-excel', { + params, + }); +} diff --git a/apps/web-naive/src/api/infra/codegen/index.ts b/apps/web-naive/src/api/infra/codegen/index.ts new file mode 100644 index 00000000..d8fea045 --- /dev/null +++ b/apps/web-naive/src/api/infra/codegen/index.ts @@ -0,0 +1,157 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace InfraCodegenApi { + /** 代码生成表定义 */ + export interface CodegenTable { + id: number; + tableId: number; + isParentMenuIdValid: boolean; + dataSourceConfigId: number; + scene: number; + tableName: string; + tableComment: string; + remark: string; + moduleName: string; + businessName: string; + className: string; + classComment: string; + author: string; + createTime: Date; + updateTime: Date; + templateType: number; + parentMenuId: number; + } + + /** 代码生成字段定义 */ + export interface CodegenColumn { + id: number; + tableId: number; + columnName: string; + dataType: string; + columnComment: string; + nullable: number; + primaryKey: number; + ordinalPosition: number; + javaType: string; + javaField: string; + dictType: string; + example: string; + createOperation: number; + updateOperation: number; + listOperation: number; + listOperationCondition: string; + listOperationResult: number; + htmlType: string; + } + + /** 数据库表定义 */ + export interface DatabaseTable { + name: string; + comment: string; + } + + /** 代码生成详情 */ + export interface CodegenDetail { + table: CodegenTable; + columns: CodegenColumn[]; + } + + /** 代码预览 */ + export interface CodegenPreview { + filePath: string; + code: string; + } + + /** 更新代码生成请求 */ + export interface CodegenUpdateReqVO { + table: any | CodegenTable; + columns: CodegenColumn[]; + } + + /** 创建代码生成请求 */ + export interface CodegenCreateListReqVO { + dataSourceConfigId?: number; + tableNames: string[]; + } +} + +/** 查询列表代码生成表定义 */ +export function getCodegenTableList(dataSourceConfigId: number) { + return requestClient.get( + '/infra/codegen/table/list?', + { + params: { dataSourceConfigId }, + }, + ); +} + +/** 查询列表代码生成表定义 */ +export function getCodegenTablePage(params: PageParam) { + return requestClient.get>( + '/infra/codegen/table/page', + { params }, + ); +} + +/** 查询详情代码生成表定义 */ +export function getCodegenTable(tableId: number) { + return requestClient.get( + '/infra/codegen/detail', + { + params: { tableId }, + }, + ); +} + +/** 修改代码生成表定义 */ +export function updateCodegenTable(data: InfraCodegenApi.CodegenUpdateReqVO) { + return requestClient.put('/infra/codegen/update', data); +} + +/** 基于数据库的表结构,同步数据库的表和字段定义 */ +export function syncCodegenFromDB(tableId: number) { + return requestClient.put('/infra/codegen/sync-from-db', { + params: { tableId }, + }); +} + +/** 预览生成代码 */ +export function previewCodegen(tableId: number) { + return requestClient.get( + '/infra/codegen/preview', + { + params: { tableId }, + }, + ); +} + +/** 下载生成代码 */ +export function downloadCodegen(tableId: number) { + return requestClient.download('/infra/codegen/download', { + params: { tableId }, + }); +} + +/** 获得表定义 */ +export function getSchemaTableList(params: any) { + return requestClient.get( + '/infra/codegen/db/table/list', + { params }, + ); +} + +/** 基于数据库的表结构,创建代码生成器的表定义 */ +export function createCodegenList( + data: InfraCodegenApi.CodegenCreateListReqVO, +) { + return requestClient.post('/infra/codegen/create-list', data); +} + +/** 删除代码生成表定义 */ +export function deleteCodegenTable(tableId: number) { + return requestClient.delete('/infra/codegen/delete', { + params: { tableId }, + }); +} diff --git a/apps/web-naive/src/api/infra/config/index.ts b/apps/web-naive/src/api/infra/config/index.ts new file mode 100644 index 00000000..3911e01c --- /dev/null +++ b/apps/web-naive/src/api/infra/config/index.ts @@ -0,0 +1,62 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace InfraConfigApi { + /** 参数配置信息 */ + export interface Config { + id?: number; + category: string; + name: string; + key: string; + value: string; + type: number; + visible: boolean; + remark: string; + createTime?: Date; + } +} + +/** 查询参数列表 */ +export function getConfigPage(params: PageParam) { + return requestClient.get>( + '/infra/config/page', + { + params, + }, + ); +} + +/** 查询参数详情 */ +export function getConfig(id: number) { + return requestClient.get(`/infra/config/get?id=${id}`); +} + +/** 根据参数键名查询参数值 */ +export function getConfigKey(configKey: string) { + return requestClient.get( + `/infra/config/get-value-by-key?key=${configKey}`, + ); +} + +/** 新增参数 */ +export function createConfig(data: InfraConfigApi.Config) { + return requestClient.post('/infra/config/create', data); +} + +/** 修改参数 */ +export function updateConfig(data: InfraConfigApi.Config) { + return requestClient.put('/infra/config/update', data); +} + +/** 删除参数 */ +export function deleteConfig(id: number) { + return requestClient.delete(`/infra/config/delete?id=${id}`); +} + +/** 导出参数 */ +export function exportConfig(params: any) { + return requestClient.download('/infra/config/export', { + params, + }); +} diff --git a/apps/web-naive/src/api/infra/data-source-config/index.ts b/apps/web-naive/src/api/infra/data-source-config/index.ts new file mode 100644 index 00000000..88641f65 --- /dev/null +++ b/apps/web-naive/src/api/infra/data-source-config/index.ts @@ -0,0 +1,46 @@ +import { requestClient } from '#/api/request'; + +export namespace InfraDataSourceConfigApi { + /** 数据源配置信息 */ + export interface DataSourceConfig { + id?: number; + name: string; + url: string; + username: string; + password: string; + createTime?: Date; + } +} + +/** 查询数据源配置列表 */ +export function getDataSourceConfigList() { + return requestClient.get( + '/infra/data-source-config/list', + ); +} + +/** 查询数据源配置详情 */ +export function getDataSourceConfig(id: number) { + return requestClient.get( + `/infra/data-source-config/get?id=${id}`, + ); +} + +/** 新增数据源配置 */ +export function createDataSourceConfig( + data: InfraDataSourceConfigApi.DataSourceConfig, +) { + return requestClient.post('/infra/data-source-config/create', data); +} + +/** 修改数据源配置 */ +export function updateDataSourceConfig( + data: InfraDataSourceConfigApi.DataSourceConfig, +) { + return requestClient.put('/infra/data-source-config/update', data); +} + +/** 删除数据源配置 */ +export function deleteDataSourceConfig(id: number) { + return requestClient.delete(`/infra/data-source-config/delete?id=${id}`); +} diff --git a/apps/web-naive/src/api/infra/demo/demo01/index.ts b/apps/web-naive/src/api/infra/demo/demo01/index.ts new file mode 100644 index 00000000..5a940a61 --- /dev/null +++ b/apps/web-naive/src/api/infra/demo/demo01/index.ts @@ -0,0 +1,52 @@ +import type { Dayjs } from 'dayjs'; + +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace Demo01ContactApi { + /** 示例联系人信息 */ + export interface Demo01Contact { + id: number; // 编号 + name?: string; // 名字 + sex?: boolean; // 性别 + birthday?: Dayjs | string; // 出生年 + description?: string; // 简介 + avatar: string; // 头像 + } +} + +/** 查询示例联系人分页 */ +export function getDemo01ContactPage(params: PageParam) { + return requestClient.get>( + '/infra/demo01-contact/page', + { params }, + ); +} + +/** 查询示例联系人详情 */ +export function getDemo01Contact(id: number) { + return requestClient.get( + `/infra/demo01-contact/get?id=${id}`, + ); +} + +/** 新增示例联系人 */ +export function createDemo01Contact(data: Demo01ContactApi.Demo01Contact) { + return requestClient.post('/infra/demo01-contact/create', data); +} + +/** 修改示例联系人 */ +export function updateDemo01Contact(data: Demo01ContactApi.Demo01Contact) { + return requestClient.put('/infra/demo01-contact/update', data); +} + +/** 删除示例联系人 */ +export function deleteDemo01Contact(id: number) { + return requestClient.delete(`/infra/demo01-contact/delete?id=${id}`); +} + +/** 导出示例联系人 */ +export function exportDemo01Contact(params: any) { + return requestClient.download('/infra/demo01-contact/export-excel', params); +} diff --git a/apps/web-naive/src/api/infra/demo/demo02/index.ts b/apps/web-naive/src/api/infra/demo/demo02/index.ts new file mode 100644 index 00000000..45fcb148 --- /dev/null +++ b/apps/web-naive/src/api/infra/demo/demo02/index.ts @@ -0,0 +1,46 @@ +import { requestClient } from '#/api/request'; + +export namespace Demo02CategoryApi { + /** 示例分类信息 */ + export interface Demo02Category { + id: number; // 编号 + name?: string; // 名字 + parentId?: number; // 父级编号 + children?: Demo02Category[]; + } +} + +/** 查询示例分类列表 */ +export function getDemo02CategoryList(params: any) { + return requestClient.get( + '/infra/demo02-category/list', + { params }, + ); +} + +/** 查询示例分类详情 */ +export function getDemo02Category(id: number) { + return requestClient.get( + `/infra/demo02-category/get?id=${id}`, + ); +} + +/** 新增示例分类 */ +export function createDemo02Category(data: Demo02CategoryApi.Demo02Category) { + return requestClient.post('/infra/demo02-category/create', data); +} + +/** 修改示例分类 */ +export function updateDemo02Category(data: Demo02CategoryApi.Demo02Category) { + return requestClient.put('/infra/demo02-category/update', data); +} + +/** 删除示例分类 */ +export function deleteDemo02Category(id: number) { + return requestClient.delete(`/infra/demo02-category/delete?id=${id}`); +} + +/** 导出示例分类 */ +export function exportDemo02Category(params: any) { + return requestClient.download('/infra/demo02-category/export-excel', params); +} diff --git a/apps/web-naive/src/api/infra/demo/demo03/erp/index.ts b/apps/web-naive/src/api/infra/demo/demo03/erp/index.ts new file mode 100644 index 00000000..f9704bf1 --- /dev/null +++ b/apps/web-naive/src/api/infra/demo/demo03/erp/index.ts @@ -0,0 +1,137 @@ +import type { Dayjs } from 'dayjs'; + +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace Demo03StudentApi { + /** 学生课程信息 */ + export interface Demo03Course { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + score?: number; // 分数 + } + + /** 学生班级信息 */ + export interface Demo03Grade { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + teacher?: string; // 班主任 + } + + /** 学生信息 */ + export interface Demo03Student { + id: number; // 编号 + name?: string; // 名字 + sex?: number; // 性别 + birthday?: Dayjs | string; // 出生日期 + description?: string; // 简介 + } +} + +/** 查询学生分页 */ +export function getDemo03StudentPage(params: PageParam) { + return requestClient.get>( + '/infra/demo03-student/page', + { params }, + ); +} + +/** 查询学生详情 */ +export function getDemo03Student(id: number) { + return requestClient.get( + `/infra/demo03-student/get?id=${id}`, + ); +} + +/** 新增学生 */ +export function createDemo03Student(data: Demo03StudentApi.Demo03Student) { + return requestClient.post('/infra/demo03-student/create', data); +} + +/** 修改学生 */ +export function updateDemo03Student(data: Demo03StudentApi.Demo03Student) { + return requestClient.put('/infra/demo03-student/update', data); +} + +/** 删除学生 */ +export function deleteDemo03Student(id: number) { + return requestClient.delete(`/infra/demo03-student/delete?id=${id}`); +} + +/** 导出学生 */ +export function exportDemo03Student(params: any) { + return requestClient.download('/infra/demo03-student/export-excel', params); +} + +// ==================== 子表(学生课程) ==================== + +/** 获得学生课程分页 */ +export function getDemo03CoursePage(params: PageParam) { + return requestClient.get>( + `/infra/demo03-student/demo03-course/page`, + { + params, + }, + ); +} +/** 新增学生课程 */ +export function createDemo03Course(data: Demo03StudentApi.Demo03Course) { + return requestClient.post(`/infra/demo03-student/demo03-course/create`, data); +} + +/** 修改学生课程 */ +export function updateDemo03Course(data: Demo03StudentApi.Demo03Course) { + return requestClient.put(`/infra/demo03-student/demo03-course/update`, data); +} + +/** 删除学生课程 */ +export function deleteDemo03Course(id: number) { + return requestClient.delete( + `/infra/demo03-student/demo03-course/delete?id=${id}`, + ); +} + +/** 获得学生课程 */ +export function getDemo03Course(id: number) { + return requestClient.get( + `/infra/demo03-student/demo03-course/get?id=${id}`, + ); +} + +// ==================== 子表(学生班级) ==================== + +/** 获得学生班级分页 */ +export function getDemo03GradePage(params: PageParam) { + return requestClient.get>( + `/infra/demo03-student/demo03-grade/page`, + { + params, + }, + ); +} +/** 新增学生班级 */ +export function createDemo03Grade(data: Demo03StudentApi.Demo03Grade) { + return requestClient.post(`/infra/demo03-student/demo03-grade/create`, data); +} + +/** 修改学生班级 */ +export function updateDemo03Grade(data: Demo03StudentApi.Demo03Grade) { + return requestClient.put(`/infra/demo03-student/demo03-grade/update`, data); +} + +/** 删除学生班级 */ +export function deleteDemo03Grade(id: number) { + return requestClient.delete( + `/infra/demo03-student/demo03-grade/delete?id=${id}`, + ); +} + +/** 获得学生班级 */ +export function getDemo03Grade(id: number) { + return requestClient.get( + `/infra/demo03-student/demo03-grade/get?id=${id}`, + ); +} diff --git a/apps/web-naive/src/api/infra/demo/demo03/inner/index.ts b/apps/web-naive/src/api/infra/demo/demo03/inner/index.ts new file mode 100644 index 00000000..a83cf421 --- /dev/null +++ b/apps/web-naive/src/api/infra/demo/demo03/inner/index.ts @@ -0,0 +1,85 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace Demo03StudentApi { + /** 学生课程信息 */ + export interface Demo03Course { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + score?: number; // 分数 + } + + /** 学生班级信息 */ + export interface Demo03Grade { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + teacher?: string; // 班主任 + } + + /** 学生信息 */ + export interface Demo03Student { + id: number; // 编号 + name?: string; // 名字 + sex?: number; // 性别 + birthday?: Date; // 出生日期 + description?: string; // 简介 + demo03courses?: Demo03Course[]; + demo03grade?: Demo03Grade; + } +} + +/** 查询学生分页 */ +export function getDemo03StudentPage(params: PageParam) { + return requestClient.get>( + '/infra/demo03-student/page', + { params }, + ); +} + +/** 查询学生详情 */ +export function getDemo03Student(id: number) { + return requestClient.get( + `/infra/demo03-student/get?id=${id}`, + ); +} + +/** 新增学生 */ +export function createDemo03Student(data: Demo03StudentApi.Demo03Student) { + return requestClient.post('/infra/demo03-student/create', data); +} + +/** 修改学生 */ +export function updateDemo03Student(data: Demo03StudentApi.Demo03Student) { + return requestClient.put('/infra/demo03-student/update', data); +} + +/** 删除学生 */ +export function deleteDemo03Student(id: number) { + return requestClient.delete(`/infra/demo03-student/delete?id=${id}`); +} + +/** 导出学生 */ +export function exportDemo03Student(params: any) { + return requestClient.download('/infra/demo03-student/export-excel', params); +} + +// ==================== 子表(学生课程) ==================== + +/** 获得学生课程列表 */ +export function getDemo03CourseListByStudentId(studentId: number) { + return requestClient.get( + `/infra/demo03-student/demo03-course/list-by-student-id?studentId=${studentId}`, + ); +} + +// ==================== 子表(学生班级) ==================== + +/** 获得学生班级 */ +export function getDemo03GradeByStudentId(studentId: number) { + return requestClient.get( + `/infra/demo03-student/demo03-grade/get-by-student-id?studentId=${studentId}`, + ); +} diff --git a/apps/web-naive/src/api/infra/demo/demo03/normal/index.ts b/apps/web-naive/src/api/infra/demo/demo03/normal/index.ts new file mode 100644 index 00000000..a04a919e --- /dev/null +++ b/apps/web-naive/src/api/infra/demo/demo03/normal/index.ts @@ -0,0 +1,87 @@ +import type { Dayjs } from 'dayjs'; + +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace Demo03StudentApi { + /** 学生课程信息 */ + export interface Demo03Course { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + score?: number; // 分数 + } + + /** 学生班级信息 */ + export interface Demo03Grade { + id: number; // 编号 + studentId?: number; // 学生编号 + name?: string; // 名字 + teacher?: string; // 班主任 + } + + /** 学生信息 */ + export interface Demo03Student { + id: number; // 编号 + name?: string; // 名字 + sex?: number; // 性别 + birthday?: Dayjs | string; // 出生日期 + description?: string; // 简介 + demo03courses?: Demo03Course[]; + demo03grade?: Demo03Grade; + } +} + +/** 查询学生分页 */ +export function getDemo03StudentPage(params: PageParam) { + return requestClient.get>( + '/infra/demo03-student/page', + { params }, + ); +} + +/** 查询学生详情 */ +export function getDemo03Student(id: number) { + return requestClient.get( + `/infra/demo03-student/get?id=${id}`, + ); +} + +/** 新增学生 */ +export function createDemo03Student(data: Demo03StudentApi.Demo03Student) { + return requestClient.post('/infra/demo03-student/create', data); +} + +/** 修改学生 */ +export function updateDemo03Student(data: Demo03StudentApi.Demo03Student) { + return requestClient.put('/infra/demo03-student/update', data); +} + +/** 删除学生 */ +export function deleteDemo03Student(id: number) { + return requestClient.delete(`/infra/demo03-student/delete?id=${id}`); +} + +/** 导出学生 */ +export function exportDemo03Student(params: any) { + return requestClient.download('/infra/demo03-student/export-excel', params); +} + +// ==================== 子表(学生课程) ==================== + +/** 获得学生课程列表 */ +export function getDemo03CourseListByStudentId(studentId: number) { + return requestClient.get( + `/infra/demo03-student/demo03-course/list-by-student-id?studentId=${studentId}`, + ); +} + +// ==================== 子表(学生班级) ==================== + +/** 获得学生班级 */ +export function getDemo03GradeByStudentId(studentId: number) { + return requestClient.get( + `/infra/demo03-student/demo03-grade/get-by-student-id?studentId=${studentId}`, + ); +} diff --git a/apps/web-naive/src/api/infra/file-config/index.ts b/apps/web-naive/src/api/infra/file-config/index.ts new file mode 100644 index 00000000..a16cf2bc --- /dev/null +++ b/apps/web-naive/src/api/infra/file-config/index.ts @@ -0,0 +1,75 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace InfraFileConfigApi { + /** 文件客户端配置 */ + export interface FileClientConfig { + basePath: string; + host?: string; + port?: number; + username?: string; + password?: string; + mode?: string; + endpoint?: string; + bucket?: string; + accessKey?: string; + accessSecret?: string; + pathStyle?: boolean; + domain: string; + } + + /** 文件配置信息 */ + export interface FileConfig { + id?: number; + name: string; + storage?: number; + master: boolean; + visible: boolean; + config: FileClientConfig; + remark: string; + createTime?: Date; + } +} + +/** 查询文件配置列表 */ +export function getFileConfigPage(params: PageParam) { + return requestClient.get>( + '/infra/file-config/page', + { + params, + }, + ); +} + +/** 查询文件配置详情 */ +export function getFileConfig(id: number) { + return requestClient.get( + `/infra/file-config/get?id=${id}`, + ); +} + +/** 更新文件配置为主配置 */ +export function updateFileConfigMaster(id: number) { + return requestClient.put(`/infra/file-config/update-master?id=${id}`); +} + +/** 新增文件配置 */ +export function createFileConfig(data: InfraFileConfigApi.FileConfig) { + return requestClient.post('/infra/file-config/create', data); +} + +/** 修改文件配置 */ +export function updateFileConfig(data: InfraFileConfigApi.FileConfig) { + return requestClient.put('/infra/file-config/update', data); +} + +/** 删除文件配置 */ +export function deleteFileConfig(id: number) { + return requestClient.delete(`/infra/file-config/delete?id=${id}`); +} + +/** 测试文件配置 */ +export function testFileConfig(id: number) { + return requestClient.get(`/infra/file-config/test?id=${id}`); +} diff --git a/apps/web-naive/src/api/infra/file/index.ts b/apps/web-naive/src/api/infra/file/index.ts new file mode 100644 index 00000000..a399db67 --- /dev/null +++ b/apps/web-naive/src/api/infra/file/index.ts @@ -0,0 +1,73 @@ +import type { AxiosRequestConfig, PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +/** Axios 上传进度事件 */ +export type AxiosProgressEvent = AxiosRequestConfig['onUploadProgress']; + +export namespace InfraFileApi { + /** 文件信息 */ + export interface File { + id?: number; + configId?: number; + path: string; + name?: string; + url?: string; + size?: number; + type?: string; + createTime?: Date; + } + + /** 文件预签名地址 */ + export interface FilePresignedUrlRespVO { + configId: number; // 文件配置编号 + uploadUrl: string; // 文件上传 URL + url: string; // 文件 URL + path: string; // 文件路径 + } + + /** 上传文件 */ + export interface FileUploadReqVO { + file: globalThis.File; + directory?: string; + } +} + +/** 查询文件列表 */ +export function getFilePage(params: PageParam) { + return requestClient.get>('/infra/file/page', { + params, + }); +} + +/** 删除文件 */ +export function deleteFile(id: number) { + return requestClient.delete(`/infra/file/delete?id=${id}`); +} + +/** 获取文件预签名地址 */ +export function getFilePresignedUrl(name: string, directory?: string) { + return requestClient.get( + '/infra/file/presigned-url', + { + params: { name, directory }, + }, + ); +} + +/** 创建文件 */ +export function createFile(data: InfraFileApi.File) { + return requestClient.post('/infra/file/create', data); +} + +/** 上传文件 */ +export function uploadFile( + data: InfraFileApi.FileUploadReqVO, + onUploadProgress?: AxiosProgressEvent, +) { + // 特殊:由于 upload 内部封装,即使 directory 为 undefined,也会传递给后端 + if (!data.directory) { + delete data.directory; + } + return requestClient.upload('/infra/file/upload', data, { onUploadProgress }); +} diff --git a/apps/web-naive/src/api/infra/job-log/index.ts b/apps/web-naive/src/api/infra/job-log/index.ts new file mode 100644 index 00000000..e115b9df --- /dev/null +++ b/apps/web-naive/src/api/infra/job-log/index.ts @@ -0,0 +1,41 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace InfraJobLogApi { + /** 任务日志信息 */ + export interface JobLog { + id?: number; + jobId: number; + handlerName: string; + handlerParam: string; + cronExpression: string; + executeIndex: string; + beginTime: Date; + endTime: Date; + duration: string; + status: number; + createTime?: string; + result: string; + } +} + +/** 查询任务日志列表 */ +export function getJobLogPage(params: PageParam) { + return requestClient.get>( + '/infra/job-log/page', + { params }, + ); +} + +/** 查询任务日志详情 */ +export function getJobLog(id: number) { + return requestClient.get( + `/infra/job-log/get?id=${id}`, + ); +} + +/** 导出定时任务日志 */ +export function exportJobLog(params: any) { + return requestClient.download('/infra/job-log/export-excel', { params }); +} diff --git a/apps/web-naive/src/api/infra/job/index.ts b/apps/web-naive/src/api/infra/job/index.ts new file mode 100644 index 00000000..fcec25c8 --- /dev/null +++ b/apps/web-naive/src/api/infra/job/index.ts @@ -0,0 +1,70 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace InfraJobApi { + /** 任务信息 */ + export interface Job { + id?: number; + name: string; + status: number; + handlerName: string; + handlerParam: string; + cronExpression: string; + retryCount: number; + retryInterval: number; + monitorTimeout: number; + createTime?: Date; + } +} + +/** 查询任务列表 */ +export function getJobPage(params: PageParam) { + return requestClient.get>('/infra/job/page', { + params, + }); +} + +/** 查询任务详情 */ +export function getJob(id: number) { + return requestClient.get(`/infra/job/get?id=${id}`); +} + +/** 新增任务 */ +export function createJob(data: InfraJobApi.Job) { + return requestClient.post('/infra/job/create', data); +} + +/** 修改定时任务调度 */ +export function updateJob(data: InfraJobApi.Job) { + return requestClient.put('/infra/job/update', data); +} + +/** 删除定时任务调度 */ +export function deleteJob(id: number) { + return requestClient.delete(`/infra/job/delete?id=${id}`); +} + +/** 导出定时任务调度 */ +export function exportJob(params: any) { + return requestClient.download('/infra/job/export-excel', { params }); +} + +/** 任务状态修改 */ +export function updateJobStatus(id: number, status: number) { + const params = { + id, + status, + }; + return requestClient.put('/infra/job/update-status', { params }); +} + +/** 定时任务立即执行一次 */ +export function runJob(id: number) { + return requestClient.put(`/infra/job/trigger?id=${id}`); +} + +/** 获得定时任务的下 n 次执行时间 */ +export function getJobNextTimes(id: number) { + return requestClient.get(`/infra/job/get_next_times?id=${id}`); +} diff --git a/apps/web-naive/src/api/infra/redis/index.ts b/apps/web-naive/src/api/infra/redis/index.ts new file mode 100644 index 00000000..cb8179da --- /dev/null +++ b/apps/web-naive/src/api/infra/redis/index.ts @@ -0,0 +1,190 @@ +import { requestClient } from '#/api/request'; + +export namespace InfraRedisApi { + /** Redis 信息 */ + export interface RedisInfo { + io_threaded_reads_processed: string; + tracking_clients: string; + uptime_in_seconds: string; + cluster_connections: string; + current_cow_size: string; + maxmemory_human: string; + aof_last_cow_size: string; + master_replid2: string; + mem_replication_backlog: string; + aof_rewrite_scheduled: string; + total_net_input_bytes: string; + rss_overhead_ratio: string; + hz: string; + current_cow_size_age: string; + redis_build_id: string; + errorstat_BUSYGROUP: string; + aof_last_bgrewrite_status: string; + multiplexing_api: string; + client_recent_max_output_buffer: string; + allocator_resident: string; + mem_fragmentation_bytes: string; + aof_current_size: string; + repl_backlog_first_byte_offset: string; + tracking_total_prefixes: string; + redis_mode: string; + redis_git_dirty: string; + aof_delayed_fsync: string; + allocator_rss_bytes: string; + repl_backlog_histlen: string; + io_threads_active: string; + rss_overhead_bytes: string; + total_system_memory: string; + loading: string; + evicted_keys: string; + maxclients: string; + cluster_enabled: string; + redis_version: string; + repl_backlog_active: string; + mem_aof_buffer: string; + allocator_frag_bytes: string; + io_threaded_writes_processed: string; + instantaneous_ops_per_sec: string; + used_memory_human: string; + total_error_replies: string; + role: string; + maxmemory: string; + used_memory_lua: string; + rdb_current_bgsave_time_sec: string; + used_memory_startup: string; + used_cpu_sys_main_thread: string; + lazyfree_pending_objects: string; + aof_pending_bio_fsync: string; + used_memory_dataset_perc: string; + allocator_frag_ratio: string; + arch_bits: string; + used_cpu_user_main_thread: string; + mem_clients_normal: string; + expired_time_cap_reached_count: string; + unexpected_error_replies: string; + mem_fragmentation_ratio: string; + aof_last_rewrite_time_sec: string; + master_replid: string; + aof_rewrite_in_progress: string; + lru_clock: string; + maxmemory_policy: string; + run_id: string; + latest_fork_usec: string; + tracking_total_items: string; + total_commands_processed: string; + expired_keys: string; + errorstat_ERR: string; + used_memory: string; + module_fork_in_progress: string; + errorstat_WRONGPASS: string; + aof_buffer_length: string; + dump_payload_sanitizations: string; + mem_clients_slaves: string; + keyspace_misses: string; + server_time_usec: string; + executable: string; + lazyfreed_objects: string; + db0: string; + used_memory_peak_human: string; + keyspace_hits: string; + rdb_last_cow_size: string; + aof_pending_rewrite: string; + used_memory_overhead: string; + active_defrag_hits: string; + tcp_port: string; + uptime_in_days: string; + used_memory_peak_perc: string; + current_save_keys_processed: string; + blocked_clients: string; + total_reads_processed: string; + expire_cycle_cpu_milliseconds: string; + sync_partial_err: string; + used_memory_scripts_human: string; + aof_current_rewrite_time_sec: string; + aof_enabled: string; + process_supervised: string; + master_repl_offset: string; + used_memory_dataset: string; + used_cpu_user: string; + rdb_last_bgsave_status: string; + tracking_total_keys: string; + atomicvar_api: string; + allocator_rss_ratio: string; + client_recent_max_input_buffer: string; + clients_in_timeout_table: string; + aof_last_write_status: string; + mem_allocator: string; + used_memory_scripts: string; + used_memory_peak: string; + process_id: string; + master_failover_state: string; + errorstat_NOAUTH: string; + used_cpu_sys: string; + repl_backlog_size: string; + connected_slaves: string; + current_save_keys_total: string; + gcc_version: string; + total_system_memory_human: string; + sync_full: string; + connected_clients: string; + module_fork_last_cow_size: string; + total_writes_processed: string; + allocator_active: string; + total_net_output_bytes: string; + pubsub_channels: string; + current_fork_perc: string; + active_defrag_key_hits: string; + rdb_changes_since_last_save: string; + instantaneous_input_kbps: string; + used_memory_rss_human: string; + configured_hz: string; + expired_stale_perc: string; + active_defrag_misses: string; + used_cpu_sys_children: string; + number_of_cached_scripts: string; + sync_partial_ok: string; + used_memory_lua_human: string; + rdb_last_save_time: string; + pubsub_patterns: string; + slave_expires_tracked_keys: string; + redis_git_sha1: string; + used_memory_rss: string; + rdb_last_bgsave_time_sec: string; + os: string; + mem_not_counted_for_evict: string; + active_defrag_running: string; + rejected_connections: string; + aof_rewrite_buffer_length: string; + total_forks: string; + active_defrag_key_misses: string; + allocator_allocated: string; + aof_base_size: string; + instantaneous_output_kbps: string; + second_repl_offset: string; + rdb_bgsave_in_progress: string; + used_cpu_user_children: string; + total_connections_received: string; + migrate_cached_sockets: string; + } + + /** Redis 命令统计 */ + export interface RedisCommandStats { + command: string; + calls: number; + usec: number; + } + + /** Redis 监控信息 */ + export interface RedisMonitorInfo { + info: RedisInfo; + dbSize: number; + commandStats: RedisCommandStats[]; + } +} + +/** 获取 Redis 监控信息 */ +export function getRedisMonitorInfo() { + return requestClient.get( + '/infra/redis/get-monitor-info', + ); +} diff --git a/apps/web-naive/src/api/system/area/index.ts b/apps/web-naive/src/api/system/area/index.ts new file mode 100644 index 00000000..8d3361da --- /dev/null +++ b/apps/web-naive/src/api/system/area/index.ts @@ -0,0 +1,24 @@ +import { requestClient } from '#/api/request'; + +export namespace SystemAreaApi { + /** 地区信息 */ + export interface Area { + id?: number; + name: string; + code: string; + parentId?: number; + sort?: number; + status?: number; + createTime?: Date; + } +} + +/** 获得地区树 */ +export function getAreaTree() { + return requestClient.get('/system/area/tree'); +} + +/** 获得 IP 对应的地区名 */ +export function getAreaByIp(ip: string) { + return requestClient.get(`/system/area/get-by-ip?ip=${ip}`); +} diff --git a/apps/web-naive/src/api/system/dept/index.ts b/apps/web-naive/src/api/system/dept/index.ts new file mode 100644 index 00000000..d2677a79 --- /dev/null +++ b/apps/web-naive/src/api/system/dept/index.ts @@ -0,0 +1,47 @@ +import { requestClient } from '#/api/request'; + +export namespace SystemDeptApi { + /** 部门信息 */ + export interface Dept { + id?: number; + name: string; + parentId?: number; + status: number; + sort: number; + leaderUserId: number; + phone: string; + email: string; + createTime: Date; + children?: Dept[]; + } +} + +/** 查询部门(精简)列表 */ +export async function getSimpleDeptList() { + return requestClient.get('/system/dept/simple-list'); +} + +/** 查询部门列表 */ +export async function getDeptList() { + return requestClient.get('/system/dept/list'); +} + +/** 查询部门详情 */ +export async function getDept(id: number) { + return requestClient.get(`/system/dept/get?id=${id}`); +} + +/** 新增部门 */ +export async function createDept(data: SystemDeptApi.Dept) { + return requestClient.post('/system/dept/create', data); +} + +/** 修改部门 */ +export async function updateDept(data: SystemDeptApi.Dept) { + return requestClient.put('/system/dept/update', data); +} + +/** 删除部门 */ +export async function deleteDept(id: number) { + return requestClient.delete(`/system/dept/delete?id=${id}`); +} diff --git a/apps/web-naive/src/api/system/dict/data/index.ts b/apps/web-naive/src/api/system/dict/data/index.ts new file mode 100644 index 00000000..a64330cd --- /dev/null +++ b/apps/web-naive/src/api/system/dict/data/index.ts @@ -0,0 +1,54 @@ +import type { PageParam } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemDictDataApi { + /** 字典数据 */ + export type DictData = { + colorType: string; + createTime: Date; + cssClass: string; + dictType: string; + id?: number; + label: string; + remark: string; + sort?: number; + status: number; + value: string; + }; +} + +// 查询字典数据(精简)列表 +export function getSimpleDictDataList() { + return requestClient.get('/system/dict-data/simple-list'); +} + +// 查询字典数据列表 +export function getDictDataPage(params: PageParam) { + return requestClient.get('/system/dict-data/page', { params }); +} + +// 查询字典数据详情 +export function getDictData(id: number) { + return requestClient.get(`/system/dict-data/get?id=${id}`); +} + +// 新增字典数据 +export function createDictData(data: SystemDictDataApi.DictData) { + return requestClient.post('/system/dict-data/create', data); +} + +// 修改字典数据 +export function updateDictData(data: SystemDictDataApi.DictData) { + return requestClient.put('/system/dict-data/update', data); +} + +// 删除字典数据 +export function deleteDictData(id: number) { + return requestClient.delete(`/system/dict-data/delete?id=${id}`); +} + +// 导出字典类型数据 +export function exportDictData(params: any) { + return requestClient.download('/system/dict-data/export', { params }); +} diff --git a/apps/web-naive/src/api/system/dict/type/index.ts b/apps/web-naive/src/api/system/dict/type/index.ts new file mode 100644 index 00000000..612fe105 --- /dev/null +++ b/apps/web-naive/src/api/system/dict/type/index.ts @@ -0,0 +1,48 @@ +import { requestClient } from '#/api/request'; + +export namespace SystemDictTypeApi { + /** 字典类型 */ + export type DictType = { + createTime: Date; + id?: number; + name: string; + remark: string; + status: number; + type: string; + }; +} + +// 查询字典(精简)列表 +export function getSimpleDictTypeList() { + return requestClient.get('/system/dict-type/list-all-simple'); +} + +// 查询字典列表 +export function getDictTypePage(params: any) { + return requestClient.get('/system/dict-type/page', { params }); +} + +// 查询字典详情 +export function getDictType(id: number) { + return requestClient.get(`/system/dict-type/get?id=${id}`); +} + +// 新增字典 +export function createDictType(data: SystemDictTypeApi.DictType) { + return requestClient.post('/system/dict-type/create', data); +} + +// 修改字典 +export function updateDictType(data: SystemDictTypeApi.DictType) { + return requestClient.put('/system/dict-type/update', data); +} + +// 删除字典 +export function deleteDictType(id: number) { + return requestClient.delete(`/system/dict-type/delete?id=${id}`); +} + +// 导出字典类型 +export function exportDictType(params: any) { + return requestClient.download('/system/dict-type/export', { params }); +} diff --git a/apps/web-naive/src/api/system/login-log/index.ts b/apps/web-naive/src/api/system/login-log/index.ts new file mode 100644 index 00000000..4be20d9e --- /dev/null +++ b/apps/web-naive/src/api/system/login-log/index.ts @@ -0,0 +1,33 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemLoginLogApi { + /** 登录日志信息 */ + export interface LoginLog { + id: number; + logType: number; + traceId: number; + userId: number; + userType: number; + username: string; + result: number; + status: number; + userIp: string; + userAgent: string; + createTime: string; + } +} + +/** 查询登录日志列表 */ +export function getLoginLogPage(params: PageParam) { + return requestClient.get>( + '/system/login-log/page', + { params }, + ); +} + +/** 导出登录日志 */ +export function exportLoginLog(params: any) { + return requestClient.download('/system/login-log/export-excel', { params }); +} diff --git a/apps/web-naive/src/api/system/mail/account/index.ts b/apps/web-naive/src/api/system/mail/account/index.ts new file mode 100644 index 00000000..8a43a332 --- /dev/null +++ b/apps/web-naive/src/api/system/mail/account/index.ts @@ -0,0 +1,57 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailAccountApi { + /** 邮箱账号 */ + export interface MailAccount { + id: number; + mail: string; + username: string; + password: string; + host: string; + port: number; + sslEnable: boolean; + starttlsEnable: boolean; + status: number; + createTime: Date; + remark: string; + } +} + +/** 查询邮箱账号列表 */ +export function getMailAccountPage(params: PageParam) { + return requestClient.get>( + '/system/mail-account/page', + { params }, + ); +} + +/** 查询邮箱账号详情 */ +export function getMailAccount(id: number) { + return requestClient.get( + `/system/mail-account/get?id=${id}`, + ); +} + +/** 新增邮箱账号 */ +export function createMailAccount(data: SystemMailAccountApi.MailAccount) { + return requestClient.post('/system/mail-account/create', data); +} + +/** 修改邮箱账号 */ +export function updateMailAccount(data: SystemMailAccountApi.MailAccount) { + return requestClient.put('/system/mail-account/update', data); +} + +/** 删除邮箱账号 */ +export function deleteMailAccount(id: number) { + return requestClient.delete(`/system/mail-account/delete?id=${id}`); +} + +/** 获得邮箱账号精简列表 */ +export function getSimpleMailAccountList() { + return requestClient.get( + '/system/mail-account/simple-list', + ); +} diff --git a/apps/web-naive/src/api/system/mail/log/index.ts b/apps/web-naive/src/api/system/mail/log/index.ts new file mode 100644 index 00000000..52c9947c --- /dev/null +++ b/apps/web-naive/src/api/system/mail/log/index.ts @@ -0,0 +1,46 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailLogApi { + /** 邮件日志 */ + export interface MailLog { + id: number; + userId: number; + userType: number; + toMail: string; + accountId: number; + fromMail: string; + templateId: number; + templateCode: string; + templateNickname: string; + templateTitle: string; + templateContent: string; + templateParams: string; + sendStatus: number; + sendTime: string; + sendMessageId: string; + sendException: string; + createTime: string; + } +} + +/** 查询邮件日志列表 */ +export function getMailLogPage(params: PageParam) { + return requestClient.get>( + '/system/mail-log/page', + { params }, + ); +} + +/** 查询邮件日志详情 */ +export function getMailLog(id: number) { + return requestClient.get( + `/system/mail-log/get?id=${id}`, + ); +} + +/** 重新发送邮件 */ +export function resendMail(id: number) { + return requestClient.put(`/system/mail-log/resend?id=${id}`); +} diff --git a/apps/web-naive/src/api/system/mail/template/index.ts b/apps/web-naive/src/api/system/mail/template/index.ts new file mode 100644 index 00000000..34b4a09d --- /dev/null +++ b/apps/web-naive/src/api/system/mail/template/index.ts @@ -0,0 +1,62 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailTemplateApi { + /** 邮件模版信息 */ + export interface MailTemplate { + id: number; + name: string; + code: string; + accountId: number; + nickname: string; + title: string; + content: string; + params: string[]; + status: number; + remark: string; + createTime: Date; + } + + /** 邮件发送信息 */ + export interface MailSendReqVO { + mail: string; + templateCode: string; + templateParams: Record; + } +} + +/** 查询邮件模版列表 */ +export function getMailTemplatePage(params: PageParam) { + return requestClient.get>( + '/system/mail-template/page', + { params }, + ); +} + +/** 查询邮件模版详情 */ +export function getMailTemplate(id: number) { + return requestClient.get( + `/system/mail-template/get?id=${id}`, + ); +} + +/** 新增邮件模版 */ +export function createMailTemplate(data: SystemMailTemplateApi.MailTemplate) { + return requestClient.post('/system/mail-template/create', data); +} + +/** 修改邮件模版 */ +export function updateMailTemplate(data: SystemMailTemplateApi.MailTemplate) { + return requestClient.put('/system/mail-template/update', data); +} + +/** 删除邮件模版 */ +export function deleteMailTemplate(id: number) { + return requestClient.delete(`/system/mail-template/delete?id=${id}`); +} + +/** 发送邮件 */ +export function sendMail(data: SystemMailTemplateApi.MailSendReqVO) { + return requestClient.post('/system/mail-template/send-mail', data); +} diff --git a/apps/web-naive/src/api/system/menu/index.ts b/apps/web-naive/src/api/system/menu/index.ts new file mode 100644 index 00000000..5d23e523 --- /dev/null +++ b/apps/web-naive/src/api/system/menu/index.ts @@ -0,0 +1,54 @@ +import { requestClient } from '#/api/request'; + +export namespace SystemMenuApi { + /** 菜单信息 */ + export interface Menu { + id: number; + name: string; + permission: string; + type: number; + sort: number; + parentId: number; + path: string; + icon: string; + component: string; + componentName?: string; + status: number; + visible: boolean; + keepAlive: boolean; + alwaysShow?: boolean; + createTime: Date; + } +} + +/** 查询菜单(精简)列表 */ +export async function getSimpleMenusList() { + return requestClient.get('/system/menu/simple-list'); +} + +/** 查询菜单列表 */ +export async function getMenuList(params?: Record) { + return requestClient.get('/system/menu/list', { + params, + }); +} + +/** 获取菜单详情 */ +export async function getMenu(id: number) { + return requestClient.get(`/system/menu/get?id=${id}`); +} + +/** 新增菜单 */ +export async function createMenu(data: SystemMenuApi.Menu) { + return requestClient.post('/system/menu/create', data); +} + +/** 修改菜单 */ +export async function updateMenu(data: SystemMenuApi.Menu) { + return requestClient.put('/system/menu/update', data); +} + +/** 删除菜单 */ +export async function deleteMenu(id: number) { + return requestClient.delete(`/system/menu/delete?id=${id}`); +} diff --git a/apps/web-naive/src/api/system/notice/index.ts b/apps/web-naive/src/api/system/notice/index.ts new file mode 100644 index 00000000..dac9ec70 --- /dev/null +++ b/apps/web-naive/src/api/system/notice/index.ts @@ -0,0 +1,52 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemNoticeApi { + /** 公告信息 */ + export interface Notice { + id?: number; + title: string; + type: number; + content: string; + status: number; + remark: string; + creator?: string; + createTime?: Date; + } +} + +/** 查询公告列表 */ +export function getNoticePage(params: PageParam) { + return requestClient.get>( + '/system/notice/page', + { params }, + ); +} + +/** 查询公告详情 */ +export function getNotice(id: number) { + return requestClient.get( + `/system/notice/get?id=${id}`, + ); +} + +/** 新增公告 */ +export function createNotice(data: SystemNoticeApi.Notice) { + return requestClient.post('/system/notice/create', data); +} + +/** 修改公告 */ +export function updateNotice(data: SystemNoticeApi.Notice) { + return requestClient.put('/system/notice/update', data); +} + +/** 删除公告 */ +export function deleteNotice(id: number) { + return requestClient.delete(`/system/notice/delete?id=${id}`); +} + +/** 推送公告 */ +export function pushNotice(id: number) { + return requestClient.post(`/system/notice/push?id=${id}`); +} diff --git a/apps/web-naive/src/api/system/notify/message/index.ts b/apps/web-naive/src/api/system/notify/message/index.ts new file mode 100644 index 00000000..a8a4e896 --- /dev/null +++ b/apps/web-naive/src/api/system/notify/message/index.ts @@ -0,0 +1,65 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemNotifyMessageApi { + /** 站内信消息信息 */ + export interface NotifyMessage { + id: number; + userId: number; + userType: number; + templateId: number; + templateCode: string; + templateNickname: string; + templateContent: string; + templateType: number; + templateParams: string; + readStatus: boolean; + readTime: Date; + createTime: Date; + } +} + +/** 查询站内信消息列表 */ +export function getNotifyMessagePage(params: PageParam) { + return requestClient.get>( + '/system/notify-message/page', + { params }, + ); +} + +/** 获得我的站内信分页 */ +export function getMyNotifyMessagePage(params: PageParam) { + return requestClient.get>( + '/system/notify-message/my-page', + { params }, + ); +} + +/** 批量标记已读 */ +export function updateNotifyMessageRead(ids: number[]) { + return requestClient.put( + '/system/notify-message/update-read', + {}, + { + params: { ids }, + }, + ); +} + +/** 标记所有站内信为已读 */ +export function updateAllNotifyMessageRead() { + return requestClient.put('/system/notify-message/update-all-read'); +} + +/** 获取当前用户的最新站内信列表 */ +export function getUnreadNotifyMessageList() { + return requestClient.get( + '/system/notify-message/get-unread-list', + ); +} + +/** 获得当前用户的未读站内信数量 */ +export function getUnreadNotifyMessageCount() { + return requestClient.get('/system/notify-message/get-unread-count'); +} diff --git a/apps/web-naive/src/api/system/notify/template/index.ts b/apps/web-naive/src/api/system/notify/template/index.ts new file mode 100644 index 00000000..5f2e3de2 --- /dev/null +++ b/apps/web-naive/src/api/system/notify/template/index.ts @@ -0,0 +1,72 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemNotifyTemplateApi { + /** 站内信模板信息 */ + export interface NotifyTemplate { + id?: number; + name: string; + nickname: string; + code: string; + content: string; + type?: number; + params: string[]; + status: number; + remark: string; + } + + /** 发送站内信请求 */ + export interface NotifySendReqVO { + userId: number; + userType: number; + templateCode: string; + templateParams: Record; + } +} + +/** 查询站内信模板列表 */ +export function getNotifyTemplatePage(params: PageParam) { + return requestClient.get>( + '/system/notify-template/page', + { params }, + ); +} + +/** 查询站内信模板详情 */ +export function getNotifyTemplate(id: number) { + return requestClient.get( + `/system/notify-template/get?id=${id}`, + ); +} + +/** 新增站内信模板 */ +export function createNotifyTemplate( + data: SystemNotifyTemplateApi.NotifyTemplate, +) { + return requestClient.post('/system/notify-template/create', data); +} + +/** 修改站内信模板 */ +export function updateNotifyTemplate( + data: SystemNotifyTemplateApi.NotifyTemplate, +) { + return requestClient.put('/system/notify-template/update', data); +} + +/** 删除站内信模板 */ +export function deleteNotifyTemplate(id: number) { + return requestClient.delete(`/system/notify-template/delete?id=${id}`); +} + +/** 导出站内信模板 */ +export function exportNotifyTemplate(params: any) { + return requestClient.download('/system/notify-template/export-excel', { + params, + }); +} + +/** 发送站内信 */ +export function sendNotify(data: SystemNotifyTemplateApi.NotifySendReqVO) { + return requestClient.post('/system/notify-template/send-notify', data); +} diff --git a/apps/web-naive/src/api/system/oauth2/client/index.ts b/apps/web-naive/src/api/system/oauth2/client/index.ts new file mode 100644 index 00000000..7c1db774 --- /dev/null +++ b/apps/web-naive/src/api/system/oauth2/client/index.ts @@ -0,0 +1,57 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemOAuth2ClientApi { + /** OAuth2.0 客户端信息 */ + export interface OAuth2Client { + id?: number; + clientId: string; + secret: string; + name: string; + logo: string; + description: string; + status: number; + accessTokenValiditySeconds: number; + refreshTokenValiditySeconds: number; + redirectUris: string[]; + autoApprove: boolean; + authorizedGrantTypes: string[]; + scopes: string[]; + authorities: string[]; + resourceIds: string[]; + additionalInformation: string; + isAdditionalInformationJson: boolean; + createTime?: Date; + } +} + +/** 查询 OAuth2.0 客户端列表 */ +export function getOAuth2ClientPage(params: PageParam) { + return requestClient.get>( + '/system/oauth2-client/page', + { params }, + ); +} + +/** 查询 OAuth2.0 客户端详情 */ +export function getOAuth2Client(id: number) { + return requestClient.get( + `/system/oauth2-client/get?id=${id}`, + ); +} + +/** 新增 OAuth2.0 客户端 */ +export function createOAuth2Client(data: SystemOAuth2ClientApi.OAuth2Client) { + return requestClient.post('/system/oauth2-client/create', data); +} + +/** 修改 OAuth2.0 客户端 */ +export function updateOAuth2Client(data: SystemOAuth2ClientApi.OAuth2Client) { + return requestClient.put('/system/oauth2-client/update', data); +} + +/** 删除 OAuth2.0 客户端 */ +export function deleteOAuth2Client(id: number) { + return requestClient.delete(`/system/oauth2-client/delete?id=${id}`); +} diff --git a/apps/web-naive/src/api/system/oauth2/open/index.ts b/apps/web-naive/src/api/system/oauth2/open/index.ts new file mode 100644 index 00000000..16d9c7e6 --- /dev/null +++ b/apps/web-naive/src/api/system/oauth2/open/index.ts @@ -0,0 +1,58 @@ +import { requestClient } from '#/api/request'; + +/** OAuth2.0 授权信息响应 */ +export namespace SystemOAuth2ClientApi { + /** 授权信息 */ + export interface AuthorizeInfoRespVO { + client: { + logo: string; + name: string; + }; + scopes: { + key: string; + value: boolean; + }[]; + } +} + +/** 获得授权信息 */ +export function getAuthorize(clientId: string) { + return requestClient.get( + `/system/oauth2/authorize?clientId=${clientId}`, + ); +} + +/** 发起授权 */ +export function authorize( + responseType: string, + clientId: string, + redirectUri: string, + state: string, + autoApprove: boolean, + checkedScopes: string[], + uncheckedScopes: string[], +) { + // 构建 scopes + const scopes: Record = {}; + for (const scope of checkedScopes) { + scopes[scope] = true; + } + for (const scope of uncheckedScopes) { + scopes[scope] = false; + } + + // 发起请求 + return requestClient.post('/system/oauth2/authorize', null, { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + params: { + response_type: responseType, + client_id: clientId, + redirect_uri: redirectUri, + state, + auto_approve: autoApprove, + scope: JSON.stringify(scopes), + }, + }); +} diff --git a/apps/web-naive/src/api/system/oauth2/token/index.ts b/apps/web-naive/src/api/system/oauth2/token/index.ts new file mode 100644 index 00000000..bd369791 --- /dev/null +++ b/apps/web-naive/src/api/system/oauth2/token/index.ts @@ -0,0 +1,34 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemOAuth2TokenApi { + /** OAuth2.0 令牌信息 */ + export interface OAuth2Token { + id?: number; + accessToken: string; + refreshToken: string; + userId: number; + userType: number; + clientId: string; + createTime?: Date; + expiresTime?: Date; + } +} + +/** 查询 OAuth2.0 令牌列表 */ +export function getOAuth2TokenPage(params: PageParam) { + return requestClient.get>( + '/system/oauth2-token/page', + { + params, + }, + ); +} + +/** 删除 OAuth2.0 令牌 */ +export function deleteOAuth2Token(accessToken: string) { + return requestClient.delete( + `/system/oauth2-token/delete?accessToken=${accessToken}`, + ); +} diff --git a/apps/web-naive/src/api/system/operate-log/index.ts b/apps/web-naive/src/api/system/operate-log/index.ts new file mode 100644 index 00000000..8b84a260 --- /dev/null +++ b/apps/web-naive/src/api/system/operate-log/index.ts @@ -0,0 +1,39 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemOperateLogApi { + /** 操作日志信息 */ + export interface OperateLog { + id: number; + traceId: string; + userType: number; + userId: number; + userName: string; + type: string; + subType: string; + bizId: number; + action: string; + extra: string; + requestMethod: string; + requestUrl: string; + userIp: string; + userAgent: string; + creator: string; + creatorName: string; + createTime: string; + } +} + +/** 查询操作日志列表 */ +export function getOperateLogPage(params: PageParam) { + return requestClient.get>( + '/system/operate-log/page', + { params }, + ); +} + +/** 导出操作日志 */ +export function exportOperateLog(params: any) { + return requestClient.download('/system/operate-log/export-excel', { params }); +} diff --git a/apps/web-naive/src/api/system/permission/index.ts b/apps/web-naive/src/api/system/permission/index.ts new file mode 100644 index 00000000..9039d9a0 --- /dev/null +++ b/apps/web-naive/src/api/system/permission/index.ts @@ -0,0 +1,57 @@ +import { requestClient } from '#/api/request'; + +export namespace SystemPermissionApi { + /** 分配用户角色请求 */ + export interface AssignUserRoleReqVO { + userId: number; + roleIds: number[]; + } + + /** 分配角色菜单请求 */ + export interface AssignRoleMenuReqVO { + roleId: number; + menuIds: number[]; + } + + /** 分配角色数据权限请求 */ + export interface AssignRoleDataScopeReqVO { + roleId: number; + dataScope: number; + dataScopeDeptIds: number[]; + } +} + +/** 查询角色拥有的菜单权限 */ +export async function getRoleMenuList(roleId: number) { + return requestClient.get( + `/system/permission/list-role-menus?roleId=${roleId}`, + ); +} + +/** 赋予角色菜单权限 */ +export async function assignRoleMenu( + data: SystemPermissionApi.AssignRoleMenuReqVO, +) { + return requestClient.post('/system/permission/assign-role-menu', data); +} + +/** 赋予角色数据权限 */ +export async function assignRoleDataScope( + data: SystemPermissionApi.AssignRoleDataScopeReqVO, +) { + return requestClient.post('/system/permission/assign-role-data-scope', data); +} + +/** 查询用户拥有的角色数组 */ +export async function getUserRoleList(userId: number) { + return requestClient.get( + `/system/permission/list-user-roles?userId=${userId}`, + ); +} + +/** 赋予用户角色 */ +export async function assignUserRole( + data: SystemPermissionApi.AssignUserRoleReqVO, +) { + return requestClient.post('/system/permission/assign-user-role', data); +} diff --git a/apps/web-naive/src/api/system/post/index.ts b/apps/web-naive/src/api/system/post/index.ts new file mode 100644 index 00000000..a82f5815 --- /dev/null +++ b/apps/web-naive/src/api/system/post/index.ts @@ -0,0 +1,58 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemPostApi { + /** 岗位信息 */ + export interface Post { + id?: number; + name: string; + code: string; + sort: number; + status: number; + remark: string; + createTime?: Date; + } +} + +/** 查询岗位列表 */ +export function getPostPage(params: PageParam) { + return requestClient.get>( + '/system/post/page', + { + params, + }, + ); +} + +/** 获取岗位精简信息列表 */ +export function getSimplePostList() { + return requestClient.get('/system/post/simple-list'); +} + +/** 查询岗位详情 */ +export function getPost(id: number) { + return requestClient.get(`/system/post/get?id=${id}`); +} + +/** 新增岗位 */ +export function createPost(data: SystemPostApi.Post) { + return requestClient.post('/system/post/create', data); +} + +/** 修改岗位 */ +export function updatePost(data: SystemPostApi.Post) { + return requestClient.put('/system/post/update', data); +} + +/** 删除岗位 */ +export function deletePost(id: number) { + return requestClient.delete(`/system/post/delete?id=${id}`); +} + +/** 导出岗位 */ +export function exportPost(params: any) { + return requestClient.download('/system/post/export', { + params, + }); +} diff --git a/apps/web-naive/src/api/system/role/index.ts b/apps/web-naive/src/api/system/role/index.ts new file mode 100644 index 00000000..07824c43 --- /dev/null +++ b/apps/web-naive/src/api/system/role/index.ts @@ -0,0 +1,58 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemRoleApi { + /** 角色信息 */ + export interface Role { + id?: number; + name: string; + code: string; + sort: number; + status: number; + type: number; + dataScope: number; + dataScopeDeptIds: number[]; + createTime?: Date; + } +} + +/** 查询角色列表 */ +export function getRolePage(params: PageParam) { + return requestClient.get>( + '/system/role/page', + { params }, + ); +} + +/** 查询角色(精简)列表 */ +export function getSimpleRoleList() { + return requestClient.get('/system/role/simple-list'); +} + +/** 查询角色详情 */ +export function getRole(id: number) { + return requestClient.get(`/system/role/get?id=${id}`); +} + +/** 新增角色 */ +export function createRole(data: SystemRoleApi.Role) { + return requestClient.post('/system/role/create', data); +} + +/** 修改角色 */ +export function updateRole(data: SystemRoleApi.Role) { + return requestClient.put('/system/role/update', data); +} + +/** 删除角色 */ +export function deleteRole(id: number) { + return requestClient.delete(`/system/role/delete?id=${id}`); +} + +/** 导出角色 */ +export function exportRole(params: any) { + return requestClient.download('/system/role/export-excel', { + params, + }); +} diff --git a/apps/web-naive/src/api/system/sms/channel/index.ts b/apps/web-naive/src/api/system/sms/channel/index.ts new file mode 100644 index 00000000..56890bea --- /dev/null +++ b/apps/web-naive/src/api/system/sms/channel/index.ts @@ -0,0 +1,60 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSmsChannelApi { + /** 短信渠道信息 */ + export interface SmsChannel { + id?: number; + code: string; + status: number; + signature: string; + remark: string; + apiKey: string; + apiSecret: string; + callbackUrl: string; + createTime?: Date; + } +} + +/** 查询短信渠道列表 */ +export function getSmsChannelPage(params: PageParam) { + return requestClient.get>( + '/system/sms-channel/page', + { params }, + ); +} + +/** 获得短信渠道精简列表 */ +export function getSimpleSmsChannelList() { + return requestClient.get( + '/system/sms-channel/simple-list', + ); +} + +/** 查询短信渠道详情 */ +export function getSmsChannel(id: number) { + return requestClient.get( + `/system/sms-channel/get?id=${id}`, + ); +} + +/** 新增短信渠道 */ +export function createSmsChannel(data: SystemSmsChannelApi.SmsChannel) { + return requestClient.post('/system/sms-channel/create', data); +} + +/** 修改短信渠道 */ +export function updateSmsChannel(data: SystemSmsChannelApi.SmsChannel) { + return requestClient.put('/system/sms-channel/update', data); +} + +/** 删除短信渠道 */ +export function deleteSmsChannel(id: number) { + return requestClient.delete(`/system/sms-channel/delete?id=${id}`); +} + +/** 导出短信渠道 */ +export function exportSmsChannel(params: any) { + return requestClient.download('/system/sms-channel/export', { params }); +} diff --git a/apps/web-naive/src/api/system/sms/log/index.ts b/apps/web-naive/src/api/system/sms/log/index.ts new file mode 100644 index 00000000..8344f993 --- /dev/null +++ b/apps/web-naive/src/api/system/sms/log/index.ts @@ -0,0 +1,45 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSmsLogApi { + /** 短信日志信息 */ + export interface SmsLog { + id?: number; + channelId?: number; + channelCode: string; + templateId?: number; + templateCode: string; + templateType?: number; + templateContent: string; + templateParams?: Record; + apiTemplateId: string; + mobile: string; + userId?: number; + userType?: number; + sendStatus?: number; + sendTime?: string; + apiSendCode: string; + apiSendMsg: string; + apiRequestId: string; + apiSerialNo: string; + receiveStatus?: number; + receiveTime?: string; + apiReceiveCode: string; + apiReceiveMsg: string; + createTime: string; + } +} + +/** 查询短信日志列表 */ +export function getSmsLogPage(params: PageParam) { + return requestClient.get>( + '/system/sms-log/page', + { params }, + ); +} + +/** 导出短信日志 */ +export function exportSmsLog(params: any) { + return requestClient.download('/system/sms-log/export-excel', { params }); +} diff --git a/apps/web-naive/src/api/system/sms/template/index.ts b/apps/web-naive/src/api/system/sms/template/index.ts new file mode 100644 index 00000000..63660bdf --- /dev/null +++ b/apps/web-naive/src/api/system/sms/template/index.ts @@ -0,0 +1,70 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSmsTemplateApi { + /** 短信模板信息 */ + export interface SmsTemplate { + id?: number; + type?: number; + status: number; + code: string; + name: string; + content: string; + remark: string; + apiTemplateId: string; + channelId?: number; + channelCode?: string; + params?: string[]; + createTime?: Date; + } + + /** 发送短信请求 */ + export interface SmsSendReqVO { + mobile: string; + templateCode: string; + templateParams: Record; + } +} + +/** 查询短信模板列表 */ +export function getSmsTemplatePage(params: PageParam) { + return requestClient.get>( + '/system/sms-template/page', + { params }, + ); +} + +/** 查询短信模板详情 */ +export function getSmsTemplate(id: number) { + return requestClient.get( + `/system/sms-template/get?id=${id}`, + ); +} + +/** 新增短信模板 */ +export function createSmsTemplate(data: SystemSmsTemplateApi.SmsTemplate) { + return requestClient.post('/system/sms-template/create', data); +} + +/** 修改短信模板 */ +export function updateSmsTemplate(data: SystemSmsTemplateApi.SmsTemplate) { + return requestClient.put('/system/sms-template/update', data); +} + +/** 删除短信模板 */ +export function deleteSmsTemplate(id: number) { + return requestClient.delete(`/system/sms-template/delete?id=${id}`); +} + +/** 导出短信模板 */ +export function exportSmsTemplate(params: any) { + return requestClient.download('/system/sms-template/export-excel', { + params, + }); +} + +/** 发送短信 */ +export function sendSms(data: SystemSmsTemplateApi.SmsSendReqVO) { + return requestClient.post('/system/sms-template/send-sms', data); +} diff --git a/apps/web-naive/src/api/system/social/client/index.ts b/apps/web-naive/src/api/system/social/client/index.ts new file mode 100644 index 00000000..d4da4dd4 --- /dev/null +++ b/apps/web-naive/src/api/system/social/client/index.ts @@ -0,0 +1,48 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSocialClientApi { + /** 社交客户端信息 */ + export interface SocialClient { + id?: number; + name: string; + socialType: number; + userType: number; + clientId: string; + clientSecret: string; + agentId?: string; + status: number; + createTime?: Date; + } +} + +/** 查询社交客户端列表 */ +export function getSocialClientPage(params: PageParam) { + return requestClient.get>( + '/system/social-client/page', + { params }, + ); +} + +/** 查询社交客户端详情 */ +export function getSocialClient(id: number) { + return requestClient.get( + `/system/social-client/get?id=${id}`, + ); +} + +/** 新增社交客户端 */ +export function createSocialClient(data: SystemSocialClientApi.SocialClient) { + return requestClient.post('/system/social-client/create', data); +} + +/** 修改社交客户端 */ +export function updateSocialClient(data: SystemSocialClientApi.SocialClient) { + return requestClient.put('/system/social-client/update', data); +} + +/** 删除社交客户端 */ +export function deleteSocialClient(id: number) { + return requestClient.delete(`/system/social-client/delete?id=${id}`); +} diff --git a/apps/web-naive/src/api/system/social/user/index.ts b/apps/web-naive/src/api/system/social/user/index.ts new file mode 100644 index 00000000..b91f1506 --- /dev/null +++ b/apps/web-naive/src/api/system/social/user/index.ts @@ -0,0 +1,66 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemSocialUserApi { + /** 社交用户信息 */ + export interface SocialUser { + id?: number; + type: number; + openid: string; + token: string; + rawTokenInfo: string; + nickname: string; + avatar: string; + rawUserInfo: string; + code: string; + state: string; + createTime?: Date; + updateTime?: Date; + } + + /** 社交绑定请求 */ + export interface SocialUserBindReqVO { + type: number; + code: string; + state: string; + } + + /** 取消社交绑定请求 */ + export interface SocialUserUnbindReqVO { + type: number; + openid: string; + } +} + +/** 查询社交用户列表 */ +export function getSocialUserPage(params: PageParam) { + return requestClient.get>( + '/system/social-user/page', + { params }, + ); +} + +/** 查询社交用户详情 */ +export function getSocialUser(id: number) { + return requestClient.get( + `/system/social-user/get?id=${id}`, + ); +} + +/** 社交绑定,使用 code 授权码 */ +export function socialBind(data: SystemSocialUserApi.SocialUserBindReqVO) { + return requestClient.post('/system/social-user/bind', data); +} + +/** 取消社交绑定 */ +export function socialUnbind(data: SystemSocialUserApi.SocialUserUnbindReqVO) { + return requestClient.delete('/system/social-user/unbind', { data }); +} + +/** 获得绑定社交用户列表 */ +export function getBindSocialUserList() { + return requestClient.get( + '/system/social-user/get-bind-list', + ); +} diff --git a/apps/web-naive/src/api/system/tenant-package/index.ts b/apps/web-naive/src/api/system/tenant-package/index.ts new file mode 100644 index 00000000..5066cea9 --- /dev/null +++ b/apps/web-naive/src/api/system/tenant-package/index.ts @@ -0,0 +1,57 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemTenantPackageApi { + /** 租户套餐信息 */ + export interface TenantPackage { + id: number; + name: string; + status: number; + remark: string; + creator: string; + updater: string; + updateTime: string; + menuIds: number[]; + createTime: Date; + } +} + +/** 租户套餐列表 */ +export function getTenantPackagePage(params: PageParam) { + return requestClient.get>( + '/system/tenant-package/page', + { params }, + ); +} + +/** 查询租户套餐详情 */ +export function getTenantPackage(id: number) { + return requestClient.get(`/system/tenant-package/get?id=${id}`); +} + +/** 新增租户套餐 */ +export function createTenantPackage( + data: SystemTenantPackageApi.TenantPackage, +) { + return requestClient.post('/system/tenant-package/create', data); +} + +/** 修改租户套餐 */ +export function updateTenantPackage( + data: SystemTenantPackageApi.TenantPackage, +) { + return requestClient.put('/system/tenant-package/update', data); +} + +/** 删除租户套餐 */ +export function deleteTenantPackage(id: number) { + return requestClient.delete(`/system/tenant-package/delete?id=${id}`); +} + +/** 获取租户套餐精简信息列表 */ +export function getTenantPackageList() { + return requestClient.get( + '/system/tenant-package/get-simple-list', + ); +} diff --git a/apps/web-naive/src/api/system/tenant/index.ts b/apps/web-naive/src/api/system/tenant/index.ts new file mode 100644 index 00000000..3bed9249 --- /dev/null +++ b/apps/web-naive/src/api/system/tenant/index.ts @@ -0,0 +1,69 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemTenantApi { + /** 租户信息 */ + export interface Tenant { + id?: number; + name: string; + packageId: number; + contactName: string; + contactMobile: string; + accountCount: number; + expireTime: Date; + website: string; + status: number; + } +} + +/** 租户列表 */ +export function getTenantPage(params: PageParam) { + return requestClient.get>( + '/system/tenant/page', + { params }, + ); +} + +/** 获取租户精简信息列表 */ +export function getSimpleTenantList() { + return requestClient.get( + '/system/tenant/simple-list', + ); +} + +/** 查询租户详情 */ +export function getTenant(id: number) { + return requestClient.get( + `/system/tenant/get?id=${id}`, + ); +} + +/** 获取租户精简信息列表 */ +export function getTenantList() { + return requestClient.get( + '/system/tenant/simple-list', + ); +} + +/** 新增租户 */ +export function createTenant(data: SystemTenantApi.Tenant) { + return requestClient.post('/system/tenant/create', data); +} + +/** 修改租户 */ +export function updateTenant(data: SystemTenantApi.Tenant) { + return requestClient.put('/system/tenant/update', data); +} + +/** 删除租户 */ +export function deleteTenant(id: number) { + return requestClient.delete(`/system/tenant/delete?id=${id}`); +} + +/** 导出租户 */ +export function exportTenant(params: any) { + return requestClient.download('/system/tenant/export-excel', { + params, + }); +} diff --git a/apps/web-naive/src/api/system/user/index.ts b/apps/web-naive/src/api/system/user/index.ts new file mode 100644 index 00000000..52d8cdd2 --- /dev/null +++ b/apps/web-naive/src/api/system/user/index.ts @@ -0,0 +1,83 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemUserApi { + /** 用户信息 */ + export interface User { + id?: number; + username: string; + nickname: string; + deptId: number; + postIds: string[]; + email: string; + mobile: string; + sex: number; + avatar: string; + loginIp: string; + status: number; + remark: string; + createTime?: Date; + } +} + +/** 查询用户管理列表 */ +export function getUserPage(params: PageParam) { + return requestClient.get>( + '/system/user/page', + { params }, + ); +} + +/** 查询用户详情 */ +export function getUser(id: number) { + return requestClient.get(`/system/user/get?id=${id}`); +} + +/** 新增用户 */ +export function createUser(data: SystemUserApi.User) { + return requestClient.post('/system/user/create', data); +} + +/** 修改用户 */ +export function updateUser(data: SystemUserApi.User) { + return requestClient.put('/system/user/update', data); +} + +/** 删除用户 */ +export function deleteUser(id: number) { + return requestClient.delete(`/system/user/delete?id=${id}`); +} + +/** 导出用户 */ +export function exportUser(params: any) { + return requestClient.download('/system/user/export', params); +} + +/** 下载用户导入模板 */ +export function importUserTemplate() { + return requestClient.download('/system/user/get-import-template'); +} + +/** 导入用户 */ +export function importUser(file: File, updateSupport: boolean) { + return requestClient.upload('/system/user/import', { + file, + updateSupport, + }); +} + +/** 用户密码重置 */ +export function resetUserPassword(id: number, password: string) { + return requestClient.put('/system/user/update-password', { id, password }); +} + +/** 用户状态修改 */ +export function updateUserStatus(id: number, status: number) { + return requestClient.put('/system/user/update-status', { id, status }); +} + +/** 获取用户精简信息列表 */ +export function getSimpleUserList() { + return requestClient.get('/system/user/simple-list'); +} diff --git a/apps/web-naive/src/api/system/user/profile/index.ts b/apps/web-naive/src/api/system/user/profile/index.ts new file mode 100644 index 00000000..97898e71 --- /dev/null +++ b/apps/web-naive/src/api/system/user/profile/index.ts @@ -0,0 +1,56 @@ +import { requestClient } from '#/api/request'; + +export namespace SystemUserProfileApi { + /** 用户个人中心信息 */ + export interface UserProfileRespVO { + id: number; + username: string; + nickname: string; + email?: string; + mobile?: string; + sex?: number; + avatar?: string; + loginIp: string; + loginDate: string; + createTime: string; + roles: any[]; + dept: any; + posts: any[]; + } + + /** 更新密码请求 */ + export interface UpdatePasswordReqVO { + oldPassword: string; + newPassword: string; + } + + /** 更新个人信息请求 */ + export interface UpdateProfileReqVO { + nickname?: string; + email?: string; + mobile?: string; + sex?: number; + avatar?: string; + } +} + +/** 获取登录用户信息 */ +export function getUserProfile() { + return requestClient.get( + '/system/user/profile/get', + ); +} + +/** 修改用户个人信息 */ +export function updateUserProfile( + data: SystemUserProfileApi.UpdateProfileReqVO, +) { + return requestClient.put('/system/user/profile/update', data); +} + +/** 修改用户个人密码 */ +export function updateUserPassword( + data: SystemUserProfileApi.UpdatePasswordReqVO, +) { + return requestClient.put('/system/user/profile/update-password', data); +}