新增
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package apiResponse
|
||||
|
||||
import (
|
||||
"hospital-admin-api/api/model"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// getApiPage 获取接口列表-分页
|
||||
type getApiPage struct {
|
||||
APIID string `json:"api_id"` // 主键id
|
||||
APIName string `json:"api_name"` // api名称
|
||||
APIPath string `json:"api_path"` // 接口路径(全路径 id为:id)
|
||||
APIMethod string `json:"api_method"` // 请求类型
|
||||
IsAuth int `json:"is_auth"` // 是否验证权限(0:否 1:是)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
// 接口详情
|
||||
type getApi struct {
|
||||
APIID string `json:"api_id"` // 主键id
|
||||
APIName string `json:"api_name"` // api名称
|
||||
APIPath string `json:"api_path"` // 接口路径(全路径 id为:id)
|
||||
APIMethod string `json:"api_method"` // 请求类型
|
||||
IsAuth int `json:"is_auth"` // 是否验证权限(0:否 1:是)
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||
}
|
||||
|
||||
// GetApiPageResponse 获取接口列表-分页
|
||||
func GetApiPageResponse(adminApi []*model.AdminAPI) []getApiPage {
|
||||
// 处理返回值
|
||||
getApiPageResponses := make([]getApiPage, len(adminApi))
|
||||
|
||||
if len(adminApi) > 0 {
|
||||
for i, v := range adminApi {
|
||||
// 将原始结构体转换为新结构体
|
||||
getApiPageResponse := getApiPage{
|
||||
APIID: strconv.Itoa(int(v.APIID)),
|
||||
APIName: v.APIName,
|
||||
APIPath: v.APIPath,
|
||||
APIMethod: v.APIMethod,
|
||||
IsAuth: v.IsAuth,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
getApiPageResponses[i] = getApiPageResponse
|
||||
}
|
||||
}
|
||||
|
||||
return getApiPageResponses
|
||||
}
|
||||
|
||||
// GetApiResponse 接口详情
|
||||
func GetApiResponse(adminApi *model.AdminAPI) *getApi {
|
||||
return &getApi{
|
||||
APIID: strconv.Itoa(int(adminApi.APIID)),
|
||||
APIName: adminApi.APIName,
|
||||
APIPath: adminApi.APIPath,
|
||||
APIMethod: adminApi.APIMethod,
|
||||
IsAuth: adminApi.IsAuth,
|
||||
CreatedAt: adminApi.CreatedAt,
|
||||
UpdatedAt: adminApi.UpdatedAt,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package deptResponse
|
||||
|
||||
import "hospital-admin-api/api/model"
|
||||
|
||||
// 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"` // 下级页面
|
||||
}
|
||||
Reference in New Issue
Block a user