125 lines
6.1 KiB
Go
125 lines
6.1 KiB
Go
|
|
package dto
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
consts "assets/consts/category"
|
|||
|
|
entity "assets/model/entity/asset"
|
|||
|
|
|
|||
|
|
"gitea.com/red-future/common/beans"
|
|||
|
|
"github.com/gogf/gf/v2/frame/g"
|
|||
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// CreateCategoryReq 创建分类请求
|
|||
|
|
type CreateCategoryReq struct {
|
|||
|
|
g.Meta `path:"/createCategory" method:"post" tags:"分类管理" summary:"创建分类" dc:"创建新的分类"`
|
|||
|
|
Name string `json:"name" v:"required" dc:"分类名称"`
|
|||
|
|
ParentId string `json:"parentId" dc:"父分类ID"`
|
|||
|
|
Image string `json:"image" dc:"分类图片"`
|
|||
|
|
Sort int `json:"sort" dc:"排序"`
|
|||
|
|
Path string `json:"path" dc:"分类路径"`
|
|||
|
|
Level int `json:"level" dc:"分类层级"`
|
|||
|
|
Status consts.CategoryStatusType `json:"status" v:"in:1,0" default:"1" dc:"状态:1启用0禁用"`
|
|||
|
|
Attrs []entity.CategoryAttr `json:"attrs" dc:"分类属性"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateCategoryRes 创建分类响应
|
|||
|
|
type CreateCategoryRes struct {
|
|||
|
|
Bid string `json:"bid" dc:"分类ID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateCategoryReq 更新分类请求
|
|||
|
|
type UpdateCategoryReq struct {
|
|||
|
|
g.Meta `path:"/updateCategory" method:"put" tags:"分类管理" summary:"更新分类" dc:"更新分类信息"`
|
|||
|
|
Id uint64 `json:"id" v:"required-without:Bid|integer#Id不能为空|Id必须是整数" dc:"分类ID"`
|
|||
|
|
Bid string `json:"bid" v:"required-without:Id|string#Bid不能为空|Bid必须是字符串" dc:"分类ID"`
|
|||
|
|
Name string `json:"name" dc:"分类名称"`
|
|||
|
|
ParentId string `json:"parentId" dc:"父分类ID"`
|
|||
|
|
Image string `json:"image" dc:"分类图片"`
|
|||
|
|
Sort int `json:"sort" dc:"排序"`
|
|||
|
|
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
|
|||
|
|
Attrs []entity.CategoryAttr `json:"attrs" dc:"分类属性"`
|
|||
|
|
Status consts.CategoryStatusType `json:"status" dc:"状态:1启用0禁用"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateCategoryStatusReq 更新分类状态请求
|
|||
|
|
type UpdateCategoryStatusReq struct {
|
|||
|
|
g.Meta `path:"/updateCategoryStatus" method:"put" tags:"分类管理" summary:"更新分类状态" dc:"更新分类状态"`
|
|||
|
|
Id string `json:"id" v:"required" dc:"分类ID"`
|
|||
|
|
Status consts.CategoryStatusType `json:"status" v:"in:1,0" dc:"状态:1启用0禁用"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// DeleteCategoryReq 删除分类请求
|
|||
|
|
type DeleteCategoryReq struct {
|
|||
|
|
g.Meta `path:"/deleteCategory" method:"delete" tags:"分类管理" summary:"删除分类" dc:"删除分类"`
|
|||
|
|
Bid string `json:"bid" v:"required" dc:"分类ID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetCategoryTreeReq 获取分类树请求
|
|||
|
|
type GetCategoryTreeReq struct {
|
|||
|
|
g.Meta `path:"/getCategoryTree" method:"get" tags:"分类管理" summary:"获取分类树" dc:"获取分类树"`
|
|||
|
|
Name string `json:"name" dc:"名称"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetCategoryTreeRes 获取分类树响应
|
|||
|
|
type GetCategoryTreeRes struct {
|
|||
|
|
Tree []*CategoryTreeNode `json:"tree" dc:"分类树"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CategoryTreeNode 分类树节点
|
|||
|
|
type CategoryTreeNode struct {
|
|||
|
|
Id uint64 `json:"id" dc:"分类ID"`
|
|||
|
|
Bid string `json:"bid" dc:"分类ID"`
|
|||
|
|
Name string `json:"name" dc:"分类名称"`
|
|||
|
|
Level int `json:"level" dc:"分类层级"`
|
|||
|
|
Type string `json:"type" dc:"分类类型"`
|
|||
|
|
Path string `json:"path" dc:"分类路径"`
|
|||
|
|
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
|
|||
|
|
Status consts.CategoryStatusType `json:"status" dc:"状态"`
|
|||
|
|
Sort int `json:"sort" dc:"排序"`
|
|||
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|||
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
|||
|
|
Children []*CategoryTreeNode `json:"children" dc:"子分类"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListCategoryReq 获取分类列表请求
|
|||
|
|
type ListCategoryReq struct {
|
|||
|
|
g.Meta `path:"/listCategories" method:"get" tags:"分类管理" summary:"获取分类列表" dc:"获取分类列表"`
|
|||
|
|
*beans.Page
|
|||
|
|
OrderBy []beans.OrderBy `json:"orderBy" dc:"排序规则"`
|
|||
|
|
ParentId string `json:"parentId" dc:"父分类ID"`
|
|||
|
|
Status consts.CategoryStatusType `json:"status" dc:"状态:1启用0禁用"`
|
|||
|
|
Keyword string `json:"keyword" dc:"关键词搜索"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListCategoryRes 获取分类列表响应
|
|||
|
|
type ListCategoryRes struct {
|
|||
|
|
List []GetCategoryRes `json:"list" dc:"分类列表"`
|
|||
|
|
Total int `json:"total" dc:"总数"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetCategoryReq 获取分类详情请求
|
|||
|
|
type GetCategoryReq struct {
|
|||
|
|
g.Meta `path:"/getCategory" method:"get" tags:"分类管理" summary:"获取分类详情" dc:"获取分类详情"`
|
|||
|
|
Id uint64 `json:"id" v:"required-without:Bid|integer#Id不能为空|Id必须是整数" dc:"分类ID"`
|
|||
|
|
Bid string `json:"bid" v:"required-without:Id|string#Bid不能为空|Bid必须是字符串" dc:"分类ID"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetCategoryRes 获取分类详情响应
|
|||
|
|
type GetCategoryRes struct {
|
|||
|
|
Id uint64 `json:"id" dc:"分类ID"`
|
|||
|
|
Bid string `json:"bid" dc:"分类ID"`
|
|||
|
|
Name string `json:"name" dc:"分类名称"`
|
|||
|
|
ParentId string `json:"parentId" dc:"父分类ID"`
|
|||
|
|
Path string `json:"path" dc:"分类路径"`
|
|||
|
|
Level int `json:"level" dc:"分类层级"`
|
|||
|
|
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
|
|||
|
|
Sort int `json:"sort" dc:"排序"`
|
|||
|
|
Image string `json:"image" dc:"分类图片"`
|
|||
|
|
Attrs []entity.CategoryAttr `json:"attrs" dc:"分类属性"`
|
|||
|
|
Status consts.CategoryStatusType `json:"status" dc:"状态:1启用0禁用"`
|
|||
|
|
Creator string `json:"creator" dc:"创建人"`
|
|||
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|||
|
|
Updater string `json:"updater" dc:"更新人"`
|
|||
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
|||
|
|
}
|