feat(report):完成报表中园区概况的试计算功能。

This commit is contained in:
徐涛
2022-08-21 13:39:57 +08:00
parent 9e6914c787
commit 957eb445b5
3 changed files with 30 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package tools
import (
"encoding/json"
"strings"
"github.com/mozillazg/go-pinyin"
@@ -21,3 +22,11 @@ func PinyinAbbr(source string) string {
finalAbbr := strings.Join(abbrCollect, "")
return finalAbbr
}
// 将给定结构体的内容通过JSON转换为`map[string]interface{}`类型的值
func ConvertStructToMap[T any](origin T) map[string]interface{} {
incr, _ := json.Marshal(origin)
var dest map[string]interface{}
json.Unmarshal(incr, &dest)
return dest
}