一:如参数是
则主要是第二个注解(最简单)这个与方法是application/x-www-form-urlencoded和application/json无关:
如果是在请求头的参数则requestParm就可以(String data这样的参数)
二:若参数是实体类对象(加不加@RequestBody都行)
加上这种的处理方式
//形参max_count 则getMax_count() setMax_count 同时:maxCount 对应private String maxCount ;
public int getMax_count() {
return maxCount;
}
public void setMax_count(int maxCount) {
this.maxCount = maxCount;
}
package com.cnpc.epai.usermanagement.dto;
import io.swagger.annotations.ApiParam;
import lombok.Getter;
import lombok.Setter;
import org.junit.runners.Parameterized;
import org.springframework.data.repository.query.Param;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* @author
* @version 1.0.6
* @ClassName: UserRichfitDto
* @Description: 用于与瑞信对接实体类Dto
* @date 2019-10-23 19:23
*/
@Setter
@Getter
public class UserRichfitDto {
@ApiParam("接口名称")
private String interfaceName;
/**
* @variable 瑞信与接入方的私钥做md5后的字符串,用于接入方验证瑞信后台身份
*/
@ApiParam(value = "标示当前用户是否是管理员,为空表示否")
private String adminKey;
/**
* @variable 当admin_key为合法秘钥时,current_user_id为瑞信后台管理员,否则为普通用户。
*/
@ApiParam(value = "当前查询者的ID")
private String currentUserId;
/**
* @variable 检索类型,按NAME(姓名),EMAIL(按邮箱),MOBILE(手机号),USERIDS(用户编号),ORGID(机构ID),NAMEANDORG(姓名+空格+机构名称)
*/
@ApiParam(value = "检索类型")
private String searchType;
/**
* @variable 检索关键字对应searchType的值
*/
@ApiParam(value = "检索关键字")
private String searchValue;
/**
* @variable 返回结果最大条数,为空表示不限制
*/
@ApiParam(value = "返回结果最大条数,为空表示不限制")
private int maxCount;
/**
* @variable 为true时,需要返回用户的头像信息(base64)
*/
@ApiParam(value = "为true时,需要返回用户的头像信息(base64)")
private boolean photoRequired;
@ApiParam(value = "机构id,单值")
private String orgId;
public String getInterface_name() {
return interfaceName;
}
public void setInterface_name(String interface_name) {
this.interfaceName = interface_name;
}
public String getAdminKey() {
return adminKey;
}
public void setAdmin_key(String adminKey) {
this.adminKey = adminKey;
}
public String getCurrent_user_id() {
return currentUserId;
}
public void setCurrent_user_id(String currentUserId) {
this.currentUserId = currentUserId;
}
public String getSearch_type() {
return searchType;
}
public void setSearch_type(String searchType) {
this.searchType = searchType;
}
public String getSearch_value() {
return searchValue;
}
public void setSearch_value(String searchValue) {
this.searchValue = searchValue;
}
public int getMax_count() {
return maxCount;
}
public void setMax_count(int maxCount) {
this.maxCount = maxCount;
}
public boolean isPhoto_required() {
return photoRequired;
}
public void setPhoto_required(boolean photoRequired) {
this.photoRequired = photoRequired;
}
public String getOrg_id() {
return orgId;
}
public void setOrg_id(String orgId) {
this.orgId = orgId;
}
}
目前存在问题是:@JsonProperty 加上后,用实体对象接收但是接不到数据(我Dto是不行,后来没办法把参数换成 String data 这才可以!!!)