我将Task实体表示为:@Entity@Getter@NoArgsConstructorpublic class Task { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @NotBlank private String name; @Enumerated(EnumType.STRING) private Category category; @OneToOne private Employee assignee; @OneToMany private List<Task> precedingTasks; private String details; private int estimatedTimeInMinutes; private LocalDateTime deadline; private LocalDateTime creationTime; private LocalDateTime startTime; private LocalDateTime endTime; public Task(String name, Category category, Employee assignee, List<Task> precedingTasks, String details, int estimatedTimeInMinutes, LocalDateTime deadline) { this.name = name; this.category = category; this.assignee = assignee; this.precedingTasks = precedingTasks; this.details = details; this.estimatedTimeInMinutes = estimatedTimeInMinutes; this.deadline = deadline; this.creationTime = LocalDateTime.now(); this.startTime = null; this.endTime = null; }我注意到没有precedingTasks正确添加任务,但没有正确添加。例如:添加三个任务后,precedingTasks我没有POST在 Postman 中发送,如下所示:{ "name": "Wyslac przesyłke nr 87", "category": "TODO", "assigneeId": 1, "precedingTasksId": [1, 2, 3], "details": "Dodac zakladke", "estimatedTimeInMinutes": 78, "deadline": "2013-12-18T14:30:40.100000000"}但我得到的任务没有preceding tasks:{ "id": 4, "name": "Wyslac przesyłke nr 87", "category": "TODO", "assignee": { "id": 1, "firstName": "Wojciech", "lastName": "Wasilewski", "email": "wojtek@wasilewski.pl", "role": "ADMIN", "password": "h*n$GvFE", "manager": true, "password_LENGTH": 8, "passwordValid": false },
2 回答
慕斯王
TA贡献1864条经验 获得超2个赞
您的类TaskRequest中的字段之前的TaskIds在名称上与您的 POST 请求中的之前的TasksId中的字段不对应。在 Postman 中重命名或重写 POST。
添加回答
举报
0/150
提交
取消