From aa877f91b13bc9bfda1f9a925957f1858085aa26 Mon Sep 17 00:00:00 2001 From: kanade Date: Mon, 17 Aug 2026 11:39:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(erp):=20=E9=87=8D=E6=9E=84=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E6=9C=8D=E5=8A=A1=E4=B8=AD=E7=9A=84=E8=B4=A7=E5=B8=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将货币相关结构体和方法独立为单独的currency模块 - 在Dict结构体中添加Currency字段以支持货币功能 - 移除原dict.go中的FunctionalCurrency方法实现 - 新增currency.go文件包含完整的货币字典项定义和本位币查询功能 --- erp/dict.go | 10 ---------- erp/dict/currency.go | 38 ++++++++++++++++++++++++++++++++++++++ erp/dict/dict.go | 1 + 3 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 erp/dict/currency.go diff --git a/erp/dict.go b/erp/dict.go index 7eebc4c..7701f8c 100644 --- a/erp/dict.go +++ b/erp/dict.go @@ -104,13 +104,3 @@ func (d *dict) Delete(ctx context.Context, dictIds []int64) (err error) { err = xClient.Call(ctx, "Delete", dictIds, &reply) return } - -// FunctionalCurrency @TITLE 本位币 -func (d *dict) FunctionalCurrency(ctx context.Context) (reply DictItem, err error) { - xClient, err := client2.GetClient(d) - if err != nil { - return - } - err = xClient.Call(ctx, "FunctionalCurrency", 0, &reply) - return -} diff --git a/erp/dict/currency.go b/erp/dict/currency.go new file mode 100644 index 0000000..5d2593b --- /dev/null +++ b/erp/dict/currency.go @@ -0,0 +1,38 @@ +package dict + +import ( + "context" + "time" + + client2 "git.kumo.work/shama/service/client" +) + +type currency struct { +} + +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"` +} + +// FunctionalCurrency @TITLE 本位币 +func (c *currency) FunctionalCurrency(ctx context.Context) (reply DictItem, err error) { + xClient, err := client2.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "FunctionalCurrency", 0, &reply) + return +} diff --git a/erp/dict/dict.go b/erp/dict/dict.go index 9a4f7a5..a077082 100644 --- a/erp/dict/dict.go +++ b/erp/dict/dict.go @@ -3,4 +3,5 @@ package dict type Dict struct { Font font Category category + Currency currency }