统一品牌分类

finance
杨赟 2 years ago
parent d2141a2c7d
commit 810ca4f43e

@ -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

@ -3,20 +3,14 @@ package wholesale
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/supply"
)
type category struct {
}
type CategoryItem struct {
Id uint `json:"id"`
Name string `json:"name"`
ParentId uint `json:"parentId"`
Children []CategoryItem `json:"children"`
}
// All @Title 获取分类
func (c *category) All(ctx context.Context) (result []CategoryItem, err error) {
func (c *category) All(ctx context.Context) (result []supply.CategoryItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
@ -25,13 +19,8 @@ func (c *category) All(ctx context.Context) (result []CategoryItem, err error) {
return
}
type ArgsCategoryAdd struct {
Name string // 分类名称
ParentId uint // 上级id
}
// Add @Title 添加分类
func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) {
func (c *category) Add(ctx context.Context, args supply.ArgsCategoryAdd) (err error) {
reply := 0
xClient, err := client.GetClient(c)
if err != nil {
@ -40,14 +29,8 @@ func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) {
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsCategoryEdit struct {
CategoryId uint // 分类id
Name string // 分类名称
ParentId uint // 上级id
}
// Edit @Title 编辑分类
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) {
func (c *category) Edit(ctx context.Context, args supply.ArgsCategoryEdit) (err error) {
reply := 0
xClient, err := client.GetClient(c)
if err != nil {
@ -56,18 +39,8 @@ func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error)
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsCategoryFindByIds struct {
ThirdCategoryIds []uint // 三级分类id数组
}
type ThirdCategoryItem struct {
Id uint `json:"id"`
Name string `json:"name"`
ParentId uint `json:"parentId"`
Parent *ThirdCategoryItem `json:"parent"`
}
// FindByIds @Title 三级分类获取
func (c *category) FindByIds(ctx context.Context, args ArgsCategoryFindByIds) (result []ThirdCategoryItem, err error) {
func (c *category) FindByIds(ctx context.Context, args supply.ArgsCategoryFindByIds) (result []supply.ThirdCategoryItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return

Loading…
Cancel
Save