package dict import ( "context" "time" client2 "git.kumo.work/shama/service/client" "git.kumo.work/shama/service/lib/bean" ) type category struct { } type ArgsCategoryList struct { Page bean.Page Search CategorySearch } type CategorySearch struct { Name string `label:"名称"` GroupName string `label:"分组名"` } type ReplyCategoryList struct { List []CategoryItem `json:"list"` Total int64 `json:"total"` } type CategoryItem struct { Id int64 `json:"id"` Name string `json:"name"` Code string `json:"code"` Sort int64 `json:"sort"` Info string `json:"info"` GroupName string `json:"groupName"` Label1 string `json:"label1"` Label2 string `json:"label2"` Label3 string `json:"label3"` Label4 string `json:"label4"` Label5 string `json:"label5"` Label6 string `json:"label6"` Label7 string `json:"label7"` Label8 string `json:"label8"` CreatedAt *time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt"` } // List @TITLE 分类列表 func (c *category) List(ctx context.Context, args ArgsCategoryList) (reply ReplyCategoryList, err error) { xClient, err := client2.GetClient(c) if err != nil { return } err = xClient.Call(ctx, "List", args, &reply) return } type ArgsCategoryAdd struct { Name string `binding:"required" label:"名称"` Code string `binding:"required" label:"唯一编码"` Sort int64 `label:"排序"` Info string `label:"备注"` GroupName string `label:"分组名"` Label1 string `label:"属性名称"` Label2 string `label:"属性名称"` Label3 string `label:"属性名称"` Label4 string `label:"属性名称"` Label5 string `label:"属性名称"` Label6 string `label:"属性名称"` Label7 string `label:"属性名称"` Label8 string `label:"属性名称"` } // Add @TITLE 添加分类 func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) { xClient, err := client2.GetClient(c) if err != nil { return } reply := 0 err = xClient.Call(ctx, "Add", args, &reply) return } type ArgsCategoryEdit struct { CategoryId int64 `binding:"required" label:"分类Id"` ArgsCategoryAdd } // Edit @TITLE 编辑分类 func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) { xClient, err := client2.GetClient(c) if err != nil { return } reply := 0 err = xClient.Call(ctx, "Edit", args, &reply) return } // Delete @TITLE 删除分类 func (c *category) Delete(ctx context.Context, categoryIds []int64) (err error) { xClient, err := client2.GetClient(c) if err != nil { return } reply := 0 err = xClient.Call(ctx, "Delete", categoryIds, &reply) return }