javascript 代码
$.ajax({
type : "POST",
traditional: true,
contentType:'application/json;charset=UTF-8',
url : ctx + '/work/day/add',
data : jsonStr,
dataType : "json",
success : function(data){
$.hideLoading();
if(data&&data.code==0){
$.toptip('工作日报提交成功', 'success');
}else{
$.toptip(data.message, 'error');
}
},
error : function(msg){
$.hideLoading();
$.toptip(msg, 'error');
}
});
后台接收参数代码
@RequestMapping(value = "/day/add",method = RequestMethod.POST)
@ResponseBody
public CommonResult addPerformanceDay(
@RequestBody PerformanceDayArgs.Add form,
HttpServletRequest request
){
.......
}
实体类
public static class Add {
@NotNull(message = "标题不能为空")
private String title;
private String des;
@Min(0)
private Long userId;
@NotNull(message = "用户名称不能为空")
private String userName;
private Long workPlanId;
@Min(0)
private Long departmentId;
@NotNull(message = "部门名称不能为空")
private String departmentName;
private List<PerformanceWorkArgs.Add> workList;
}