<el-form-item label="影厅名称" prop="hallId">
<el-select v-model="addForm.hallId" placeholder="请选择影厅名称" clearable>
<el-option v-for="item in hallList" :key="item.hallId" :label="item.hallName" :value="item.hallId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="语言版本" prop="languageVersion">
<el-select v-model="addForm.languageVersion">
<el-option label="国语" value="国语"></el-option>
<el-option label="英语" value="英语"></el-option>
</el-select>
</el-form-item>
<el-form-item label="电影名称" prop="movieId">
<el-select v-model="addForm.movieId" placeholder="请选择电影名称" clearable>
<el-option v-for="item in movieList" :key="item.movieId" :label="item.movieName" :value="item.movieId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="场次日期" prop="sessionDate">
<el-date-picker v-model="addForm.sessionDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="播放时间" prop="sessionTime">
<el-time-picker v-model="addForm.playTime" value-format='HH:mm' placeholder="选择播放时间">
</el-time-picker>
</el-form-item>
</el-form>
SysSession.java
package com.rabbiter.cm.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
/**
* 场次实体类
*/
public class SysSession implements Serializable {
private static final Long serialVersionUID = 1L;
//场次编号
private Long sessionId;
//影厅编号
@NotNull(message = "场次所在影厅不能为空")
private Long hallId;
//该场次语言版本
@NotBlank(message = "场次电影语言版本不能为空")
private String languageVersion;
// 电影编号
@NotNull(message = "场次安排电影不能为空")
private Long movieId;
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "HH:mm")
private String playTime;
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "HH:mm")
private String endTime;
// 截止时间,此时间之前不可删不可改电影、影厅信息
private String deadline;
// 场次日期
@NotNull(message = "场次日期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
private LocalDate sessionDate;
// 场次票价
@NotNull(message = "场次票价不能为空")
@Size(min = 0, message = "场次票价不能为负数")
private Double sessionPrice;
// 场次提示
private String sessionTips;
// 场次座位信息
@NotBlank(message = "场次座位信息不能为空")
private String sessionSeats;
private Integer seatNums;
// 已售座位数
private Integer sallNums;
private SysHall sysHall;
private SysMovie sysMovie;
public SysSession() {
}
public SysSession(Long sessionId, Long hallId, String languageVersion, Long movieId, String playTime, String endTime, String deadline, LocalDate sessionDate, Double sessionPrice, String sessionTips, String sessionSeats, Integer seatNums, Integer sallNums, SysHall sysHall, SysMovie sysMovie) {
this.sessionId = sessionId;
this.hallId = hallId;
this.languageVersion = languageVersion;
this.movieId = movieId;
this.playTime = playTime;
this.endTime = endTime;
this.deadline = deadline;
this.sessionDate = sessionDate;
this.sessionPrice = sessionPrice;
this.sessionTips = sessionTips;
this.sessionSeats = sessionSeats;
this.seatNums = seatNums;
this.sallNums = sallNums;
this.sysHall = sysHall;
this.sysMovie = sysMovie;
}
public Long getSessionId() {
return sessionId;
}
public void setSessionId(Long sessionId) {
this.sessionId = sessionId;
}
public Long getHallId() {
return hallId;
}
public void setHallId(Long hallId) {
this.hallId = hallId;
}
public String getLanguageVersion() {
return languageVersion;
}
public void setLanguageVersion(String languageVersion) {
this.languageVersion = languageVersion;
}
public Long getMovieId() {
return movieId;
}
public void setMovieId(Long movieId) {
this.movieId = movieId;
}
public String getPlayTime() {
return playTime;
}
public void setPlayTime(String playTime) {
this.playTime = playTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getDeadline() {
return deadline;
}
public void setDeadline(String deadline) {
this.deadline = deadline;
}
public LocalDate getSessionDate() {
return sessionDate;
}
public void setSessionDate(LocalDate sessionDate) {
this.sessionDate = sessionDate;
}
public Double getSessionPrice() {
return sessionPrice;
}
public void setSessionPrice(Double sessionPrice) {
this.sessionPrice = sessionPrice;
}
public String getSessionTips() {
return sessionTips;
}
public void setSessionTips(String sessionTips) {
this.sessionTips = sessionTips;
}
public String getSessionSeats() {
return sessionSeats;
}
public void setSessionSeats(String sessionSeats) {
this.sessionSeats = sessionSeats;
}
public Integer getSeatNums() {
return seatNums;
}
public void setSeatNums(Integer seatNums) {
this.seatNums = seatNums;
}
public Integer getSallNums() {
return sallNums;
}
public void setSallNums(Integer sallNums) {
this.sallNums = sallNums;
}
public SysHall getSysHall() {
return sysHall;
}
public void setSysHall(SysHall sysHall) {
this.sysHall = sysHall;
}
public SysMovie getSysMovie() {
return sysMovie;
}
public void setSysMovie(SysMovie sysMovie) {
this.sysMovie = sysMovie;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SysSession that = (SysSession) o;
return Objects.equals(sessionId, that.sessionId) && Objects.equals(hallId, that.hallId) && Objects.equals(languageVersion, that.languageVersion) && Objects.equals(movieId, that.movieId) && Objects.equals(playTime, that.playTime) && Objects.equals(endTime, that.endTime) && Objects.equals(deadline, that.deadline) && Objects.equals(sessionDate, that.sessionDate) && Objects.equals(sessionPrice, that.sessionPrice) && Objects.equals(sessionTips, that.sessionTips) && Objects.equals(sessionSeats, that.sessionSeats) && Objects.equals(seatNums, that.seatNums) && Objects.equals(sallNums, that.sallNums) && Objects.equals(sysHall, that.sysHall) && Objects.equals(sysMovie, that.sysMovie);
}
@Override
public int hashCode() {
return Objects.hash(sessionId, hallId, languageVersion, movieId, playTime, endTime, deadline, sessionDate, sessionPrice, sessionTips, sessionSeats, seatNums, sallNums, sysHall, sysMovie);
}
@Override
public String toString() {
return "SysSession{" +
"sessionId=" + sessionId +
", hallId=" + hallId +
", languageVersion='" + languageVersion + '\'' +
", movieId=" + movieId +
", playTime='" + playTime + '\'' +
", endTime='" + endTime + '\'' +
", deadline='" + deadline + '\'' +
", sessionDate=" + sessionDate +
", sessionPrice=" + sessionPrice +
", sessionTips='" + sessionTips + '\'' +
", sessionSeats='" + sessionSeats + '\'' +
", seatNums=" + seatNums +
", sallNums=" + sallNums +
", sysHall=" + sysHall +
", sysMovie=" + sysMovie +
'}';
}
}
SysMovie.java
package com.rabbiter.cm.domain;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;
public class SysMovie implements Serializable {
private static final long serialVersionUID = 1L;
private Long movieId;
//电影名称
@NotBlank(message = "电影名称不能为空")
private String movieName;
//电影时长
private Integer movieLength;
//电影海报
private String moviePoster;
private String movieArea;
//上映日期
private Date releaseDate;
//电影总票房
private Double movieBoxOffice;
//电影简介
private String movieIntroduction;
//电影图集
private String moviePictures;
//电影的类别
private List<SysMovieCategory> movieCategoryList;
public SysMovie() {
}
public SysMovie(Long movieId, String movieName, Integer movieLength, String moviePoster, String movieArea, Date releaseDate, Double movieBoxOffice, String movieIntroduction, String moviePictures, List<SysMovieCategory> movieCategoryList) {
this.movieId = movieId;
this.movieName = movieName;
this.movieLength = movieLength;
this.moviePoster = moviePoster;
this.movieArea = movieArea;
this.releaseDate = releaseDate;
this.movieBoxOffice = movieBoxOffice;
this.movieIntroduction = movieIntroduction;
this.moviePictures = moviePictures;
this.movieCategoryList = movieCategoryList;
}
public Long getMovieId() {
return movieId;
}
public void setMovieId(Long movieId) {
this.movieId = movieId;
}
public String getMovieName() {
return movieName;
}
public void setMovieName(String movieName) {
this.movieName = movieName;
}
public Integer getMovieLength() {
return movieLength;
}
public void setMovieLength(Integer movieLength) {
this.movieLength = movieLength;
}
public String getMoviePoster() {
return moviePoster;
}
public void setMoviePoster(String moviePoster) {
this.moviePoster = moviePoster;
}
public String getMovieArea() {
return movieArea;
}
public void setMovieArea(String movieArea) {
this.movieArea = movieArea;
}
public Date getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(Date releaseDate) {
this.releaseDate = releaseDate;
}
public Double getMovieBoxOffice() {
return movieBoxOffice;
}
public void setMovieBoxOffice(Double movieBoxOffice) {
this.movieBoxOffice = movieBoxOffice;
}
public String getMovieIntroduction() {
return movieIntroduction;
}
public void setMovieIntroduction(String movieIntroduction) {
this.movieIntroduction = movieIntroduction;
}
public String getMoviePictures() {
return moviePictures;
}
public void setMoviePictures(String moviePictures) {
this.moviePictures = moviePictures;
}
public List<SysMovieCategory> getMovieCategoryList() {
return movieCategoryList;
}
public void setMovieCategoryList(List<SysMovieCategory> movieCategoryList) {
this.movieCategoryList = movieCategoryList;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SysMovie sysMovie = (SysMovie) o;
return Objects.equals(movieId, sysMovie.movieId) && Objects.equals(movieName, sysMovie.movieName) && Objects.equals(movieLength, sysMovie.movieLength) && Objects.equals(moviePoster, sysMovie.moviePoster) && Objects.equals(movieArea, sysMovie.movieArea) && Objects.equals(releaseDate, sysMovie.releaseDate) && Objects.equals(movieBoxOffice, sysMovie.movieBoxOffice) && Objects.equals(movieIntroduction, sysMovie.movieIntroduction) && Objects.equals(moviePictures, sysMovie.moviePictures) && Objects.equals(movieCategoryList, sysMovie.movieCategoryList);
}
@Override
public int hashCode() {
return Objects.hash(movieId, movieName, movieLength, moviePoster, movieArea, releaseDate, movieBoxOffice, movieIntroduction, moviePictures, movieCategoryList);
}
@Override
public String toString() {
return "SysMovie{" +
"movieId=" + movieId +
", movieName='" + movieName + '\'' +
", movieLength=" + movieLength +
", moviePoster='" + moviePoster + '\'' +
", movieArea='" + movieArea + '\'' +
", releaseDate=" + releaseDate +
", movieBoxOffice=" + movieBoxOffice +
", movieIntroduction='" + movieIntroduction + '\'' +
", moviePictures='" + moviePictures + '\'' +
", movieCategoryList=" + movieCategoryList +
'}';
}
}
在CinemaManagerApi - idea\src\main\java\com\rabbiter\cm\ controller文件夹下的BaseController.java中的适合位置,添加getResult()方法:
public ResponseResult getResult(Object data) {
return ResponseResult.success(data);
}
在CinemaManagerApi - idea\src\main\java\com\rabbiter\cm\ controller文件夹下的SysSessionController.java类中合适位置,添加addSession()方法与updateSession()方法:
addSession():
@PostMapping("/sysSession")
public ResponseResult addSession(@RequestBody SysSession sysSession) {
return getResult(sysSessionService.addSession(sysSession));
}
updateSession():
@PutMapping("/sysSession")
public ResponseResult updateSession(@RequestBody SysSession sysSession) {
return getResult(sysSessionService.updateSession(sysSession));
}