You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
service/supply/brand.go

74 lines
1.7 KiB

package supply
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
type brand struct {
}
type ArgsBrandList struct {
Search BrandSearch
Page bean.Page
}
type BrandItem struct {
Id uint `json:"id"`
Name string `json:"name"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
type ReplyBrandList struct {
Lists []BrandItem `json:"lists"`
Total int64 `json:"total"`
}
type BrandSearch struct {
Name string // 品牌名称
}
// Lists @Title 品牌列表
func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (result ReplyBrandList, err error) {
err = client.GetClient(b).Call(ctx, "Lists", args, &result)
return
}
// All @Title 全部品牌
func (b *brand) All(ctx context.Context) (result []BrandItem, err error) {
err = client.GetClient(b).Call(ctx, "All", 0, &result)
return
}
type ArgsBrandAdd struct {
Name string // 品牌名称
}
// Add @Title 添加品牌
func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) {
reply := 0
return client.GetClient(b).Call(ctx, "Add", args, &reply)
}
type ArgsBrandEdit struct {
BrandId uint // 品牌id
Name string // 品牌名称
}
// Edit @Title 编辑品牌
func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) (err error) {
reply := 0
return client.GetClient(b).Call(ctx, "Edit", args, &reply)
}
type ArgsBrandFindByIds struct {
BrandIds []uint // 品牌id数组
}
// FindByIds @Title 品牌获取
func (b *brand) FindByIds(ctx context.Context, args ArgsBrandFindByIds) (result []BrandItem, err error) {
err = client.GetClient(b).Call(ctx, "FindByIds", args, &result)
return
}