Files
assets/model/dto/asset/category_dto.go

121 lines
5.7 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 int64 `json:"parentId" dc:"父分类ID"`
IsLeafNode *bool `json:"isLeafNode" dc:"是否叶子节点"`
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 {
Id int64 `json:"id,string" dc:"分类ID"`
}
// UpdateCategoryReq 更新分类请求
type UpdateCategoryReq struct {
g.Meta `path:"/updateCategory" method:"put" tags:"分类管理" summary:"更新分类" dc:"更新分类信息"`
Id int64 `json:"id" v:"required" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
ParentId int64 `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 int64 `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:"删除分类"`
Id int64 `json:"id" 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 int64 `json:"id,string" 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
ParentId int64 `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 int64 `json:"id" v:"required" dc:"分类ID"`
}
// GetCategoryRes 获取分类详情响应
type GetCategoryRes struct {
Id int64 `json:"id,string" dc:"分类ID"`
Name string `json:"name" dc:"分类名称"`
ParentId int64 `json:"parentId,string" 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:"更新时间"`
}