Lmx 5 months ago
parent 3425b54711
commit 1cbd412735

@ -0,0 +1,85 @@
package com.ssm.ioc;
/**
*
*
*/
public class Announcement {
private int id; // 公告的唯一编号,用于标识不同的公告
private String title; // 公告的标题,用于概括公告的主要内容
private String content; // 公告的具体内容,包含详细信息
private String publishDate; // 公告的发布日期,记录公告发布的时间
private String publisher; // 公告的发布人,记录发布公告的人员
// 构造方法、getter 和 setter 方法
/**
* Announcement
*/
public Announcement() {}
/**
* Announcement
*
* @param id
* @param title
* @param content
* @param publishDate
* @param publisher
*/
public Announcement(int id, String title, String content, String publishDate, String publisher) {
this.id = id;
this.title = title;
this.content = content;
this.publishDate = publishDate;
this.publisher = publisher;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPublishDate() {
return publishDate;
}
public void setPublishDate(String publishDate) {
this.publishDate = publishDate;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
@Override
public String toString() {
return "Announcement{" +
"id=" + id +
", title='" + title + '\'' +
", content='" + content + '\'' +
", publishDate='" + publishDate + '\'' +
", publisher='" + publisher + '\'' +
'}';
}
}

@ -0,0 +1,88 @@
package com.ssm.ioc;
/**
*
*
*/
public class Movie {
private int id; // 电影的唯一编号,用于标识不同的电影
private String name; // 电影的名称,用于展示和识别电影
private String director; // 电影的导演,记录电影的创作者之一
private String genre; // 电影的类型,如动作、冒险、科幻等
private int duration; // 电影的时长,以分钟为单位
// 构造方法、getter 和 setter 方法
//无参构造函数,用于创建一个空的 Movie 对象。
public Movie() {}
/**
* Movie
*
* @param id
* @param name
* @param director
* @param genre
* @param duration
*/
public Movie(int id, String name, String director, String genre, int duration) {
this.id = id;
this.name = name;
this.director = director;
this.genre = genre;
this.duration = duration;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDirector() {
return director;
}
public void setDirector(String director) {
this.director = director;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
/**
* toString 便
*
* @return
*/
@Override
public String toString() {
return "Movie{" +
"id=" + id +
", name='" + name + '\'' +
", director='" + director + '\'' +
", genre='" + genre + '\'' +
", duration=" + duration +
'}';
}
}

@ -0,0 +1,87 @@
package com.ssm.ioc;
/**
*
*
*/
public class ScreeningRoom {
// 放映厅的唯一编号,用于标识不同的放映厅
private int id;
// 放映厅的名称,用于识别放映厅
private String name;
// 放映厅的容量,即可以容纳的人数
private int capacity;
// 放映厅的类型,如 2D、3D 等
private String type;
// 放映厅的状态,如可用、不可用等
private String status;
// 构造方法、getter 和 setter 方法
public ScreeningRoom() {}
/**
* ScreeningRoom
*
* @param id
* @param name
* @param capacity
* @param type
* @param status
*/
public ScreeningRoom(int id, String name, int capacity, String type, String status) {
this.id = id;
this.name = name;
this.capacity = capacity;
this.type = type;
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Override
public String toString() {
return "ScreeningRoom{" +
"id=" + id +
", name='" + name + '\'' +
", capacity=" + capacity +
", type='" + type + '\'' +
", status='" + status + '\'' +
'}';
}
}

@ -0,0 +1,89 @@
package com.ssm.ioc;
/**
*
*
*/
public class ShowSchedule {
// 场次的唯一编号,用于标识不同的场次
private int id;
// 外键,关联的电影编号,用于确定该场次放映的电影
private int movieId;
// 关联的放映厅编号,用于确定该场次在哪个放映厅放映
private int screeningRoomId;
// 场次的开始时间,使用 java.util.Date 类型记录
private String startTime;
// 场次的结束时间,使用 java.util.Date 类型记录
private String endTime;
// 构造方法、getter 和 setter 方法
public ShowSchedule() {}
/**
* ShowSchedule
*
* @param id
* @param movieId
* @param screeningRoomId
* @param startTime
* @param endTime
*/
public ShowSchedule(int id, int movieId, int screeningRoomId, String startTime, String endTime) {
this.id = id;
this.movieId = movieId;
this.screeningRoomId = screeningRoomId;
this.startTime = String.valueOf(startTime);
this.endTime = String.valueOf(endTime);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMovieId() {
return movieId;
}
public void setMovieId(int movieId) {
this.movieId = movieId;
}
public int getScreeningRoomId() {
return screeningRoomId;
}
public void setScreeningRoomId(int screeningRoomId) {
this.screeningRoomId = screeningRoomId;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime =startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return "ShowSchedule{" +
"id=" + id +
", movieId=" + movieId +
", screeningRoomId=" + screeningRoomId +
", startTime=" + startTime +
", endTime=" + endTime +
'}';
}
}

@ -0,0 +1,85 @@
package com.ssm.ioc;
/**
*
*
*/
public class Tag {
private int id; // 标签的唯一编号,用于标识不同的标签
private String name; // 标签的名称,用于识别标签的用途
private String description; // 标签的描述,对标签的详细说明
private String createDate; // 标签的创建日期,记录标签创建的时间
private int status; // 标签的状态,如启用、禁用等
// 构造方法、getter 和 setter 方法
/**
* Tag
*/
public Tag() {}
/**
* Tag
*
* @param id
* @param name
* @param description
* @param createDate
* @param status
*/
public Tag(int id, String name, String description, String createDate, int status) {
this.id = id;
this.name = name;
this.description = description;
this.createDate = createDate;
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
@Override
public String toString() {
return "Tag{" +
"id=" + id +
", name='" + name + '\'' +
", description='" + description + '\'' +
", createDate='" + createDate + '\'' +
", status=" + status +
'}';
}
}

@ -0,0 +1,29 @@
package com.ssm.ioc;
import com.ssm.di.xml.Announcement;
import com.ssm.di.xml.Movie;
import com.ssm.di.xml.ScreeningRoom;
import com.ssm.di.xml.ShowSchedule;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestIoc {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("bean-ioc.xml");
Movie movie = (Movie) context.getBean("movie");
System.out.println(movie.toString());
Announcement announcement = (Announcement) context.getBean("announcement");
System.out.println(announcement);
Tag tag = (Tag) context.getBean("tag");
System.out.println(tag);
ShowSchedule showSchedule = (ShowSchedule) context.getBean("showSchedule");
System.out.println(showSchedule);
ScreeningRoom screeningRoom = (ScreeningRoom) context.getBean("screeningRoom");
System.out.println(screeningRoom);
}
}
Loading…
Cancel
Save