83 lines
2.9 KiB
Plaintext
83 lines
2.9 KiB
Plaintext
// 教学案例请求结构体
|
||
type CreateTeachingCaseReq {
|
||
Title string `json:"title" validate:"required"` // 案例标题
|
||
TutorName string `json:"tutor_name" validate:"required"` // 导师姓名
|
||
TutorTitle string `json:"tutor_title"` // 导师头衔
|
||
StudentNames string `json:"student_names" validate:"required"` // 学生姓名(逗号分隔)
|
||
Content string `json:"content" validate:"required"` // 案例内容
|
||
CoverUrl string `json:"cover_url"` // 案例封面图URL
|
||
Sort int `json:"sort" default:"0"` // 排序
|
||
}
|
||
|
||
type UpdateTeachingCaseReq {
|
||
Id int `json:"id" validate:"required"` // 案例ID
|
||
Title string `json:"title"` // 案例标题
|
||
TutorName string `json:"tutor_name"` // 导师姓名
|
||
TutorTitle string `json:"tutor_title"` // 导师头衔
|
||
StudentNames string `json:"student_names"` // 学生姓名(逗号分隔)
|
||
Content string `json:"content"` // 案例内容
|
||
CoverUrl string `json:"cover_url"` // 案例封面图URL
|
||
Sort int `json:"sort"` // 排序
|
||
}
|
||
|
||
type GetTeachingCaseReq {
|
||
Id int `json:"id" validate:"required" uri:"id"` // 案例ID
|
||
}
|
||
|
||
type DeleteTeachingCaseReq {
|
||
Id int `json:"id" validate:"required" uri:"id"` // 案例ID
|
||
}
|
||
|
||
type ListTeachingCaseReq {
|
||
Page int `json:"page" default:"1"` // 页码
|
||
Size int `json:"size" default:"10"` // 每页数量
|
||
Keyword string `json:"keyword"` // 搜索关键词(标题/导师姓名)
|
||
Sort int `json:"sort"` // 排序筛选
|
||
}
|
||
|
||
// 教学案例响应结构体
|
||
type TeachingCaseResp {
|
||
Id int `json:"id"` // 案例ID
|
||
Title string `json:"title"` // 案例标题
|
||
TutorName string `json:"tutor_name"` // 导师姓名
|
||
TutorTitle string `json:"tutor_title"` // 导师头衔
|
||
StudentNames string `json:"student_names"` // 学生姓名
|
||
Content string `json:"content"` // 案例内容
|
||
CoverUrl string `json:"cover_url"` // 封面图URL
|
||
Sort int `json:"sort"` // 排序
|
||
CreateTime string `json:"create_time"` // 创建时间
|
||
UpdateTime string `json:"update_time"` // 更新时间
|
||
}
|
||
|
||
type ListTeachingCaseResp {
|
||
Total int64 `json:"total"` // 总条数
|
||
List []TeachingCaseResp `json:"list"` // 案例列表
|
||
}
|
||
|
||
type BaseResp {
|
||
Code int `json:"code"` // 状态码(0成功,非0失败)
|
||
Msg string `json:"msg"` // 提示信息
|
||
}
|
||
|
||
@server (
|
||
group: teaching_case
|
||
prefix: /api/teaching-case
|
||
)
|
||
service teaching_case_api {
|
||
@handler CreateTeachingCaseHandler
|
||
post /api/teaching-cases (CreateTeachingCaseReq) returns (BaseResp)
|
||
|
||
@handler UpdateTeachingCaseHandler
|
||
put /api/teaching-cases (UpdateTeachingCaseReq) returns (BaseResp)
|
||
|
||
@handler GetTeachingCaseHandler
|
||
get /api/teaching-cases/:id (GetTeachingCaseReq) returns (TeachingCaseResp)
|
||
|
||
@handler DeleteTeachingCaseHandler
|
||
delete /api/teaching-cases/:id (DeleteTeachingCaseReq) returns (BaseResp)
|
||
|
||
@handler ListTeachingCaseHandler
|
||
get /api/teaching-cases (ListTeachingCaseReq) returns (ListTeachingCaseResp)
|
||
}
|
||
|