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.
service/supply/setting/tag.go

114 lines
2.4 KiB

package setting
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
type tag struct {
}
type ArgsTagList struct {
Search TagSearch
Page bean.Page
}
type TagItem struct {
Id uint `json:"id"`
Name string `json:"name"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
type ReplyTagList struct {
Lists []TagItem `json:"lists"`
Total int64 `json:"total"`
}
type TagSearch struct {
Name string // 标签名称
}
// Lists @Title 标签列表
func (b *tag) Lists(ctx context.Context, args ArgsTagList) (result ReplyTagList, err error) {
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &result)
return
}
// All @Title 全部标签
func (b *tag) All(ctx context.Context) (result []TagItem, err error) {
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "All", 0, &result)
return
}
// FindByNameAll @Title 标签名称筛选标签
func (b *tag) FindByNameAll(ctx context.Context, name string) (result []TagItem, err error) {
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "FindByNameAll", name, &result)
return
}
type ArgsTagAdd struct {
Name string // 标签名称
}
// Add @Title 添加标签
func (b *tag) Add(ctx context.Context, args ArgsTagAdd) (err error) {
reply := 0
xClient, err := client.GetClient(b)
if err != nil {
return err
}
return xClient.Call(ctx, "Add", args, &reply)
}
// Adds @Title 添加标签
func (b *tag) Adds(ctx context.Context, tagNames []string) (err error) {
reply := 0
xClient, err := client.GetClient(b)
if err != nil {
return err
}
return xClient.Call(ctx, "Adds", tagNames, &reply)
}
type ArgsTagEdit struct {
TagId uint // 标签id
Name string // 标签名称
}
// Edit @Title 编辑标签
func (b *tag) Edit(ctx context.Context, args ArgsTagEdit) (err error) {
reply := 0
xClient, err := client.GetClient(b)
if err != nil {
return err
}
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsTagFindByIds struct {
TagIds []uint // 标签id数组
}
// FindByIds @Title 标签获取
func (b *tag) FindByIds(ctx context.Context, args ArgsTagFindByIds) (result []TagItem, err error) {
xClient, err := client.GetClient(b)
if err != nil {
return
}
err = xClient.Call(ctx, "FindByIds", args, &result)
return
}