40 lines
1.4 KiB
Go
40 lines
1.4 KiB
Go
package deptResponse
|
||
|
||
import (
|
||
"hospital-admin-api/api/model"
|
||
"strconv"
|
||
)
|
||
|
||
// GetDeptList 获取部门列表
|
||
type GetDeptList struct {
|
||
DeptId string `json:"dept_id"`
|
||
ParentId string `json:"parent_id"` // 父菜单ID(0表示一级)
|
||
DeptName string `json:"dept_name"` // 部门名称
|
||
DeptStatus int `json:"dept_status"` // 部门状态(1:正常 2:删除)
|
||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||
Children []*GetDeptList `json:"children"` // 下级页面
|
||
}
|
||
|
||
// GetDept 部门详情
|
||
type getDept struct {
|
||
DeptId string `json:"dept_id"`
|
||
ParentId string `json:"parent_id"` // 父菜单ID(0表示一级)
|
||
DeptName string `json:"dept_name"` // 部门名称
|
||
DeptStatus int `json:"dept_status"` // 部门状态(1:正常 2:删除)
|
||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||
}
|
||
|
||
// GetDeptResponse 部门详情
|
||
func GetDeptResponse(adminDept *model.AdminDept) *getDept {
|
||
return &getDept{
|
||
DeptId: strconv.Itoa(int(adminDept.DeptId)),
|
||
ParentId: strconv.Itoa(int(adminDept.ParentId)),
|
||
DeptName: adminDept.DeptName,
|
||
DeptStatus: adminDept.DeptStatus,
|
||
CreatedAt: adminDept.CreatedAt,
|
||
UpdatedAt: adminDept.UpdatedAt,
|
||
}
|
||
}
|