|
|
|
package wholesale
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
"git.oa00.com/supply-chain/service/supply"
|
|
|
|
)
|
|
|
|
|
|
|
|
type brand struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lists @Title 品牌列表
|
|
|
|
func (b *brand) Lists(ctx context.Context, args supply.ArgsBrandList) (result supply.ReplyBrandList, err error) {
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "Lists", args, &result)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// All @Title 全部品牌
|
|
|
|
func (b *brand) All(ctx context.Context) (result []supply.BrandItem, err error) {
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "All", 0, &result)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// FindByNameAll @Title 品牌名称筛选品牌
|
|
|
|
func (b *brand) FindByNameAll(ctx context.Context, name string) (result []supply.BrandItem, err error) {
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "FindByNameAll", name, &result)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add @Title 添加品牌
|
|
|
|
func (b *brand) Add(ctx context.Context, args supply.ArgsBrandAdd) (err error) {
|
|
|
|
reply := 0
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return xClient.Call(ctx, "Add", args, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edit @Title 编辑品牌
|
|
|
|
func (b *brand) Edit(ctx context.Context, args supply.ArgsBrandEdit) (err error) {
|
|
|
|
reply := 0
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
// FindByIds @Title 品牌获取
|
|
|
|
func (b *brand) FindByIds(ctx context.Context, args supply.ArgsBrandFindByIds) (result []supply.BrandItem, err error) {
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "FindByIds", args, &result)
|
|
|
|
return
|
|
|
|
}
|