import type { PageParam, PageResult } from '@vben/request';
|
import type { Dayjs } from 'dayjs';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace StudentApi {
|
/** 学生信息 */
|
export interface Student {
|
id: number; // 编号
|
name?: string; // 名字
|
description?: string; // 简介
|
birthday?: string | Dayjs; // 出生日期
|
sex?: number; // 性别
|
enabled?: boolean; // 是否有效
|
avatar?: string; // 头像
|
video?: string; // 附件
|
memo?: string; // 备注
|
}
|
}
|
|
/** 查询学生分页 */
|
export function getStudentPage(params: PageParam) {
|
return requestClient.get<PageResult<StudentApi.Student>>('/infra/student/page', { params });
|
}
|
|
/** 查询学生详情 */
|
export function getStudent(id: number) {
|
return requestClient.get<StudentApi.Student>(`/infra/student/get?id=${id}`);
|
}
|
|
/** 新增学生 */
|
export function createStudent(data: StudentApi.Student) {
|
return requestClient.post('/infra/student/create', data);
|
}
|
|
/** 修改学生 */
|
export function updateStudent(data: StudentApi.Student) {
|
return requestClient.put('/infra/student/update', data);
|
}
|
|
/** 删除学生 */
|
export function deleteStudent(id: number) {
|
return requestClient.delete(`/infra/student/delete?id=${id}`);
|
}
|
|
/** 批量删除学生 */
|
export function deleteStudentList(ids: number[]) {
|
return requestClient.delete(`/infra/student/delete-list?ids=${ids.join(',')}`)
|
}
|
|
/** 导出学生 */
|
export function exportStudent(params: any) {
|
return requestClient.download('/infra/student/export-excel', { params });
|
}
|
|
/** 下载学生导入模板 */
|
export function importStudentTemplate() {
|
return requestClient.download('/infra/student/get-import-template');
|
}
|
|
/** 导入学生 */
|
export function importStudent(data: FormData) {
|
return requestClient.post('/infra/student/import', data);
|
}
|