service.xpcool.com/api/admin/v1/system/role/role.go
夏犀麟 6e3ef67709 refactor(service): 重构服务层结构并更新导入路径
- 将 admin 相关服务移动到 internal/service/admin 目录下
- 更新控制器中的服务导入路径引用
- 移除已合并的服务文件
- 添加统一工作约定文档
- 更新 API 接口定义的包路径
2026-08-26 15:40:13 +08:00

63 lines
1.9 KiB
Go

package role
import "github.com/gogf/gf/v2/frame/g"
// RoleItem is one row of the role list.
type RoleItem struct {
Id uint64 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Status int `json:"status"`
MenuIds []uint64 `json:"menuIds"` // bound menu ids (for editing)
CreatedAt string `json:"createdAt"`
}
// RoleListReq pages the roles.
type RoleListReq struct {
g.Meta `path:"/system/role" method:"get" tags:"Admin/System/Role" summary:"Role list"`
Page int `json:"page" d:"1" v:"min:1"`
Size int `json:"size" d:"10" v:"min:1|max:100"`
Keyword string `json:"keyword"` // matches code or name
}
// RoleListRes is the response of RoleListReq.
type RoleListRes struct {
List []*RoleItem `json:"list"`
Total int `json:"total"`
}
// RoleCreateReq creates a role and binds menu ids.
type RoleCreateReq struct {
g.Meta `path:"/system/role" method:"post" tags:"Admin/System/Role" summary:"Create role"`
Code string `json:"code" v:"required"`
Name string `json:"name" v:"required"`
Status int `json:"status"`
MenuIds []uint64 `json:"menuIds"`
}
// RoleCreateRes is the response of RoleCreateReq.
type RoleCreateRes struct {
Id uint64 `json:"id"`
}
// RoleUpdateReq updates a role and rebinds menu ids.
type RoleUpdateReq struct {
g.Meta `path:"/system/role/{id}" method:"put" tags:"Admin/System/Role" summary:"Update role"`
Id uint64 `json:"id" in:"path" v:"required"`
Name string `json:"name" v:"required"`
Status int `json:"status"`
MenuIds []uint64 `json:"menuIds"`
}
// RoleUpdateRes is the response of RoleUpdateReq.
type RoleUpdateRes struct{}
// RoleDeleteReq deletes a role (soft delete).
type RoleDeleteReq struct {
g.Meta `path:"/system/role/{id}" method:"delete" tags:"Admin/System/Role" summary:"Delete role"`
Id uint64 `json:"id" in:"path" v:"required"`
}
// RoleDeleteRes is the response of RoleDeleteReq.
type RoleDeleteRes struct{}