问题遇到的现象和发生背景
环境:前端 vue框架 后端springboot
前端多选框组件向后代传输数据,报错如下:
前端报错:
后端警告:
WARN 57556 --- [nio-9000-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance
前端代码:
<el-form-item label="动火作业种类" prop="wtype" >
<el-row >
<el-col :span="18">
<el-checkbox-group v-model="addApplyForm.wtype">
<el-checkbox label="电焊" >电焊</el-checkbox>
<el-checkbox label="电割" >电割</el-checkbox>
<el-checkbox label="其他" >其他
<el-input v-model="addApplyForm.othertype" style="width:300px;" placeholder="请输入具体描述" ></el-input>
</el-checkbox>
</el-checkbox-group>
</el-col>
</el-row>
</el-form-item>
addApplyForm:{
wtype: [],
othertype:'',
},
后端代码:
controller层
@PostMapping("/modify")
public Result<String> save(@RequestBody Apply entity){
applyService.saveOrUpdate(entity);
return ResultUtil.ok();
}
dao层
public class Apply implements Serializable{
private String wtype;
private String othertype;
}