From 47edc058fe073baf395c417e57fbc71e733778bd Mon Sep 17 00:00:00 2001 From: u Date: Thu, 6 Apr 2023 16:13:33 +0800 Subject: [PATCH] 'fix' --- hasaki-gen-crud/template.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hasaki-gen-crud/template.go b/hasaki-gen-crud/template.go index fe82dd6..11aaad8 100644 --- a/hasaki-gen-crud/template.go +++ b/hasaki-gen-crud/template.go @@ -213,6 +213,15 @@ func (TempLowHead3A60 *Temp3A60) Load() (err error) { session = session.Table(TempLowHead3A60) raw := map[string]interface{}{} session.Get(&raw) + //xorm兼容性处理 + for i := range raw { + value := gjson.Parse(cast.ToString(raw[i])).Value() + if value != nil { + raw[i] = value + } else { + raw[i] = cast.ToString(raw[i]) + } + } for _, v := range structField { raw[v] = gjson.Parse(cast.ToString(raw[v])).Value() @@ -276,6 +285,18 @@ func (TempLowHead3A60 *Temp3A60) Data() (data []Temp3A60) { raw := []map[string]interface{}{} session.Find(&raw) + //xorm兼容性处理 + for i := range raw { + for k := range raw[i] { + value := gjson.Parse(cast.ToString(raw[i][k])).Value() + if value != nil { + raw[i][k] = value + } else { + raw[i][k] = cast.ToString(raw[i][k]) + } + } + } + for i := range raw { item := Temp3A60{} @@ -343,6 +364,17 @@ func (TempLowHead3A60 *Temp3A60) PageData(page, pageSize int) (data []Temp3A60, session = session.Table(TempLowHead3A60) raw := []map[string]interface{}{} count, _ = session.FindAndCount(&raw) + //xorm兼容性处理 + for i := range raw { + for k := range raw[i] { + value := gjson.Parse(cast.ToString(raw[i][k])).Value() + if value != nil { + raw[i][k] = value + } else { + raw[i][k] = cast.ToString(raw[i][k]) + } + } + } for i := range raw { item := Temp3A60{}