Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
practical_train
Commits
1ea1a030
Commit
1ea1a030
authored
Aug 07, 2026
by
王蔡翾
Browse files
数据库和接口部分说明
parent
18875927
Changes
2
Hide whitespace changes
Inline
Side-by-side
practical-business/src/main/resources/leave-api.md
0 → 100644
View file @
1ea1a030
# 请假管理接口
请假人员由登录令牌解析出的用户
`id`
标识。教师端、管理端列表均展示学员完整手机号,不使用学号。请假审批为单级审批:教师或管理员任一方先处理后即生效,另一方不能重复审批。
## 学员端
-
`POST /leave/student/apply`
:提交申请;按请假起止时间自动关联学员班级内时间重叠的全部课程。
-
`POST /leave/student/attachment`
:上传 JPG、PNG 或 PDF 证明材料,单个文件不超过 10MB;返回文件
`id`
后随申请提交。
-
`PUT /leave/student/apply`
:修改待审批申请,请求体中必须提供申请
`id`
,并重新匹配课程。
-
`PUT /leave/student/{leaveId}/withdraw`
:撤回待审批申请。
-
`POST /leave/student/page`
:分页查询本人申请。
-
`GET /leave/student/{leaveId}`
:查看本人申请详情。
提交或修改示例:
```
json
{
"id"
:
"修改时填写,新增时不填"
,
"leaveType"
:
"SICK"
,
"startTime"
:
"2026-08-10 08:00:00"
,
"endTime"
:
"2026-08-10 18:00:00"
,
"reason"
:
"身体不适,需要到医院检查休息"
,
"emergencyContactName"
:
"张某某"
,
"emergencyContactPhone"
:
"13800138000"
,
"attachmentFileIds"
:
[
101
,
102
]
}
```
请假类型为
`SICK`
、
`PERSONAL`
、
`OTHER`
,请假原因须为10至200个字符;病假必须至少上传一份病历或诊断证明。紧急联系人选填,但姓名和手机号必须同时填写。系统不允许补交:申请开始时间及所有关联课程的计划开始时间都必须晚于当前时间。若关联课程已有
`NORMAL`
或
`LATE`
出勤记录,则拒绝申请。
## 教师端
-
`POST /leave/teacher/page`
:分页查询本人授课课程关联的申请,展示完整手机号。
-
`GET /leave/teacher/{leaveId}`
:查看本人课程关联的申请详情。
-
`PUT /leave/teacher/{leaveId}/review`
:批准或驳回申请。教师只能审批至少关联一门本人授课课程的申请。
## 管理端
-
`POST /leave/admin/page`
:分页查询全部申请,支持状态、类型、姓名/手机号和时间范围筛选。
-
`GET /leave/admin/{leaveId}`
:查看申请详情。
-
`PUT /leave/admin/{leaveId}/review`
:批准或驳回申请。
审批请求示例:
```
json
{
"status"
:
"APPROVED"
,
"approvalOpinion"
:
"同意"
}
```
审批结果只接受
`APPROVED`
或
`REJECTED`
。批准前会再次检查关联课程是否已有正常或迟到签到;通过后,所有关联课程出勤状态写为
`LEAVE`
。请假计入缺勤口径:出勤率分母包含请假,分子只包含正常和迟到。
本期不提供补交申请,也不提供 Excel 导出接口。
practical-business/src/main/resources/sql/attendance_management.sql
deleted
100644 → 0
View file @
18875927
-- 出勤管理数据库变更(MySQL)
-- 执行前请备份数据库;本脚本按“尚未添加这些列/索引”的数据库执行一次。
alter
table
class_subject_attendance
modify
column
check_in_time
datetime
null
comment
'实际签到时间,缺勤时为空'
,
add
column
status
varchar
(
16
)
not
null
default
'NORMAL'
comment
'NORMAL/LATE/ABSENT/LEAVE'
after
check_in_time
,
add
column
check_in_method
varchar
(
16
)
null
comment
'IP_CODE/IP_ONLY/TEACHER/SYSTEM/LEAVE/LEGACY'
after
status
,
add
column
check_in_ip
varchar
(
45
)
null
comment
'服务端识别的签到IP'
after
check_in_method
,
add
column
teacher_confirmed
tinyint
(
1
)
not
null
default
0
after
check_in_ip
,
add
column
confirmed_by
varchar
(
64
)
null
after
teacher_confirmed
,
add
column
confirmed_at
datetime
null
after
confirmed_by
,
add
column
created_time
datetime
null
after
confirmed_at
,
add
column
update_time
datetime
null
after
created_time
;
update
class_subject_attendance
set
status
=
'NORMAL'
,
check_in_method
=
'LEGACY'
,
teacher_confirmed
=
0
,
created_time
=
coalesce
(
created_time
,
check_in_time
),
update_time
=
coalesce
(
update_time
,
check_in_time
)
where
check_in_method
is
null
;
-- 添加唯一索引前可先执行以下语句检查历史重复数据:
-- select subject_id, user_id, count(*) from class_subject_attendance group by subject_id, user_id having count(*) > 1;
alter
table
class_subject_attendance
add
unique
key
uk_attendance_subject_user
(
subject_id
,
user_id
),
add
key
idx_attendance_user_status
(
user_id
,
status
),
add
key
idx_attendance_subject_status
(
subject_id
,
status
);
create
table
class_subject_attendance_session
(
id
varchar
(
64
)
not
null
,
subject_id
int
not
null
,
teacher_id
varchar
(
64
)
not
null
,
verification_code
char
(
6
)
null
,
scheduled_start_time
datetime
not
null
,
scheduled_end_time
datetime
not
null
,
started_at
datetime
null
,
code_expires_at
datetime
null
,
status
varchar
(
16
)
not
null
comment
'ACTIVE/ENDED'
,
created_time
datetime
not
null
,
update_time
datetime
not
null
,
primary
key
(
id
),
unique
key
uk_attendance_session_subject
(
subject_id
),
key
idx_attendance_session_end_status
(
scheduled_end_time
,
status
)
)
engine
=
InnoDB
default
charset
=
utf8mb4
comment
=
'课程签到会话'
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment