From 2037144999af2ad6fe83221ec6a02d959b40056f Mon Sep 17 00:00:00 2001 From: u Date: Thu, 6 Apr 2023 17:09:49 +0800 Subject: [PATCH] 'fix' --- hasaki-gen-crud/template.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/hasaki-gen-crud/template.go b/hasaki-gen-crud/template.go index cb0071d..987acba 100644 --- a/hasaki-gen-crud/template.go +++ b/hasaki-gen-crud/template.go @@ -180,15 +180,14 @@ func (TempLowHead3A60 *Temp3A60) getFieldTypes() map[string]reflect.Kind { func (TempLowHead3A60 *Temp3A60) fixSqlRowMap(fieldType map[string]reflect.Kind, raw map[string]interface{}) map[string]interface{} { for i := range raw { + // log.Println(i, fieldType[i], cast.ToString(raw[i])) switch fieldType[i] { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - raw[i] = cast.ToInt64(raw[i]) + raw[i] = cast.ToInt64(cast.ToString(raw[i])) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - raw[i] = cast.ToUint64(raw[i]) + raw[i] = cast.ToUint64(cast.ToString(raw[i])) case reflect.Float32, reflect.Float64: - raw[i] = cast.ToFloat64(raw[i]) - case reflect.Bool: - raw[i] = cast.ToBool(raw[i]) + raw[i] = cast.ToFloat64(cast.ToString(raw[i])) case reflect.String: raw[i] = cast.ToString(raw[i]) case reflect.Slice, reflect.Array, reflect.Map, reflect.Struct, reflect.Ptr: @@ -350,18 +349,6 @@ 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{}