|
|
|
package jd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
"git.oa00.com/supply-chain/service/lib/bean"
|
|
|
|
)
|
|
|
|
|
|
|
|
type brand struct {
|
|
|
|
}
|
|
|
|
type ArgsBrandList struct {
|
|
|
|
Name string
|
|
|
|
Page bean.Page
|
|
|
|
}
|
|
|
|
|
|
|
|
type BrandItem struct {
|
|
|
|
Id uint `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
SupplyBrandId uint `json:"supplyBrandId"`
|
|
|
|
}
|
|
|
|
type ReplyBrandList struct {
|
|
|
|
Lists []BrandItem `json:"lists"`
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lists @Title 获取品牌匹配列表
|
|
|
|
func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (reply ReplyBrandList, err error) {
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsBrandEdit struct {
|
|
|
|
BrandId uint // 品牌id
|
|
|
|
Name string // 修改品牌名称
|
|
|
|
SupplyBrandId uint // 修改匹配品牌id
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edit @Title 编辑品牌匹配
|
|
|
|
func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) error {
|
|
|
|
reply := 0
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
// FindBrandByName @Title 根据品牌名称获取全部品牌
|
|
|
|
func (b *brand) FindBrandByName(ctx context.Context, name string) (reply []BrandItem, err error) {
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "FindBrandByName", name, &reply)
|
|
|
|
return
|
|
|
|
}
|