54 lines
2.2 KiB
Plaintext
54 lines
2.2 KiB
Plaintext
|
|
type (
|
|||
|
|
// BaseOverview 基础结构(完全映射数据表字段)
|
|||
|
|
BaseOverview {
|
|||
|
|
Introduction string `json:"introduction"` // 基地简介
|
|||
|
|
Regulations string `json:"regulations"` // 规章制度
|
|||
|
|
Address string `json:"address"` // 联系地址
|
|||
|
|
Phone string `json:"phone"` // 联系电话
|
|||
|
|
Email string `json:"email"` // 联系邮箱
|
|||
|
|
Website string `json:"website"` // 官方网站
|
|||
|
|
Director string `json:"director"` // 主任姓名
|
|||
|
|
DeputyDirector string `json:"deputy_director"` // 副主任姓名
|
|||
|
|
Researchers string `json:"researchers"` // 研究人员(逗号分隔)
|
|||
|
|
}
|
|||
|
|
// 获取基地概况详情:请求(无参数,因只有一条核心记录)
|
|||
|
|
GetBaseOverviewReq {}
|
|||
|
|
// 获取基地概况详情:响应
|
|||
|
|
GetBaseOverviewResp {
|
|||
|
|
Data BaseOverview `json:"data"` // 基地概况详情
|
|||
|
|
Success bool `json:"success"` // 操作是否成功
|
|||
|
|
}
|
|||
|
|
// 部分更新基地概况:请求(支持按需更新部分字段)
|
|||
|
|
UpdateBaseOverviewPartialReq {
|
|||
|
|
Introduction string `json:"introduction,optional"` // 可选更新
|
|||
|
|
Regulations string `json:"regulations,optional"` // 可选更新
|
|||
|
|
Address string `json:"address,optional"` // 可选更新
|
|||
|
|
Phone string `json:"phone,optional"` // 可选更新
|
|||
|
|
Email string `json:"email,optional"` // 可选更新
|
|||
|
|
Website string `json:"website,optional"` // 可选更新
|
|||
|
|
Director string `json:"director,optional"` // 可选更新
|
|||
|
|
DeputyDirector string `json:"deputy_director,optional"` // 可选更新
|
|||
|
|
Researchers string `json:"researchers,optional"` // 可选更新
|
|||
|
|
}
|
|||
|
|
// 部分更新基地概况:响应
|
|||
|
|
UpdateBaseOverviewPartialResp {
|
|||
|
|
Success bool `json:"success"`
|
|||
|
|
Msg string `json:"msg,omitempty"`
|
|||
|
|
}
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
@server (
|
|||
|
|
group: baseOverview
|
|||
|
|
prefix: /api/base-overview
|
|||
|
|
)
|
|||
|
|
// 修改这里:将 base-overview-api 改为 base_overview_api 或 baseoverviewapi
|
|||
|
|
service base_overview_api {
|
|||
|
|
@handler GetBaseOverviewHandler
|
|||
|
|
get / (GetBaseOverviewReq) returns (GetBaseOverviewResp)
|
|||
|
|
|
|||
|
|
// 部分更新基地概况(PATCH,按需更新部分字段,更符合 REST 规范)
|
|||
|
|
@handler UpdateBaseOverviewPartialHandler
|
|||
|
|
patch / (UpdateBaseOverviewPartialReq) returns (UpdateBaseOverviewPartialResp)
|
|||
|
|
}
|
|||
|
|
|