前端传值
jQ.ajax({
type: "POST",
url: url,
contentType: 'application/json',
dataType: "JSON",
data: JSON.stringify(Object.assign({},data.field,{creditScoreOptionList: table.cache["test"]})),
success: function (data) {
if (data.code === 0) {
parent.window.doClose();
} else {
alert("请求失败!请联系管理员!");
}
},
error: function () {
alert("请求失败!请联系管理员!");
}
});
后端接收
@At
@Ok("json")
@AdaptBy(type = JsonAdaptor.class)
public Map<String,Object> insertCreditScore(HttpServletRequest request,
CreditScore creditScore,
@Attr("userInfo") User user) {
return creditScoreLogic.insertCreditScore(request,creditScore,user);
}
实体类
@Table("CREDIT_SCORE")
public class CreditScore {
@Name
private String id;
private String province_id;
private String province;
private String city_id;
private String city;
private String certification_organization;
private Integer is_valid;
private String emp_id;
private String emp_name;
private Date create_date;
private String update_id;
private String update_user;
private Date update_date;
private String attachmentdata;
@Readonly
private List<CreditScoreOption> creditScoreOptionList;
}
报错
java.lang.ClassCastException: org.nutz.lang.util.NutMap cannot be cast to cn.zn.pm.creditscore.data.CreditScoreOption
at cn.zn.pm.creditscore.logic.CreditScoreLogic.insertCreditScore(CreditScoreLogic.java:140)
at cn.zn.pm.creditscore.act.CreditScoreAct.insertCreditScore(CreditScoreAct.java:47)
at cn.zn.pm.creditscore.act.CreditScoreAct$FM$insertCreditScore$0d11f5c469ed196649ab1ea8aa48e334.invoke(CreditScoreAct.java)