Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark

This commit is contained in:
gazebo
2019-11-20 16:04:29 +08:00
10 changed files with 91 additions and 40 deletions

View File

@@ -53,7 +53,7 @@ func DeSerializeData(strValue string, dataPtr interface{}) (err error) {
}
// todo 这里看是否需要将key值转换成标准格式即字母大写因为beego orm不区分不转换也可以
func FilterMapByStructObject(mapData map[string]interface{}, obj interface{}, excludedFields []string, isCheckValue bool) (valid map[string]interface{}, invalid map[string]interface{}) {
func FilterMapByStructObject(mapData map[string]interface{}, obj interface{}, objPtr interface{}, excludedFields []string, isCheckValue bool) (valid map[string]interface{}, invalid map[string]interface{}) {
excludedMap := make(map[string]int)
for _, v := range excludedFields {
excludedMap[v] = 1
@@ -64,10 +64,14 @@ func FilterMapByStructObject(mapData map[string]interface{}, obj interface{}, ex
for k, v := range mapData {
if m[k] != nil && excludedMap[k] == 0 && v != nil && (!isCheckValue || !IsValueEqual(m[k], v)) {
valid[k] = v
m[k] = v
} else {
invalid[k] = v
}
}
if objPtr != nil {
utils.Map2StructByJson(m, objPtr, true)
}
return valid, invalid
}