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也就是首元素的 ...
随机推荐
- luoguP2709 小B的询问 [莫队]
题目描述 小B有一个序列,包含N个1~K之间的整数.他一共有M个询问,每个询问给定一个区间[L..R],求Sigma(c(i)^2)的值,其中i的值从1到K,其中c(i)表示数字i在[L..R]中的重 ...
- 数论+乱搞——cf181B
/* 2-type B|D^k 3-type B|D-1 11-type B|D+1 6-type B质因子分解, 7-type 其他情况 3-type: (a*(D^4-1)+b*(D^3-1)+. ...
- NX二次开发-Block UI C++界面Toggle(开关)控件的获取(持续补充)
NX9+VS2012 public: void SetBlockUIShow(); void ToggleInt::SetBlockUIShow() { //获取开关控件 //获取枚举控件 Prope ...
- PHP中文无乱码截取
正在上传文件反正无聊 就把php无乱码截取写出来吧` 参数说明 gbk 字符编码中,存储中文字符要2个字节 uft-8 字符编码中,存储中文字符要3个字节 0xa0 半个汉字 ord()— ...
- Java-Class-FC:java.time.Duration
ylbtech-Java-Class-FC:java.time.Duration 1.返回顶部 2.返回顶部 3.返回顶部 1. /* * Copyright (c) 2012, 2015, ...
- Openstack组件部署 — Nova_Install and configure a compute node
目录 目录 前文列表 Prerequisites 先决条件 Install and configure a compute node Install the packages Edit the etc ...
- GDB结合Bochs调试内核
1. 编译内核 编辑.config文件,相关项目改成如下形式: 1: CONFIG_KGDB=y 2: CONFIG_KGDB_SERIAL_CONSOLE=y 3: CONFIG_MAGIC_SYS ...
- inode缓存与dentry缓存
1. inode缓存 1: struct inode { 2: /* RCU path lookup touches following: */ 3: umode_t i_mode; 4: uid_t ...
- 文本表征:SoW、BoW、TF-IDF、Hash Trick、doc2vec、DBoW、DM
原文地址:https://www.jianshu.com/p/2f2d5d5e03f8 一.文本特征 (一)基本文本特征提取 词语数量 常,负面情绪评论含有的词语数量比正面情绪评论更多. 字符数量 常 ...
- Codeforces451A-Game With Sticks-思维
After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are pl ...