We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如下,一个Application包含多个AcItem。前端如何一次性将这一对多的关系提交?
Application
AcItem
public class Application { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private int month; private int week; private int DC; private boolean isCheck; // 是否已审核 @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", updatable = false, insertable = false) private LocalDateTime insertTime; //插入时间 @ManyToOne private User applicant; // 申请人 @ManyToOne private User auditor; // 审核人 @OneToMany(mappedBy = "application") private List<AcItem> acItems; //本次绩效申请包含的 AC申请 }
public class AcItem { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private int AC; private String reason; @ManyToOne private Application application; //ac申请属于的周绩效申请 }
The text was updated successfully, but these errors were encountered:
前端传来的application如下
application
{ "applicant": { "id": 1 }, "auditor": { "id": 1 }, "month": 9, "week": 4, "dc": 2, "acItems": [ { "ac": 1, "reason": "组会汇报" }, { "ac": 1, "reason": "论文评审" }, { "ac": 1, "reason": "组会评审" } ] }
controller处,将json反序列化为application对象,json中的acItems也被反序列化为List<AcItem>,但是并不能被持久化! https://github.com/zhanyeye/dingtalk-springboot/blob/df23baf3fb9d74bffb0555e87f046248bd35c8cc/src/main/java/com/softeng/dingtalk/controller/ApplicationController.java#L47-L54 需要自行插入application,并持久化 https://github.com/zhanyeye/dingtalk-springboot/blob/df23baf3fb9d74bffb0555e87f046248bd35c8cc/src/main/java/com/softeng/dingtalk/service/AcItemService.java#L25-L36
json
List<AcItem>
Sorry, something went wrong.
zhanyeye
No branches or pull requests
如下,一个
Application
包含多个AcItem
。前端如何一次性将这一对多的关系提交?The text was updated successfully, but these errors were encountered: