postman中如何传数组
方法一:
postman的传参:

java接收:
package com.nps.base.xue.xd.groovyEngine import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.nps.common.service.NpsApplicationContextHolder
import com.nps.data_api.service.impl.NpsDataApiService import java.lang.reflect.Type /*
* @author XueWeiWei
* @date 2019/8/9 17:24
*/
class TrainMarshallingUpdateByGKEYGroovy {
private NpsDataApiService npsDataApiService = NpsApplicationContextHolder.getApplicationContext().getBean("npsDataApiService") // public List<Object> execute(Map<Object,Object> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// npsDataApiService.exec(param,"train_marshalling_update_by_gkey")
//
// resultMap.put("resultCode","success")
//
// result.add(resultMap)
// return result
// } // public List<Object> execute(List<Map<Object,Object>> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// for (int i = 0; i < param.size(); i++) {
// npsDataApiService.exec(param[i],"train_marshalling_update_by_gkey")
// }
//
// resultMap.put("result","success")
// resultMap.put("resultCode","2")
//
// result.add(resultMap)
// return result
// } public List<Object> execute(Map<Object,Object> param){
List<Object> result = new ArrayList<>() Map queryMap = new HashMap()
Map resultMap = new HashMap() //获取数组GKEY
String GKEYList = param.get("GKEY") //获取不为空的需要更新的字段
(param.get("PREARRIVAL_LIST_FK_GKEY1") != null) ? queryMap.put("PREARRIVAL_LIST_FK_GKEY1",param.get("PREARRIVAL_LIST_FK_GKEY1")) : 1 == 1;
(param.get("PRE_TRAIN_NUMBER") != null) ? queryMap.put("PRE_TRAIN_NUMBER",param.get("PRE_TRAIN_NUMBER")) : 1 == 1;
(param.get("TRAIN_NUM") != null) ? queryMap.put("TRAIN_NUM",param.get("TRAIN_NUM")) : 1 == 1; List<Map<Object,Object>> marshallingGKEYList
Gson gson = new Gson()
Type type = new TypeToken<List<Map>>(){}.getType()
marshallingGKEYList = gson.fromJson(GKEYList,type) //更新
for (int i = 0; i < marshallingGKEYList.size(); i++) {
Map marshallingMap;
marshallingMap = (Map)marshallingGKEYList.get(i)
queryMap.put("GKEY",marshallingMap.get("GKEY"))
npsDataApiService.exec(queryMap,"train_marshalling_update_by_gkey")
} queryMap.clear()
resultMap.put("result","success")
resultMap.put("resultCode","2") result.add(resultMap) return result
}
}
方法二:
postman传参方式:

