Body Template:我仍然需要它为每个新条目自动生成“order_number” 。
#set($inputSep = $input.path('$'))
#set($thisLoop =
'{"CustomerNm":"1","ShipDate":"2","Shipping":"3","commentId":"4"}')
#set($myPlaces = $util.parseJson($thisLoop))
#set($allKeys = '')
#set($myVals = '"')
{
"TableName": "BRPI",
"Key": {
"CustomerID": {
"S": "$input.path('$.CustomerID')"
}
},
#foreach($type in $inputSep.keySet())
#if($type == "CustomerID")
#else
#set($thisPlace = $myPlaces.get($type))
#set($params = $inputSep.get($type))
#set($thisKey = "$type" + " = :val" + "$thisPlace")
#set($thisPath = "$params")
#if($foreach.hasNext)
#set($myComma = ",")
#set($myReturn = '"')
#else
#set($myComma = "")
#set($myReturn = "")
#end
#set($allKeys = "$allKeys" + "$thisKey" + "$myComma")
#set($myVals = "$myVals" + ":val" + "$thisPlace" + '": {"S": "' +
"$thisPath" + '"}' + "$myComma" + "$myReturn")
#end
#end
"UpdateExpression": "SET $allKeys",
"ExpressionAttributeValues": {
$myVals
},
"ReturnValues":"UPDATED_NEW"
}