[英]How to send ArrayList or Sets<Integer> as list filtering in Request Body or URL in PUT Request
I'm trying to write a controller that will function as multiple seat reservation.The Integers list is used for filtering.我正在尝试编写一个 controller ,它将 function 作为多个座位预订。整数列表用于过滤。 My Entity looks like this:我的实体看起来像这样:
@Entity
@Id
private movieId;
private String movieName;
private String cinemaName;
private String cinemaHall;
private Intger seatingPlace;
private boolean booked;
How Can I pass list or sets in request body to access multiple update seatingPlace.如何通过请求正文中的列表或集合来访问多个更新座位。 Did I modyfing Enity or connect in smthing relation?我是否修改了 Enity 或以某种关系连接?
Acutally my multipleUpdate API works using JPA Query findByMovieNameAndCinemaNameAndcinemaHall and return me list wchich I checking isnt Empty and cheking (field boolean booked) if true so ok u can booked them. Acutally my multipleUpdate API works using JPA Query findByMovieNameAndCinemaNameAndcinemaHall and return me list wchich I checking isnt Empty and cheking (field boolean booked) if true so ok u can booked them. And after that i want filter by passing List seatingPlace and change boolen to false.之后,我想通过传递 List seatPlace 进行过滤并将布尔值更改为 false。
Based on my understanding of your requirements, a possible solution could be creating another entity (table) MovieSeatReservation and creating a One to Many relationship from your Entity.根据我对您的要求的理解,一个可能的解决方案可能是创建另一个实体(表)MovieSeatReservation 并从您的实体创建一对多关系。 It could look like this: (You can replace Entity class name with your real entity name)它可能看起来像这样:(您可以将实体 class 名称替换为您的真实实体名称)
@Entity
public class Entity {
@Id
@GeneratedValue
private Long movieId;
private String movieName;
private String cinemaName;
private String cinemaHall;
@OneToMany
private List<MovieSeatReservation> reservedSeatsStatus;
// getters and setters
}
@Entity
public class MovieSeatReservation {
@Id
@GeneratedValue
private Long id;
private boolean isReserved;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "movie_id")
private Entity entity;
// getters and setters
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.