java接收:
package com.nps.base.xue.xd.groovyEngine import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.nps.common.service.NpsApplicationContextHolder
import com.nps.data_api.service.impl.NpsDataApiService import java.lang.reflect.Type /*
* @author XueWeiWei
* @date 2019/8/9 17:24
*/
class TrainMarshallingUpdateByGKEYGroovy {
private NpsDataApiService npsDataApiService = NpsApplicationContextHolder.getApplicationContext().getBean("npsDataApiService") // public List<Object> execute(Map<Object,Object> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// npsDataApiService.exec(param,"train_marshalling_update_by_gkey")
//
// resultMap.put("resultCode","success")
//
// result.add(resultMap)
// return result
// } // public List<Object> execute(List<Map<Object,Object>> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// for (int i = 0; i < param.size(); i++) {
// npsDataApiService.exec(param[i],"train_marshalling_update_by_gkey")
// }
//
// resultMap.put("result","success")
// resultMap.put("resultCode","2")
//
// result.add(resultMap)
// return result
// } public List<Object> execute(Map<Object,Object> param){
List<Object> result = new ArrayList<>() Map queryMap = new HashMap()
Map resultMap = new HashMap() //获取数组GKEY
String GKEYList = param.get("GKEY") //获取不为空的需要更新的字段
(param.get("PREARRIVAL_LIST_FK_GKEY1") != null) ? queryMap.put("PREARRIVAL_LIST_FK_GKEY1",param.get("PREARRIVAL_LIST_FK_GKEY1")) : 1 == 1;
(param.get("PRE_TRAIN_NUMBER") != null) ? queryMap.put("PRE_TRAIN_NUMBER",param.get("PRE_TRAIN_NUMBER")) : 1 == 1;
(param.get("TRAIN_NUM") != null) ? queryMap.put("TRAIN_NUM",param.get("TRAIN_NUM")) : 1 == 1; List<Object> marshallingGKEYList
Gson gson = new Gson()
Type type = new TypeToken<List<Object>>(){}.getType()
marshallingGKEYList = gson.fromJson(GKEYList,type) //更新
for (int i = 0; i < marshallingGKEYList.size(); i++) {
queryMap.put("GKEY",marshallingGKEYList.get(i))
npsDataApiService.exec(queryMap,"train_marshalling_update_by_gkey")
} queryMap.clear()
resultMap.put("result","success")
resultMap.put("resultCode","2") result.add(resultMap) return result
}
}
postman中如何传数组的更多相关文章
- postman 中get传参数
mybatis中: @RequestMapping(value = "/detail/{id}", method = RequestMethod.GET, produces = & ...
- SSM中前台传数组。后台接受的问题
当时写得时候,忘记考虑json的jar,做个记录. 第一步:先带入jar <dependency> <groupId>com.fasterxml.jackson.core< ...
- 在MyBatis中,前台传数组批量传id处理数据方式
<update id = "dishBatchSaleOrDown"> <if test="ids != null"> <if t ...
- 如何使用postman传数组数据
如何使用postman传数组数据 在我们做api接口数据调试的时候,大部分是会用到postman的,一般请求数据的参数都是字符串,但是特殊情况下我们是需要传一个数组数据的,那么为了实现这种需求,究竟该 ...
- Postman系列三:Postman中post接口实战(上传文件、json请求)
一:接口测试过程中GET请求与POST请求的主要区别 从开发角度我们看get与post的主要区别是:1.Get是用来从服务器上获得数据,而Post是用来向服务器上传递数据:2.Get安全性比Post低 ...
- 『政善治』Postman工具 — 8、Postman中Pre-request Script的使用
目录 1.Pre-request Script介绍 2.常用SNIPPETS(片段)说明 (1)获取变量脚本: (2)设置变量脚本: (3)清空变量脚本: (4)Send a request代码片段 ...
- JavaScript中常见的数组操作函数及用法
JavaScript中常见的数组操作函数及用法 昨天写了个帖子,汇总了下常见的JavaScript中的字符串操作函数及用法.今天正好有时间,也去把JavaScript中常见的数组操作函数及用法总结一下 ...
- Asp.net中后台C#数组与前台Javascript数组交互
摘自:http://blog.csdn.net/a6225301/article/details/20003305 在上一篇<asp.net中javascript与后台c#交互>中实现了前 ...
- C语言中的指针数组
C语言中的指针数组是什么,像 char *a[]={"ddd","dsidd","lll"}; 这里讲一下注意如果我们使用了a也就是首元素的 ...
随机推荐
- TxtUtil
/** *包名:cn.yufu.utils *描述:package cn.yufu.utils; */ package cn.yufu.utils; import java.io.BufferedRe ...
- CSScomb.js --- 自定义 CSS 编写风格配置文件
一.排序分类 1. content overflow position z-index display float ... 表示定位/布局的属性(content比较特殊,作为伪元素不可少的,经常放置于 ...
- 【LeetCode 8】字符串转换整数 (atoi)
题目链接 [题解] 注意越界的处理就好 简单题 还有.. 正的-2^31不能由2^31取相反数得到,因为正的int最多到2^31-1 [代码] class Solution { public: boo ...
- ASP.NET 服务器控件对应的HTML标签
label----------<span/> button---------<input type="submit"/> textbox--------&l ...
- 【前端技术】一篇文章搞掂:JS
待补充 //以下等价 if(val) if(val!=null&&val!=undefined&&val!="") //以下等价 if(!val) ...
- openSSL实现AES加密
Openssl是很常见的C接口的库,个人觉得易用.以下是AES加密的使用备忘.如果你有一定的密码学基础,那么就很好理解.代码是从网上弄下来的(原始地址已经忘记了),然后在尝试的过程中改了一点东西.其它 ...
- 测试常用——linux 基础命令
测试常用 的 linux 基础命令 1,查看服务器日志vi 查看文件(查找关键字:exception/exception : 从上往下找,按n查找下一个关键字,按shift+n查找上一个关键字?e ...
- Awesome Adb——一份超全超详细的 ADB 用法大全
https://github.com/mzlogin/awesome-adb https://www.cnblogs.com/bravesnail/articles/5850335.html ...
- Codeforces 1169B Pairs
题目链接:http://codeforces.com/contest/1169/problem/B 题意:给你 m 对数 ,问你能不能在 1 − n 之间找到俩个不相等的 x 和 y 使得 对于前面每 ...
- java读取pdf文本转换html
补充:一下代码基于maven,现将依赖的jar包单独导出 地址:pdf jar 完整代码地址 也就两个文件 java读取pdf中的纯文字,这里使用的是pdfbox工具包 maven引入如下配置 < ...