Files
service/erp/dict.go
kanade aa877f91b1 refactor(erp): 重构字典服务中的货币功能模块
- 将货币相关结构体和方法独立为单独的currency模块
- 在Dict结构体中添加Currency字段以支持货币功能
- 移除原dict.go中的FunctionalCurrency方法实现
- 新增currency.go文件包含完整的货币字典项定义和本位币查询功能
2026-08-17 11:39:31 +08:00

107 lines
2.6 KiB
Go

package erp
import (
"context"
"time"
client2 "git.kumo.work/shama/service/client"
dict2 "git.kumo.work/shama/service/erp/dict"
"git.kumo.work/shama/service/lib/bean"
)
type dict struct {
dict2.Dict
}
type ArgsDictList struct {
Page bean.Page
Search DictSearch
}
type DictSearch struct {
Name string `label:"名称"`
Value2 string `label:"属性值2"`
CategoryId int64 `label:"分类ID"`
CategoryCode string `label:"分类编码"`
}
type ReplyDictList struct {
List []DictItem `json:"list"`
Total int64 `json:"total"`
}
type DictItem struct {
Id int64 `json:"id"`
CategoryId int64 `json:"categoryId"`
CategoryCode string `json:"categoryCode"`
Sort int64 `json:"sort"`
Value1 string `json:"value1"`
Value2 string `json:"value2"`
Value3 string `json:"value3"`
Value4 string `json:"value4"`
Value5 string `json:"value5"`
Value6 string `json:"value6"`
Value7 string `json:"value7"`
Value8 string `json:"value8"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 字典列表
func (d *dict) List(ctx context.Context, args ArgsDictList) (reply ReplyDictList, err error) {
xClient, err := client2.GetClient(d)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsDictAdd struct {
CategoryId int64 `binding:"required" label:"类目ID"`
Sort int64 `label:"排序"`
Value1 string `label:"属性值"`
Value2 string `label:"属性值"`
Value3 string `label:"属性值"`
Value4 string `label:"属性值"`
Value5 string `label:"属性值"`
Value6 string `label:"属性值"`
Value7 string `label:"属性值"`
Value8 string `label:"属性值"`
}
// Add @TITLE 添加字典
func (d *dict) Add(ctx context.Context, args ArgsDictAdd) (err error) {
xClient, err := client2.GetClient(d)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Add", args, &reply)
return
}
type ArgsDictEdit struct {
DictId int64 `binding:"required" label:"字典ID"`
ArgsDictAdd
}
// Edit @TITLE 编辑字典
func (d *dict) Edit(ctx context.Context, args ArgsDictEdit) (err error) {
xClient, err := client2.GetClient(d)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Edit", args, &reply)
return
}
// Delete @TITLE 删除字典
func (d *dict) Delete(ctx context.Context, dictIds []int64) (err error) {
xClient, err := client2.GetClient(d)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Delete", dictIds, &reply)
return
}