refactor: 重构资产模型与DAO层实现
This commit is contained in:
@@ -11,32 +11,32 @@ import (
|
||||
|
||||
// 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:"分类属性"`
|
||||
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 {
|
||||
Bid string `json:"bid" dc:"分类ID"`
|
||||
Id int64 `json:"id,string" 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"`
|
||||
Id int64 `json:"id" v:"required" dc:"分类ID"`
|
||||
Name string `json:"name" dc:"分类名称"`
|
||||
ParentId string `json:"parentId" dc:"父分类ID"`
|
||||
ParentId int64 `json:"parentId" dc:"父分类ID"`
|
||||
Image string `json:"image" dc:"分类图片"`
|
||||
Sort int `json:"sort" dc:"排序"`
|
||||
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
|
||||
IsLeafNode *bool `json:"isLeafNode" dc:"是否叶子节点"`
|
||||
Attrs []entity.CategoryAttr `json:"attrs" dc:"分类属性"`
|
||||
Status consts.CategoryStatusType `json:"status" dc:"状态:1启用0禁用"`
|
||||
}
|
||||
@@ -44,14 +44,14 @@ type UpdateCategoryReq struct {
|
||||
// UpdateCategoryStatusReq 更新分类状态请求
|
||||
type UpdateCategoryStatusReq struct {
|
||||
g.Meta `path:"/updateCategoryStatus" method:"put" tags:"分类管理" summary:"更新分类状态" dc:"更新分类状态"`
|
||||
Id string `json:"id" v:"required" dc:"分类ID"`
|
||||
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:"删除分类"`
|
||||
Bid string `json:"bid" v:"required" dc:"分类ID"`
|
||||
Id int64 `json:"id" v:"required" dc:"分类ID"`
|
||||
}
|
||||
|
||||
// GetCategoryTreeReq 获取分类树请求
|
||||
@@ -67,8 +67,7 @@ type GetCategoryTreeRes struct {
|
||||
|
||||
// CategoryTreeNode 分类树节点
|
||||
type CategoryTreeNode struct {
|
||||
Id uint64 `json:"id" dc:"分类ID"`
|
||||
Bid string `json:"bid" dc:"分类ID"`
|
||||
Id int64 `json:"id,string" dc:"分类ID"`
|
||||
Name string `json:"name" dc:"分类名称"`
|
||||
Level int `json:"level" dc:"分类层级"`
|
||||
Type string `json:"type" dc:"分类类型"`
|
||||
@@ -85,8 +84,7 @@ type CategoryTreeNode struct {
|
||||
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"`
|
||||
ParentId int64 `json:"parentId" dc:"父分类ID"`
|
||||
Status consts.CategoryStatusType `json:"status" dc:"状态:1启用0禁用"`
|
||||
Keyword string `json:"keyword" dc:"关键词搜索"`
|
||||
}
|
||||
@@ -100,16 +98,14 @@ type ListCategoryRes struct {
|
||||
// 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"`
|
||||
Id int64 `json:"id" v:"required" dc:"分类ID"`
|
||||
}
|
||||
|
||||
// GetCategoryRes 获取分类详情响应
|
||||
type GetCategoryRes struct {
|
||||
Id uint64 `json:"id" dc:"分类ID"`
|
||||
Bid string `json:"bid" dc:"分类ID"`
|
||||
Id int64 `json:"id,string" dc:"分类ID"`
|
||||
Name string `json:"name" dc:"分类名称"`
|
||||
ParentId string `json:"parentId" dc:"父分类ID"`
|
||||
ParentId int64 `json:"parentId,string" dc:"父分类ID"`
|
||||
Path string `json:"path" dc:"分类路径"`
|
||||
Level int `json:"level" dc:"分类层级"`
|
||||
IsLeafNode bool `json:"isLeafNode" dc:"是否叶子节点"`
|
||||
|
||||
Reference in New Issue
Block a user