|
|
|
@ -3,34 +3,14 @@ package wholesale
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
|
"git.oa00.com/supply-chain/service/lib/bean"
|
|
|
|
|
"git.oa00.com/supply-chain/service/supply"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
func (b *brand) Lists(ctx context.Context, args supply.ArgsBrandList) (result supply.ReplyBrandList, err error) {
|
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
@ -40,7 +20,7 @@ func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (result ReplyBran
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// All @Title 全部品牌
|
|
|
|
|
func (b *brand) All(ctx context.Context) (result []BrandItem, err error) {
|
|
|
|
|
func (b *brand) All(ctx context.Context) (result []supply.BrandItem, err error) {
|
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
@ -50,7 +30,7 @@ func (b *brand) All(ctx context.Context) (result []BrandItem, err error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FindByNameAll @Title 品牌名称筛选品牌
|
|
|
|
|
func (b *brand) FindByNameAll(ctx context.Context, name string) (result []BrandItem, err error) {
|
|
|
|
|
func (b *brand) FindByNameAll(ctx context.Context, name string) (result []supply.BrandItem, err error) {
|
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
@ -59,12 +39,8 @@ func (b *brand) FindByNameAll(ctx context.Context, name string) (result []BrandI
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ArgsBrandAdd struct {
|
|
|
|
|
Name string // 品牌名称
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add @Title 添加品牌
|
|
|
|
|
func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) {
|
|
|
|
|
func (b *brand) Add(ctx context.Context, args supply.ArgsBrandAdd) (err error) {
|
|
|
|
|
reply := 0
|
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -73,13 +49,8 @@ func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) {
|
|
|
|
|
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) {
|
|
|
|
|
func (b *brand) Edit(ctx context.Context, args supply.ArgsBrandEdit) (err error) {
|
|
|
|
|
reply := 0
|
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
|
if err != nil {
|
|
|
|
@ -88,12 +59,8 @@ func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) (err error) {
|
|
|
|
|
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) {
|
|
|
|
|
func (b *brand) FindByIds(ctx context.Context, args supply.ArgsBrandFindByIds) (result []supply.BrandItem, err error) {
|
|
|
|
|
xClient, err := client.GetClient(b)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|