ソースを参照

fix: LoadOptionset

2637309949 4 年 前
コミット
3427b6deba
1 ファイル変更5 行追加2 行削除
  1. 5 2
      internal/logic/load_optionset_logic.go

+ 5 - 2
internal/logic/load_optionset_logic.go

@@ -2,6 +2,7 @@ package logic
 
 import (
 	"context"
+	"encoding/json"
 	"fmt"
 
 	"git.i2edu.net/i2/i2-bill-erp/internal/svc"
@@ -30,12 +31,14 @@ func NewLoadOptionsetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Loa
 }
 
 func (l *LoadOptionsetLogic) LoadOptionset(in *transform.OptionsetReq) (*transform.OptionsetRes, error) {
+	values := []*Options{}
 	var options struct {
-		Value []*Options `json:"value"`
+		Value string `db:"value"`
 	}
 	l.svcCtx.SqlConn.QueryRowPartial(&options, "select value from sys_optionset where code=?", in.Code)
+	json.Unmarshal([]byte(options.Value), &values)
 	optionset := make(map[string]string)
-	for _, opt := range options.Value {
+	for _, opt := range values {
 		value := fmt.Sprintf("%v", opt.Value)
 		optionset[value] = opt.Text
 	}