问题原因:前端传给我的参数是数组,数据库中字段是varchar
解决方法:在实体类中多定义一个字段接收数组,再用set方法给需要赋值的字段
@ApiModelProperty("估值岗id")
private String valuationPostId;
@ApiModelProperty("资金岗id")
private String fundPostId;
@ApiModelProperty("估值岗id")
private List<String> valuationPostIds;
public String getValuationPostId() {
return StringUtils.join(valuationPostIds,",");
}
public void setValuationPostId(String valuationPostId) {
if(StringUtils.isEmpty(valuationPostId)){
this.valuationPost = null;
this.valuationPostIds = null;
return;
}
this.valuationPostId = valuationPostId;
this.valuationPostIds = Arrays.asList(valuationPostId);
}
@ApiModelProperty("资金岗id")
private List<String> fundPostIds;
public String getFundPostId() {
return StringUtils.join(fundPostIds,",");
}
public void setFundPost(String fundPostId) {
if(StringUtils.isEmpty(fundPostId)){
this.fundPostIds = null;
this.fundPostId = null;
return;
}
this.fundPostId = fundPostId;
this.fundPostIds = Arrays.asList(fundPostId);
}