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.
104 lines
2.2 KiB
104 lines
2.2 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) {
|
|
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 []BrandItem, err error) {
|
|
xClient, err := client.GetClient(b)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.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
|
|
xClient, err := client.GetClient(b)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return xClient.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
|
|
xClient, err := client.GetClient(b)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return xClient.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) {
|
|
xClient, err := client.GetClient(b)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "FindByIds", args, &result)
|
|
return
|
|
}
|
|
|
|
// Export @Title 导出品牌
|
|
func (b *brand) Export(ctx context.Context, name string) (result []BrandItem, err error) {
|
|
xClient, err := client.GetClient(b)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "FindByIds", name, &result)
|
|
return
|
|
}
|