发送的参数:
{"id":1,
"shiftDetails":[{"id":1,"lineId":2}],
"broadcasts":[{"id":1,"lineId":1,"imgPath":"TEST1"},
{"id":2,"lineId":2,"imgPath":"TEST2"}]
}
Controller类:
@Controller
@RequestMapping("/travelLine")
public class TravelLineController {
@RequestMapping("/insertTest")
@ResponseBody
public Json insertTest(@RequestBody TravelLineDomain tl) {
Json j = new Json();
j.setData(tl);
return j;
}
}
TravelLineDomain实体类:
@Table(name = "t_travel_line")
public class TravelLineDomain{
@Id
@GeneratedValue(generator = "JDBC")
private Integer id;
private List<ShiftDetailDomain> shiftDetails;
private List<BroadcastDomain> Broadcasts;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public List<ShiftDetailDomain> getShiftDetails() {
return shiftDetails;
}
public void setShiftDetails(List<ShiftDetailDomain> shiftDetails) {
this.shiftDetails = shiftDetails;
}
public List<BroadcastDomain> getBroadcasts() {
return Broadcasts;
}
public void setBroadcasts(List<BroadcastDomain> broadcasts) {
Broadcasts = broadcasts;
}
}
有问题可留言哦,看见会第一时间回复!
网友评论