@PostMapping(value = "/user/list" , consumes = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "获取用户信息列表", notes = "获取用户信息列表",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE, httpMethod = "POST")
public BaseResult<UserInfo> userList(@Valid @RequestBody UserFilterRequest request) {
return BaseResultUtils.buildBaseResult(userService.userList(request));
}
@Data
@NoArgsConstructor
@ApiModel(value = "userFilterRequest", description = "根据xxx过滤用户")
public class userFilterRequest extends PageRequest {
@ApiModelProperty("xxxx")
private List<HomeClassifyEnum> homeType;
@ApiModelProperty("xxx")
private List<SexClassifyEnum> sexType; !!!注意这里!!!!
@ApiModelProperty("xxxx")
private List<HeightClassifyEnum> heightType;
}
@Getter
public enum SexClassifyEnum{
MAN("MAN", 0, "男"), !!!注意这里!!!!
FEMALE("FEMALE", 1, "女");
private String type;
private int value;
private String remark;
SexClassifyEnum(String type, int value, String remark) {
this.type = type;
this.value = value;
this.remark = remark;
}
public String getType() {
return type;
}
}
请求示例
{
"homeType": ["MAN"], !!!注意这里!!!!
"sexType": [],
"heightType": [],
"pageSize": 10,
"pageNum": 1
}
总结
请求的参数
和是enum 类型的名字
进行匹配的,而不是 enum 类型的属性