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也就是首元素的 ...
随机推荐
- YUM仓库的搭建方式
搭建YUM仓库 通俗的讲,实际上就是创建一个链接,将一堆可用于Linux系统安装的数据包用一种链接的方式给Linux系统读取,方法步骤如下: 一.找到可用的yum软件包的位置 二.创建挂载点提供访问y ...
- Java线程池ThreadPoolExecutor使用和分析
线程池是可以控制线程创建.释放,并通过某种策略尝试复用线程去执行任务的一种管理框架,从而实现线程资源与任务之间的一种平衡. 以下分析基于 JDK1.7 转自: http://www.cnblogs. ...
- mysql性能分析与故障分析
性能指标以及分析点:QPS,磁盘IO,cpu以及内存使用状况,连接数,慢查询,阻塞和锁等 qps的统计方法 ##使用方式 ,bash dba_qps.sh port(实例端口号) ## 脚本名 dba ...
- super_blocks没有导出
在模块中,通过查询super_blocks列表,来遍历系统中的所有super_block,但是出现与下面类似的错误: http://stackoverflow.com/q/5051111/941650 ...
- sed命令详解 (转载)
sed是stream editor的简称,也就是流编辑器.它一次处理一行内容,处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内 ...
- Python的datetime模块使用
两个常量 MAXYEAR:9999 MINYEAR:1 五个类 datetime.datetime:日期时间类 datetime.date:日期类 datetime.time:时间类 datetime ...
- span里面插入文字
.text-box span::before{ content:attr(data-text);}
- ubuntu16.04安装python虚拟环境
自己也是搜的教程,亲测有效 ubuntu16.04创建虚拟环境 一.linux环境 Ubuntu16.04 二.安装和配置虚拟环境 安装虚拟环境 sudo pip install virtualenv ...
- 转载:mysql sql_safe_updates 分析
今天看到一个很实用的功能,mysql_safe_updates. 只是对功能做了转载,具体原理可以看一下 delete from table t where true ; update t set c ...
- metasploit5配置数据库
#踩坑:Please run msfdb as a non-root user apt-get install postgresql #安装数据库 service postgresql start # ...