Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user