2026-06-25 a26b31cc9f3ee9b21b1a754e80fa7359e8a7a8f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';
 
import { requestClient } from '#/api/request';
 
export namespace InfraStudentApi {
  /** 学生联系人信息 */
  export interface StudentContact {
            id: number; // 编号
            studentId?: number; // 学生编号
            name?: string; // 名字
            description?: string; // 简介
            birthday?: string | Dayjs; // 出生日期
            sex?: number; // 性别
            enabled?: boolean; // 是否有效
            avatar?: string; // 头像
            video: string; // 附件
            memo?: string; // 备注
  }
 
  /** 学生班主任信息 */
  export interface StudentTeacher {
            id: number; // 编号
            studentId?: number; // 学生编号
            name?: string; // 名字
            description?: string; // 简介
            birthday?: string | Dayjs; // 出生日期
            sex?: number; // 性别
            enabled?: boolean; // 是否有效
            avatar?: string; // 头像
            video: string; // 附件
            memo?: string; // 备注
  }
 
  /** 学生信息 */
  export interface Student {
    id: number; // 编号
    name?: string; // 名字
    description?: string; // 简介
    birthday?: string | Dayjs; // 出生日期
    sex?: number; // 性别
    enabled?: boolean; // 是否有效
    avatar?: string; // 头像
    video?: string; // 附件
    memo?: string; // 备注
        studentcontacts?: StudentContact[]
        studentteacher?: StudentTeacher
  }
}
 
/** 查询学生分页 */
export function getStudentPage(params: PageParam) {
  return requestClient.get<PageResult<InfraStudentApi.Student>>(
    '/infra/student/page',
    { params },
  );
}
 
/** 查询学生详情 */
export function getStudent(id: number) {
  return requestClient.get<InfraStudentApi.Student>(
    `/infra/student/get?id=${id}`,
  );
}
 
/** 新增学生 */
export function createStudent(data: InfraStudentApi.Student) {
  return requestClient.post('/infra/student/create', data);
}
 
/** 修改学生 */
export function updateStudent(data: InfraStudentApi.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 getStudentContactListByStudentId(studentId: number) {
  return requestClient.get<InfraStudentApi.StudentContact[]>(
    `/infra/student/student-contact/list-by-student-id?studentId=${studentId}`,
  );
}
 
// ==================== 子表(学生班主任) ====================
 
/** 获得学生班主任 */
export function getStudentTeacherByStudentId(studentId: number) {
  return requestClient.get<InfraStudentApi.StudentTeacher>(
    `/infra/student/student-teacher/get-by-student-id?studentId=${studentId}`,
  );
}