148 lines
6.4 KiB
Go
148 lines
6.4 KiB
Go
package v1
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
"github.com/gogf/gf/v2/util/gmeta"
|
|
)
|
|
|
|
// ============================== 职级模块 ==============================
|
|
|
|
// LevelItem 职级行数据
|
|
// 用于职级分页列表等场景的职级基础信息
|
|
type LevelItem struct {
|
|
Id int64 `json:"id"` // 主键ID
|
|
TenantId int `json:"tenantId"` // 租户ID
|
|
Name string `json:"name"` // 职级名称
|
|
Status int `json:"status"` // 状态:1-正常 2-禁用
|
|
StatusText string `json:"statusText"` // 状态文本
|
|
Sort int `json:"sort"` // 排序
|
|
UserCount int `json:"userCount"` // 关联用户数
|
|
CreateUser string `json:"createUser"` // 创建人
|
|
CreateTime *gtime.Time `json:"createTime"` // 创建时间
|
|
}
|
|
|
|
// LevelPageReq 职级分页请求
|
|
// 支持关键词、名称、状态等条件组合查询
|
|
type LevelPageReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/level/page" summary:"职级分页" permission:"sys:level:page" log:"职级管理-查询分页记录" logType:"query"`
|
|
PageReq // 分页基础参数
|
|
Keyword string `json:"keyword" dc:"关键词"` // 关键词
|
|
Name string `json:"name" dc:"名称模糊"` // 名称模糊匹配
|
|
Status int `json:"status" dc:"状态:1-正常 2-禁用"` // 状态
|
|
}
|
|
|
|
// LevelPageRes 职级分页结果
|
|
type LevelPageRes = PageData[LevelItem]
|
|
|
|
// LevelListReq 职级全量列表请求
|
|
type LevelListReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/level/list" summary:"职级列表" permission:"sys:level:list" log:"职级管理-查询列表" logType:"query"`
|
|
Keyword string `json:"keyword" dc:"关键词"` // 关键词
|
|
Status int `json:"status" dc:"状态"` // 状态
|
|
}
|
|
|
|
// LevelListItem 职级列表行数据
|
|
// 精简结构,仅包含列表展示所需字段
|
|
type LevelListItem struct {
|
|
Id int64 `json:"id"` // 主键ID
|
|
Name string `json:"name"` // 职级名称
|
|
Status int `json:"status"` // 状态:1-正常 2-禁用
|
|
Sort int `json:"sort"` // 排序
|
|
}
|
|
|
|
// LevelListRes 职级列表结果
|
|
type LevelListRes = []LevelListItem
|
|
|
|
// LevelDetailReq 职级详情请求
|
|
type LevelDetailReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/level/detail/:id" summary:"职级详情" permission:"sys:level:detail" log:"职级管理-查询详情" logType:"query"`
|
|
Id int64 `json:"id" v:"required#缺少ID" dc:"职级ID"` // 职级ID
|
|
}
|
|
|
|
// LevelDetailRes 职级详情结果
|
|
type LevelDetailRes struct {
|
|
Id int64 `json:"id"` // 主键ID
|
|
Name string `json:"name"` // 职级名称
|
|
Status int `json:"status"` // 状态:1-正常 2-禁用
|
|
StatusText string `json:"statusText"` // 状态文本
|
|
Sort int `json:"sort"` // 排序
|
|
}
|
|
|
|
// LevelAddReq 新增职级请求
|
|
type LevelAddReq struct {
|
|
gmeta.Meta `method:"post" path:"/api/level/add" summary:"新增职级" permission:"sys:level:add" log:"职级管理-新增记录" logType:"add"`
|
|
Name string `json:"name" v:"required#请输入职级名称" dc:"职级名称"` // 职级名称
|
|
Status int `json:"status" dc:"状态:1-正常 2-禁用"` // 状态
|
|
Sort int `json:"sort" dc:"排序"` // 排序
|
|
}
|
|
|
|
// LevelUpdateReq 修改职级请求
|
|
type LevelUpdateReq struct {
|
|
gmeta.Meta `method:"put" path:"/api/level/update" summary:"修改职级" permission:"sys:level:update" log:"职级管理-修改记录" logType:"update"`
|
|
Id int64 `json:"id" v:"required#缺少ID" dc:"职级ID"` // 职级ID
|
|
Name string `json:"name" v:"required#请输入职级名称" dc:"职级名称"` // 职级名称
|
|
Status int `json:"status" dc:"状态"` // 状态
|
|
Sort int `json:"sort" dc:"排序"` // 排序
|
|
}
|
|
|
|
// LevelUpdateRes 修改职级结果
|
|
type LevelUpdateRes struct{}
|
|
|
|
// LevelStatusReq 职级状态请求
|
|
type LevelStatusReq struct {
|
|
gmeta.Meta `method:"put" path:"/api/level/status" summary:"职级状态" permission:"sys:level:status" log:"职级管理-设置状态" logType:"update"`
|
|
Id int64 `json:"id" v:"required#缺少ID" dc:"职级ID"` // 职级ID
|
|
Status int `json:"status" v:"required#缺少状态" dc:"状态:1-正常 2-禁用"` // 状态
|
|
}
|
|
|
|
// LevelStatusRes 职级状态结果
|
|
type LevelStatusRes struct{}
|
|
|
|
// LevelDeleteReq 删除职级请求
|
|
type LevelDeleteReq struct {
|
|
gmeta.Meta `method:"delete" path:"/api/level/delete/:id" summary:"删除职级" permission:"sys:level:delete" log:"职级管理-删除记录" logType:"delete"`
|
|
Id int64 `json:"id" v:"required#缺少ID" dc:"职级ID"` // 职级ID
|
|
}
|
|
|
|
// LevelDeleteRes 删除职级结果
|
|
type LevelDeleteRes struct{}
|
|
|
|
// LevelBatchDeleteReq 批量删除职级请求
|
|
type LevelBatchDeleteReq struct {
|
|
gmeta.Meta `method:"delete" path:"/api/level/batchDelete" summary:"批量删除职级" permission:"sys:level:batchDelete" log:"职级管理-批量删除记录" logType:"delete"`
|
|
Ids []int64 `json:"ids" v:"required#请选择要删除的记录" dc:"职级ID列表"` // 职级ID列表
|
|
}
|
|
|
|
// LevelBatchDeleteRes 批量删除结果
|
|
type LevelBatchDeleteRes struct{}
|
|
|
|
// LevelImportReq 导入职级请求
|
|
// 上传 xls/xlsx 文件进行数据导入
|
|
type LevelImportReq struct {
|
|
gmeta.Meta `method:"post" path:"/api/level/import" summary:"导入职级" permission:"sys:level:import" log:"职级管理-导入数据" logType:"import"`
|
|
File *ghttp.UploadFile `p:"file" v:"required#请选择文件" dc:"xls/xlsx 文件"` // 上传文件
|
|
}
|
|
|
|
// LevelImportRes 导入结果
|
|
// 返回导入总数、成功数、失败数及失败原因
|
|
type LevelImportRes struct {
|
|
Total int `json:"total"` // 导入总数
|
|
Success int `json:"success"` // 成功数
|
|
Failed int `json:"failed"` // 失败数
|
|
Reasons []string `json:"reasons"` // 失败原因列表
|
|
}
|
|
|
|
// LevelExportReq 导出职级请求
|
|
// 按查询条件导出符合条件的记录
|
|
type LevelExportReq struct {
|
|
gmeta.Meta `method:"get" path:"/api/level/export" summary:"导出职级" permission:"sys:level:export" log:"职级管理-导出数据" logType:"export"`
|
|
Keyword string `json:"keyword" dc:"关键词"` // 关键词
|
|
Name string `json:"name" dc:"名称模糊"` // 名称模糊匹配
|
|
Status int `json:"status" dc:"状态"` // 状态
|
|
}
|
|
|
|
// LevelExportRes 导出结果
|
|
// data 直接为导出文件的访问地址
|
|
type LevelExportRes = string
|