重构接口方法和对接账户管理接口

This commit is contained in:
ah--desktop
2025-10-15 23:02:07 +08:00
parent 64ad74c15c
commit 3354f154b1
47 changed files with 625 additions and 382 deletions
@@ -1,5 +1,5 @@
/**
* 组织管理模块API导出
* 文件管理模块API导出
*/
export * from './apis';
@@ -0,0 +1,6 @@
/**
* 文件管理模块类型定义导出
*/
export * from './dto';
export * from './vo';
@@ -0,0 +1,6 @@
/**
* 图片管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 图片管理模块类型定义导出
*/
export * from './dto';
export * from './vo';
@@ -1,12 +0,0 @@
/**
* 媒体管理模块API导出
*/
// 文件相关API
export * from './file.apis';
// 图片相关API
export * from './image.apis';
// 类型定义
export * from './types';
@@ -1,11 +0,0 @@
/**
* 媒体管理模块类型定义导出
*/
// DTO类型导出
export * from './dto.file';
export * from './dto.image';
// VO类型导出
export * from './vo.file';
export * from './vo.image';
@@ -0,0 +1,63 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { AccountDTO, AccountVO } from './types';
/**
* 账户管理API
*/
// ==================== 超管接口 ====================
/**
* 创建账户(超管)
*/
export async function createAccountApi(data: AccountDTO.CreateAccountDTO) {
return requestClient.post<AccountVO.AccountInfoVO>('/account/create', data);
}
/**
* 分页查询账户(超管)
*/
export async function getAccountPageApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
return requestClient.get<AccountVO.AccountPageVO>('/account/page', { params });
}
// ==================== 管理员接口 ====================
/**
* 创建账户(管理员)
*/
export async function createAccountForCompanyApi(data: AccountDTO.CreateAccountDTO) {
return requestClient.post<AccountVO.AccountInfoVO>('/account/company/create', data);
}
/**
* 分页查询账户(管理员)
*/
export async function getAccountPageForCompanyApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
return requestClient.get<AccountVO.AccountPageVO>('/account/company/page', { params });
}
// ==================== 通用接口 ====================
/**
* 更新账户信息
*/
export async function updateAccountApi(accountId: number, data: AccountDTO.UpdateAccountDTO) {
return requestClient.put<AccountVO.AccountInfoVO>(`/account/${accountId}`, data);
}
/**
* 删除账户
*/
export async function deleteAccountApi(accountId: number) {
return requestClient.delete<void>(`/account/${accountId}`);
}
/**
* 获取账户详情
*/
export async function getAccountDetailApi(accountId: number) {
return requestClient.get<AccountVO.AccountInfoVO>(`/account/${accountId}`);
}
@@ -0,0 +1,6 @@
/**
* 账户管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -1,5 +1,5 @@
/**
* 组织管理模块类型定义导出
* 账户管理模块类型定义导出
*/
export * from './types.dto';
@@ -0,0 +1,71 @@
/**
* 账户管理模块DTO类型定义
*/
export namespace AccountDTO {
/** 创建账户参数 */
export interface CreateAccountDTO {
/** 用户名 */
username: string;
/** 密码 */
password: string;
/** 真实姓名 */
realName: string;
/** 邮箱 */
email?: string;
/** 手机号 */
phone?: string;
/** 公司ID */
companyId?: number;
/** 部门ID */
departmentId?: number;
/** 职位ID */
positionId?: number;
/** 角色ID */
roleId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
}
/** 更新账户参数 */
export interface UpdateAccountDTO {
/** 真实姓名 */
realName?: string;
/** 邮箱 */
email?: string;
/** 手机号 */
phone?: string;
/** 公司ID */
companyId?: number;
/** 部门ID */
departmentId?: number;
/** 职位ID */
positionId?: number;
/** 角色ID */
roleId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
}
/** 账户过滤条件 */
export interface AccountFilterDTO {
/** 用户名(模糊查询) */
username?: string;
/** 真实姓名(模糊查询) */
realName?: string;
/** 邮箱(精确查询) */
email?: string;
/** 手机号(精确查询) */
phone?: string;
/** 公司ID */
companyId?: number;
/** 部门ID */
departmentId?: number;
/** 职位ID */
positionId?: number;
/** 角色ID */
roleId?: number;
/** 状态 */
status?: number;
}
}
@@ -0,0 +1,53 @@
/**
* 账户管理模块VO类型定义
*/
export namespace AccountVO {
/** 账户信息 */
export interface AccountInfoVO {
/** 账户ID */
id: number;
/** 用户名 */
username: string;
/** 真实姓名 */
realName: string;
/** 邮箱 */
email?: string;
/** 手机号 */
phone?: string;
/** 公司ID */
companyId?: number;
/** 公司名称 */
companyName?: string;
/** 部门ID */
departmentId?: number;
/** 部门名称 */
departmentName?: string;
/** 职位ID */
positionId?: number;
/** 职位名称 */
positionName?: string;
/** 角色ID */
roleId?: number;
/** 角色名称 */
roleName?: string;
/** 状态 (0-禁用 1-正常) */
status: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
}
/** 账户分页结果 */
export interface AccountPageVO {
/** 总记录数 */
total: number;
/** 当前页码 */
current: number;
/** 每页大小 */
size: number;
/** 账户列表 */
records: AccountInfoVO[];
}
}
@@ -1,113 +0,0 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { CompanyDTO, CompanyVO, DepartmentDTO, DepartmentVO, PositionDTO, PositionVO } from './types';
/**
* 公司管理API
*/
/**
* 分页获取公司列表
*/
export async function getCompanyPageApi(params: PageQueryDTO<CompanyDTO.CompanyFiltersDTO>) {
return requestClient.post<PageResultVO<CompanyVO.CompanyInfoVO>>('/company/page', params);
}
/**
* 创建公司
*/
export async function createCompanyApi(data: CompanyDTO.CreateCompanyDTO) {
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/create', data);
}
/**
* 更新公司
*/
export async function updateCompanyApi(id: number, data: CompanyDTO.UpdateCompanyDTO) {
return requestClient.put<CompanyVO.CompanyInfoVO>(`/company/update/${id}`, data);
}
/**
* 删除公司
*/
export async function deleteCompanyApi(id: number) {
return requestClient.delete<void>(`/company/delete/${id}`);
}
/**
* 上传公司Logo
*/
export async function uploadCompanyLogoApi(file: File) {
const formData = new FormData();
formData.append('file', file);
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/upload-logo', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
}
/**
* 部门管理API
*/
/**
* 分页获取部门列表
*/
export async function getDepartmentPageApi(params: PageQueryDTO<DepartmentDTO.DepartmentFiltersDTO>) {
return requestClient.post<PageResultVO<DepartmentVO.DepartmentInfoVO>>('/department/page', params);
}
/**
* 创建部门
*/
export async function createDepartmentApi(data: DepartmentDTO.CreateDepartmentDTO) {
return requestClient.post<DepartmentVO.DepartmentInfoVO>('/department/create', data);
}
/**
* 更新部门
*/
export async function updateDepartmentApi(id: number, data: DepartmentDTO.UpdateDepartmentDTO) {
return requestClient.put<DepartmentVO.DepartmentInfoVO>(`/department/update/${id}`, data);
}
/**
* 删除部门
*/
export async function deleteDepartmentApi(id: number) {
return requestClient.delete<void>(`/department/delete/${id}`);
}
/**
* 岗位管理API
*/
/**
* 分页获取岗位列表
*/
export async function getPositionPageApi(params: PageQueryDTO<PositionDTO.PositionFiltersDTO>) {
return requestClient.post<PageResultVO<PositionVO.PositionInfoVO>>('/position/page', params);
}
/**
* 创建岗位
*/
export async function createPositionApi(data: PositionDTO.CreatePositionDTO) {
return requestClient.post<PositionVO.PositionInfoVO>('/position/create', data);
}
/**
* 更新岗位
*/
export async function updatePositionApi(id: number, data: PositionDTO.UpdatePositionDTO) {
return requestClient.put<PositionVO.PositionInfoVO>(`/position/update/${id}`, data);
}
/**
* 删除岗位
*/
export async function deletePositionApi(id: number) {
return requestClient.delete<void>(`/position/delete/${id}`);
}
@@ -0,0 +1,49 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { CompanyDTO, CompanyVO } from './types';
/**
* 公司管理API
*/
/**
* 分页获取公司列表
*/
export async function getCompanyPageApi(params: PageQueryDTO<CompanyDTO.CompanyFiltersDTO>) {
return requestClient.post<PageResultVO<CompanyVO.CompanyInfoVO>>('/company/page', params);
}
/**
* 创建公司
*/
export async function createCompanyApi(data: CompanyDTO.CreateCompanyDTO) {
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/create', data);
}
/**
* 更新公司
*/
export async function updateCompanyApi(id: number, data: CompanyDTO.UpdateCompanyDTO) {
return requestClient.put<CompanyVO.CompanyInfoVO>(`/company/update/${id}`, data);
}
/**
* 删除公司
*/
export async function deleteCompanyApi(id: number) {
return requestClient.delete<void>(`/company/delete/${id}`);
}
/**
* 上传公司Logo
*/
export async function uploadCompanyLogoApi(file: File) {
const formData = new FormData();
formData.append('file', file);
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/upload-logo', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
}
@@ -0,0 +1,6 @@
/**
* 公司管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 公司管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,61 @@
/**
* 公司管理模块DTO类型定义
*/
export namespace CompanyDTO {
/** 创建公司参数 */
export interface CreateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo图片ID */
logoImageId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 更新公司参数 */
export interface UpdateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo图片ID */
logoImageId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 公司过滤条件 */
export interface CompanyFiltersDTO {
/** 公司名称(模糊查询) */
name?: string;
/** 联系人(模糊查询) */
contactPerson?: string;
/** 联系电话(精确查询) */
contactPhone?: string;
/** 邮箱(精确查询) */
email?: string;
/** 状态 */
status?: number;
/** 过期状态查询 */
expired?: boolean;
}
}
@@ -0,0 +1,35 @@
/**
* 公司管理模块VO类型定义
*/
export namespace CompanyVO {
/** 公司信息 */
export interface CompanyInfoVO {
/** 公司ID */
id: number;
/** 公司名称 */
name: string;
/** 订阅到期时间 */
expiration?: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo */
logo?: string;
/** 状态 (0-禁用 1-正常) */
status: number;
/** 订阅到期时间 */
expireTime?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 是否过期 */
expired?: boolean;
}
}
@@ -0,0 +1,36 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { DepartmentDTO, DepartmentVO } from './types';
/**
* 部门管理API
*/
/**
* 分页获取部门列表
*/
export async function getDepartmentPageApi(params: PageQueryDTO<DepartmentDTO.DepartmentFiltersDTO>) {
return requestClient.post<PageResultVO<DepartmentVO.DepartmentInfoVO>>('/department/page', params);
}
/**
* 创建部门
*/
export async function createDepartmentApi(data: DepartmentDTO.CreateDepartmentDTO) {
return requestClient.post<DepartmentVO.DepartmentInfoVO>('/department/create', data);
}
/**
* 更新部门
*/
export async function updateDepartmentApi(id: number, data: DepartmentDTO.UpdateDepartmentDTO) {
return requestClient.put<DepartmentVO.DepartmentInfoVO>(`/department/update/${id}`, data);
}
/**
* 删除部门
*/
export async function deleteDepartmentApi(id: number) {
return requestClient.delete<void>(`/department/delete/${id}`);
}
@@ -0,0 +1,6 @@
/**
* 部门管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 部门管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,39 @@
/**
* 部门管理模块DTO类型定义
*/
export namespace DepartmentDTO {
/** 创建部门参数 */
export interface CreateDepartmentDTO {
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 更新部门参数 */
export interface UpdateDepartmentDTO {
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 部门过滤条件 */
export interface DepartmentFiltersDTO {
/** 部门名称(模糊查询) */
name?: string;
/** 父级部门ID */
parentId?: number;
/** 状态 */
status?: number;
}
}
@@ -0,0 +1,31 @@
/**
* 部门管理模块VO类型定义
*/
export namespace DepartmentVO {
/** 部门信息 */
export interface DepartmentInfoVO {
/** 部门ID */
id: number;
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 公司ID */
companyId: number;
/** 备注 */
remark?: string;
/** 状态 */
status: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
/** 子部门 */
children?: DepartmentInfoVO[];
}
}
@@ -0,0 +1,36 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { PositionDTO, PositionVO } from './types';
/**
* 岗位管理API
*/
/**
* 分页获取岗位列表
*/
export async function getPositionPageApi(params: PageQueryDTO<PositionDTO.PositionFiltersDTO>) {
return requestClient.post<PageResultVO<PositionVO.PositionInfoVO>>('/position/page', params);
}
/**
* 创建岗位
*/
export async function createPositionApi(data: PositionDTO.CreatePositionDTO) {
return requestClient.post<PositionVO.PositionInfoVO>('/position/create', data);
}
/**
* 更新岗位
*/
export async function updatePositionApi(id: number, data: PositionDTO.UpdatePositionDTO) {
return requestClient.put<PositionVO.PositionInfoVO>(`/position/update/${id}`, data);
}
/**
* 删除岗位
*/
export async function deletePositionApi(id: number) {
return requestClient.delete<void>(`/position/delete/${id}`);
}
@@ -0,0 +1,6 @@
/**
* 岗位管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 岗位管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,41 @@
/**
* 岗位管理模块DTO类型定义
*/
export namespace PositionDTO {
/** 创建岗位参数 */
export interface CreatePositionDTO {
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 更新岗位参数 */
export interface UpdatePositionDTO {
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 岗位过滤条件 */
export interface PositionFiltersDTO {
/** 岗位名称(模糊查询) */
name?: string;
/** 状态 */
status?: number;
}
}
@@ -0,0 +1,31 @@
/**
* 岗位管理模块VO类型定义
*/
export namespace PositionVO {
/** 岗位信息 */
export interface PositionInfoVO {
/** 岗位ID */
id: number;
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status: number;
/** 公司ID */
companyId: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}
@@ -1,135 +0,0 @@
/**
* 组织管理模块DTO类型定义
*/
export namespace CompanyDTO {
/** 创建公司参数 */
export interface CreateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo图片ID */
logoImageId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 更新公司参数 */
export interface UpdateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo图片ID */
logoImageId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 公司过滤条件 */
export interface CompanyFiltersDTO {
/** 公司名称(模糊查询) */
name?: string;
/** 联系人(模糊查询) */
contactPerson?: string;
/** 联系电话(精确查询) */
contactPhone?: string;
/** 邮箱(精确查询) */
email?: string;
/** 状态 */
status?: number;
/** 过期状态查询 */
expired?: boolean;
}
}
export namespace DepartmentDTO {
/** 创建部门参数 */
export interface CreateDepartmentDTO {
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 更新部门参数 */
export interface UpdateDepartmentDTO {
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 部门过滤条件 */
export interface DepartmentFiltersDTO {
/** 部门名称(模糊查询) */
name?: string;
/** 父级部门ID */
parentId?: number;
/** 状态 */
status?: number;
}
}
export namespace PositionDTO {
/** 创建岗位参数 */
export interface CreatePositionDTO {
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 更新岗位参数 */
export interface UpdatePositionDTO {
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 岗位过滤条件 */
export interface PositionFiltersDTO {
/** 岗位名称(模糊查询) */
name?: string;
/** 状态 */
status?: number;
}
}
@@ -1,91 +0,0 @@
/**
* 组织管理模块VO类型定义
*/
export namespace CompanyVO {
/** 公司信息 */
export interface CompanyInfoVO {
/** 公司ID */
id: number;
/** 公司名称 */
name: string;
/** 订阅到期时间 */
expiration?: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo */
logo?: string;
/** 状态 (0-禁用 1-正常) */
status: number;
/** 订阅到期时间 */
expireTime?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 是否过期 */
expired?: boolean;
}
}
export namespace DepartmentVO {
/** 部门信息 */
export interface DepartmentInfoVO {
/** 部门ID */
id: number;
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 公司ID */
companyId: number;
/** 备注 */
remark?: string;
/** 状态 */
status: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
/** 子部门 */
children?: DepartmentInfoVO[];
}
}
export namespace PositionVO {
/** 岗位信息 */
export interface PositionInfoVO {
/** 岗位ID */
id: number;
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status: number;
/** 公司ID */
companyId: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}