parent
34803158ac
commit
87b86bdccc
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<!-- 开启注解扫描 -->
|
||||
<context:component-scan base-package="com.ssm.di.annotation"/>
|
||||
|
||||
</beans>
|
||||
@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop.xsd">
|
||||
|
||||
|
||||
<bean id="teacher" class="com.ssm.aop.xml.Teacher">
|
||||
<property name="teacherId" value="T001"/>
|
||||
<property name="name" value="张教授"/>
|
||||
<property name="title" value="教授"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="course" class="com.ssm.aop.xml.Course">
|
||||
<property name="courseId" value="C001"/>
|
||||
<property name="courseName" value="Java程序设计"/>
|
||||
<property name="credit" value="4"/>
|
||||
<property name="teacher" ref="teacher"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="logAdvice" class="com.ssm.aop.xml.Log"/>
|
||||
|
||||
|
||||
<aop:config>
|
||||
|
||||
<aop:aspect ref="logAdvice">
|
||||
|
||||
<aop:pointcut id="printInfoPointcut"
|
||||
expression="execution(* com.ssm.aop.xml.Course.printInfo(..))"/>
|
||||
|
||||
<aop:before method="beforeAdvice" pointcut-ref="printInfoPointcut"/>
|
||||
</aop:aspect>
|
||||
</aop:config>
|
||||
|
||||
</beans>
|
||||
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- 这里是 Spring 配置,不是界面布局 -->
|
||||
|
||||
</beans>
|
||||
@ -1,45 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- 用户Bean -->
|
||||
<!-- 用户 -->
|
||||
<bean id="user" class="com.ssm.ioc.User">
|
||||
<property name="username" value="zhangsan"/>
|
||||
<property name="username" value="daiyuhang"/>
|
||||
<property name="userpass" value="123456"/>
|
||||
<property name="truename" value="张三"/>
|
||||
<property name="age" value="22"/>
|
||||
<property name="email" value="zhangsan@qq.com"/>
|
||||
<property name="truename" value="代宇航"/>
|
||||
<property name="age" value="20"/>
|
||||
<property name="role" value="管理员"/>
|
||||
</bean>
|
||||
|
||||
<!-- 订单Bean -->
|
||||
<bean id="order" class="com.ssm.ioc.Order">
|
||||
<property name="id" value="ORDER2025001"/>
|
||||
<property name="username" value="zhangsan"/>
|
||||
<property name="goodsname" value="笔记本电脑"/>
|
||||
<property name="nums" value="1"/>
|
||||
<property name="date">
|
||||
<bean class="java.util.Date"/>
|
||||
</property>
|
||||
<!-- 材料 -->
|
||||
<bean id="material" class="com.ssm.ioc.Material">
|
||||
<property name="materialId" value="M001"/>
|
||||
<property name="materialName" value="试管"/>
|
||||
<property name="type" value="玻璃耗材"/>
|
||||
<property name="stock" value="100"/>
|
||||
<property name="unit" value="个"/>
|
||||
</bean>
|
||||
|
||||
<!-- 商品Bean -->
|
||||
<bean id="goods" class="com.ssm.ioc.Goods">
|
||||
<property name="goodsId" value="G001"/>
|
||||
<property name="goodsName" value="MateBook"/>
|
||||
<property name="price" value="5999"/>
|
||||
<property name="brand" value="华为"/>
|
||||
<property name="stock" value="100"/>
|
||||
<!-- 材料记录 -->
|
||||
<bean id="materialRecord" class="com.ssm.ioc.MaterialRecord">
|
||||
<property name="recordId" value="R001"/>
|
||||
<property name="materialId" value="M001"/>
|
||||
<property name="operator" value="喻廷屿"/>
|
||||
<property name="nums" value="20"/>
|
||||
<property name="operateDate" ref="nowDate"/>
|
||||
<property name="type" value="入库"/>
|
||||
</bean>
|
||||
<bean id="nowDate" class="java.util.Date"/>
|
||||
|
||||
<!-- 预约 -->
|
||||
<bean id="appointment" class="com.ssm.ioc.Appointment">
|
||||
<property name="appointmentId" value="A001"/>
|
||||
<property name="username" value="孙佳兴"/>
|
||||
<property name="labId" value="L001"/>
|
||||
<property name="startTime" ref="startDate"/>
|
||||
<property name="endTime" ref="endDate"/>
|
||||
<property name="purpose" value="化学实验"/>
|
||||
</bean>
|
||||
<bean id="startDate" class="java.util.Date"/>
|
||||
<bean id="endDate" class="java.util.Date"/>
|
||||
|
||||
<!-- 教师Bean -->
|
||||
<bean id="teacher" class="com.ssm.ioc.Teacher">
|
||||
<property name="teacherId" value="T001"/>
|
||||
<property name="name" value="王老师"/>
|
||||
<property name="course" value="Java编程"/>
|
||||
<property name="department" value="计算机学院"/>
|
||||
<property name="workAge" value="10"/>
|
||||
<!-- 实验室 -->
|
||||
<bean id="laboratory" class="com.ssm.ioc.Laboratory">
|
||||
<property name="labId" value="L001"/>
|
||||
<property name="labName" value="化学实验室1号"/>
|
||||
<property name="location" value="实验楼3楼"/>
|
||||
<property name="capacity" value="30"/>
|
||||
<property name="status" value="空闲"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@ -0,0 +1,37 @@
|
||||
package com.ssm.aop.xml;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Appointment {
|
||||
private String appointmentId;
|
||||
private String username;
|
||||
private String labId;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private String purpose;
|
||||
|
||||
public Appointment() {}
|
||||
|
||||
public String getAppointmentId() { return appointmentId; }
|
||||
public void setAppointmentId(String appointmentId) { this.appointmentId = appointmentId; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public Date getStartTime() { return startTime; }
|
||||
public void setStartTime(Date startTime) { this.startTime = startTime; }
|
||||
public Date getEndTime() { return endTime; }
|
||||
public void setEndTime(Date endTime) { this.endTime = endTime; }
|
||||
public String getPurpose() { return purpose; }
|
||||
public void setPurpose(String purpose) { this.purpose = purpose; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("预约信息:");
|
||||
System.out.println("预约编号:" + appointmentId);
|
||||
System.out.println("预约人:" + username);
|
||||
System.out.println("实验室编号:" + labId);
|
||||
System.out.println("开始时间:" + startTime);
|
||||
System.out.println("结束时间:" + endTime);
|
||||
System.out.println("用途:" + purpose);
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package com.ssm.aop.xml;
|
||||
|
||||
public class Course {
|
||||
private String courseId;
|
||||
private String courseName;
|
||||
private int credit;
|
||||
private Teacher teacher;
|
||||
|
||||
public void setCourseId(String courseId) { this.courseId = courseId; }
|
||||
public void setCourseName(String courseName) { this.courseName = courseName; }
|
||||
public void setCredit(int credit) { this.credit = credit; }
|
||||
public void setTeacher(Teacher teacher) { this.teacher = teacher; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("课程编号:" + courseId);
|
||||
System.out.println("课程名称:" + courseName);
|
||||
System.out.println("学分:" + credit);
|
||||
System.out.println("授课教师信息:工号:" + teacher.getTeacherId() + ",姓名:" + teacher.getName() + ",职称:" + teacher.getTitle());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.ssm.aop.xml;
|
||||
|
||||
public class Laboratory {
|
||||
private String labId;
|
||||
private String labName;
|
||||
private String location;
|
||||
private int capacity;
|
||||
private String status;
|
||||
|
||||
public Laboratory() {}
|
||||
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public String getLabName() { return labName; }
|
||||
public void setLabName(String labName) { this.labName = labName; }
|
||||
public String getLocation() { return location; }
|
||||
public void setLocation(String location) { this.location = location; }
|
||||
public int getCapacity() { return capacity; }
|
||||
public void setCapacity(int capacity) { this.capacity = capacity; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("实验室信息:");
|
||||
System.out.println("实验室编号:" + labId);
|
||||
System.out.println("实验室名称:" + labName);
|
||||
System.out.println("位置:" + location);
|
||||
System.out.println("容纳人数:" + capacity);
|
||||
System.out.println("状态:" + status);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.ssm.aop.xml;
|
||||
|
||||
public class Material {
|
||||
private String materialId;
|
||||
private String materialName;
|
||||
private String type;
|
||||
private int stock;
|
||||
private String unit;
|
||||
|
||||
public Material() {}
|
||||
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getMaterialName() { return materialName; }
|
||||
public void setMaterialName(String materialName) { this.materialName = materialName; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
public int getStock() { return stock; }
|
||||
public void setStock(int stock) { this.stock = stock; }
|
||||
public String getUnit() { return unit; }
|
||||
public void setUnit(String unit) { this.unit = unit; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("材料信息:");
|
||||
System.out.println("材料编号:" + materialId);
|
||||
System.out.println("材料名称:" + materialName);
|
||||
System.out.println("类型:" + type);
|
||||
System.out.println("库存:" + stock);
|
||||
System.out.println("单位:" + unit);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.ssm.aop.xml;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MaterialRecord {
|
||||
private String recordId;
|
||||
private String materialId;
|
||||
private String operator;
|
||||
private int nums;
|
||||
private Date operateDate;
|
||||
private String type;
|
||||
|
||||
public MaterialRecord() {}
|
||||
|
||||
public String getRecordId() { return recordId; }
|
||||
public void setRecordId(String recordId) { this.recordId = recordId; }
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getOperator() { return operator; }
|
||||
public void setOperator(String operator) { this.operator = operator; }
|
||||
public int getNums() { return nums; }
|
||||
public void setNums(int nums) { this.nums = nums; }
|
||||
public Date getOperateDate() { return operateDate; }
|
||||
public void setOperateDate(Date operateDate) { this.operateDate = operateDate; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("材料出入库记录:");
|
||||
System.out.println("记录编号:" + recordId);
|
||||
System.out.println("材料编号:" + materialId);
|
||||
System.out.println("操作人:" + operator);
|
||||
System.out.println("操作数量:" + nums);
|
||||
System.out.println("操作日期:" + operateDate);
|
||||
System.out.println("操作类型:" + type);
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
package com.ssm.aop.xml;
|
||||
|
||||
public class Teacher {
|
||||
private String teacherId;
|
||||
private String name;
|
||||
private String title;
|
||||
|
||||
public void setTeacherId(String teacherId) { this.teacherId = teacherId; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
public void setTitle(String title) { this.title = title; }
|
||||
|
||||
public String getTeacherId() { return teacherId; }
|
||||
public String getName() { return name; }
|
||||
public String getTitle() { return title; }
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.ssm.aop.xml;
|
||||
|
||||
public class User {
|
||||
private String username;
|
||||
private String userpass;
|
||||
private String truename;
|
||||
private int age;
|
||||
private String role;
|
||||
|
||||
public User() {}
|
||||
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getUserpass() { return userpass; }
|
||||
public void setUserpass(String userpass) { this.userpass = userpass; }
|
||||
public String getTruename() { return truename; }
|
||||
public void setTruename(String truename) { this.truename = truename; }
|
||||
public int getAge() { return age; }
|
||||
public void setAge(int age) { this.age = age; }
|
||||
public String getRole() { return role; }
|
||||
public void setRole(String role) { this.role = role; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("用户信息:");
|
||||
System.out.println("用户名:" + username);
|
||||
System.out.println("密码:" + userpass);
|
||||
System.out.println("真实姓名:" + truename);
|
||||
System.out.println("年龄:" + age);
|
||||
System.out.println("角色:" + role);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.ssm.di;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Appointment {
|
||||
private String appointmentId;
|
||||
private String username;
|
||||
private String labId;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private String purpose;
|
||||
|
||||
public Appointment() {}
|
||||
|
||||
public String getAppointmentId() { return appointmentId; }
|
||||
public void setAppointmentId(String appointmentId) { this.appointmentId = appointmentId; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public Date getStartTime() { return startTime; }
|
||||
public void setStartTime(Date startTime) { this.startTime = startTime; }
|
||||
public Date getEndTime() { return endTime; }
|
||||
public void setEndTime(Date endTime) { this.endTime = endTime; }
|
||||
public String getPurpose() { return purpose; }
|
||||
public void setPurpose(String purpose) { this.purpose = purpose; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("预约信息:");
|
||||
System.out.println("预约编号:" + appointmentId);
|
||||
System.out.println("预约人:" + username);
|
||||
System.out.println("实验室编号:" + labId);
|
||||
System.out.println("开始时间:" + startTime);
|
||||
System.out.println("结束时间:" + endTime);
|
||||
System.out.println("用途:" + purpose);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.ssm.di;
|
||||
|
||||
public class Laboratory {
|
||||
private String labId;
|
||||
private String labName;
|
||||
private String location;
|
||||
private int capacity;
|
||||
private String status;
|
||||
|
||||
public Laboratory() {}
|
||||
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public String getLabName() { return labName; }
|
||||
public void setLabName(String labName) { this.labName = labName; }
|
||||
public String getLocation() { return location; }
|
||||
public void setLocation(String location) { this.location = location; }
|
||||
public int getCapacity() { return capacity; }
|
||||
public void setCapacity(int capacity) { this.capacity = capacity; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("实验室信息:");
|
||||
System.out.println("实验室编号:" + labId);
|
||||
System.out.println("实验室名称:" + labName);
|
||||
System.out.println("位置:" + location);
|
||||
System.out.println("容纳人数:" + capacity);
|
||||
System.out.println("状态:" + status);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.ssm.di;
|
||||
|
||||
public class Material {
|
||||
private String materialId;
|
||||
private String materialName;
|
||||
private String type;
|
||||
private int stock;
|
||||
private String unit;
|
||||
|
||||
public Material() {}
|
||||
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getMaterialName() { return materialName; }
|
||||
public void setMaterialName(String materialName) { this.materialName = materialName; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
public int getStock() { return stock; }
|
||||
public void setStock(int stock) { this.stock = stock; }
|
||||
public String getUnit() { return unit; }
|
||||
public void setUnit(String unit) { this.unit = unit; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("材料信息:");
|
||||
System.out.println("材料编号:" + materialId);
|
||||
System.out.println("材料名称:" + materialName);
|
||||
System.out.println("类型:" + type);
|
||||
System.out.println("库存:" + stock);
|
||||
System.out.println("单位:" + unit);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.ssm.di;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MaterialRecord {
|
||||
private String recordId;
|
||||
private String materialId;
|
||||
private String operator;
|
||||
private int nums;
|
||||
private Date operateDate;
|
||||
private String type;
|
||||
|
||||
public MaterialRecord() {}
|
||||
|
||||
public String getRecordId() { return recordId; }
|
||||
public void setRecordId(String recordId) { this.recordId = recordId; }
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getOperator() { return operator; }
|
||||
public void setOperator(String operator) { this.operator = operator; }
|
||||
public int getNums() { return nums; }
|
||||
public void setNums(int nums) { this.nums = nums; }
|
||||
public Date getOperateDate() { return operateDate; }
|
||||
public void setOperateDate(Date operateDate) { this.operateDate = operateDate; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("材料出入库记录:");
|
||||
System.out.println("记录编号:" + recordId);
|
||||
System.out.println("材料编号:" + materialId);
|
||||
System.out.println("操作人:" + operator);
|
||||
System.out.println("操作数量:" + nums);
|
||||
System.out.println("操作日期:" + operateDate);
|
||||
System.out.println("操作类型:" + type);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.ssm.di.annotation;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Date;
|
||||
|
||||
@Component("appointment")
|
||||
public class Appointment {
|
||||
@Value("A001")
|
||||
private String appointmentId;
|
||||
|
||||
@Value("孙佳兴")
|
||||
private String username;
|
||||
|
||||
@Value("L001")
|
||||
private String labId;
|
||||
|
||||
@Value("#{new java.util.Date()}")
|
||||
private Date startTime;
|
||||
|
||||
@Value("#{new java.util.Date()}")
|
||||
private Date endTime;
|
||||
|
||||
@Value("化学实验")
|
||||
private String purpose;
|
||||
|
||||
public Appointment() {}
|
||||
|
||||
public String getAppointmentId() { return appointmentId; }
|
||||
public void setAppointmentId(String appointmentId) { this.appointmentId = appointmentId; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public Date getStartTime() { return startTime; }
|
||||
public void setStartTime(Date startTime) { this.startTime = startTime; }
|
||||
public Date getEndTime() { return endTime; }
|
||||
public void setEndTime(Date endTime) { this.endTime = endTime; }
|
||||
public String getPurpose() { return purpose; }
|
||||
public void setPurpose(String purpose) { this.purpose = purpose; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("预约信息:");
|
||||
System.out.println("预约编号:" + appointmentId);
|
||||
System.out.println("预约人:" + username);
|
||||
System.out.println("实验室编号:" + labId);
|
||||
System.out.println("开始时间:" + startTime);
|
||||
System.out.println("结束时间:" + endTime);
|
||||
System.out.println("用途:" + purpose);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.ssm.di.annotation;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("laboratory")
|
||||
public class Laboratory {
|
||||
@Value("L001")
|
||||
private String labId;
|
||||
|
||||
@Value("化学实验室1号")
|
||||
private String labName;
|
||||
|
||||
@Value("实验楼3楼")
|
||||
private String location;
|
||||
|
||||
@Value("30")
|
||||
private int capacity;
|
||||
|
||||
@Value("空闲")
|
||||
private String status;
|
||||
|
||||
public Laboratory() {}
|
||||
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public String getLabName() { return labName; }
|
||||
public void setLabName(String labName) { this.labName = labName; }
|
||||
public String getLocation() { return location; }
|
||||
public void setLocation(String location) { this.location = location; }
|
||||
public int getCapacity() { return capacity; }
|
||||
public void setCapacity(int capacity) { this.capacity = capacity; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("实验室信息:");
|
||||
System.out.println("实验室编号:" + labId);
|
||||
System.out.println("实验室名称:" + labName);
|
||||
System.out.println("位置:" + location);
|
||||
System.out.println("容纳人数:" + capacity);
|
||||
System.out.println("状态:" + status);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.ssm.di.annotation;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("material")
|
||||
public class Material {
|
||||
@Value("M001")
|
||||
private String materialId;
|
||||
|
||||
@Value("试管")
|
||||
private String materialName;
|
||||
|
||||
@Value("玻璃耗材")
|
||||
private String type;
|
||||
|
||||
@Value("100")
|
||||
private int stock;
|
||||
|
||||
@Value("个")
|
||||
private String unit;
|
||||
|
||||
public Material() {}
|
||||
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getMaterialName() { return materialName; }
|
||||
public void setMaterialName(String materialName) { this.materialName = materialName; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
public int getStock() { return stock; }
|
||||
public void setStock(int stock) { this.stock = stock; }
|
||||
public String getUnit() { return unit; }
|
||||
public void setUnit(String unit) { this.unit = unit; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("材料信息:");
|
||||
System.out.println("材料编号:" + materialId);
|
||||
System.out.println("材料名称:" + materialName);
|
||||
System.out.println("类型:" + type);
|
||||
System.out.println("库存:" + stock);
|
||||
System.out.println("单位:" + unit);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.ssm.di.annotation;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Date;
|
||||
|
||||
@Component("materialRecord")
|
||||
public class MaterialRecord {
|
||||
@Value("R001")
|
||||
private String recordId;
|
||||
|
||||
@Value("M001")
|
||||
private String materialId;
|
||||
|
||||
@Value("喻廷屿")
|
||||
private String operator;
|
||||
|
||||
@Value("20")
|
||||
private int nums;
|
||||
|
||||
@Value("#{new java.util.Date()}")
|
||||
private Date operateDate;
|
||||
|
||||
@Value("入库")
|
||||
private String type;
|
||||
|
||||
public MaterialRecord() {}
|
||||
|
||||
public String getRecordId() { return recordId; }
|
||||
public void setRecordId(String recordId) { this.recordId = recordId; }
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getOperator() { return operator; }
|
||||
public void setOperator(String operator) { this.operator = operator; }
|
||||
public int getNums() { return nums; }
|
||||
public void setNums(int nums) { this.nums = nums; }
|
||||
public Date getOperateDate() { return operateDate; }
|
||||
public void setOperateDate(Date operateDate) { this.operateDate = operateDate; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("材料出入库记录:");
|
||||
System.out.println("记录编号:" + recordId);
|
||||
System.out.println("材料编号:" + materialId);
|
||||
System.out.println("操作人:" + operator);
|
||||
System.out.println("操作数量:" + nums);
|
||||
System.out.println("操作日期:" + operateDate);
|
||||
System.out.println("操作类型:" + type);
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,31 @@
|
||||
package com.ssm.di.annotation;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class TestAnnotation {
|
||||
public static void main(String[] args) {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("bean-di-annotation.xml");
|
||||
Course course = ac.getBean("course", Course.class);
|
||||
course.printInfo();
|
||||
// 加载Spring配置
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
|
||||
|
||||
System.out.println("===== 用户管理模块 =====");
|
||||
User user = (User) context.getBean("user");
|
||||
user.printInfo();
|
||||
|
||||
System.out.println("\n===== 材料管理模块 =====");
|
||||
Material material = (Material) context.getBean("material");
|
||||
material.printInfo();
|
||||
|
||||
System.out.println("\n===== 材料出入库管理模块 =====");
|
||||
MaterialRecord record = (MaterialRecord) context.getBean("materialRecord");
|
||||
record.printInfo();
|
||||
|
||||
System.out.println("\n===== 预约管理模块 =====");
|
||||
Appointment appointment = (Appointment) context.getBean("appointment");
|
||||
appointment.printInfo();
|
||||
|
||||
System.out.println("\n===== 实验室管理模块 =====");
|
||||
Laboratory lab = (Laboratory) context.getBean("laboratory");
|
||||
lab.printInfo();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.ssm.di.annotation;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("user")
|
||||
public class User {
|
||||
@Value("daiyuhang")
|
||||
private String username;
|
||||
|
||||
@Value("123456")
|
||||
private String userpass;
|
||||
|
||||
@Value("代宇航")
|
||||
private String truename;
|
||||
|
||||
@Value("20")
|
||||
private int age;
|
||||
|
||||
@Value("管理员")
|
||||
private String role;
|
||||
|
||||
public User() {}
|
||||
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getUserpass() { return userpass; }
|
||||
public void setUserpass(String userpass) { this.userpass = userpass; }
|
||||
public String getTruename() { return truename; }
|
||||
public void setTruename(String truename) { this.truename = truename; }
|
||||
public int getAge() { return age; }
|
||||
public void setAge(int age) { this.age = age; }
|
||||
public String getRole() { return role; }
|
||||
public void setRole(String role) { this.role = role; }
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("用户信息:");
|
||||
System.out.println("用户名:" + username);
|
||||
System.out.println("密码:" + userpass);
|
||||
System.out.println("真实姓名:" + truename);
|
||||
System.out.println("年龄:" + age);
|
||||
System.out.println("角色:" + role);
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package com.ssm.di.xml;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class TestDI {
|
||||
public static void main(String[] args) {
|
||||
// 1. 加载Spring配置文件
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("bean-di-xml.xml");
|
||||
|
||||
// 2. 获取Course对象
|
||||
Course course = context.getBean("course", Course.class);
|
||||
|
||||
// 3. 调用方法,输出信息
|
||||
course.printInfo();
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package com.ssm.first;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class TestFirst {
|
||||
public static void main(String[] args) {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("bean-first.xml");
|
||||
System.out.println("Hello Spring!");
|
||||
System.out.println("Hello Spring!");
|
||||
System.out.println("Hello Spring!");
|
||||
System.out.println("Hello Spring!");
|
||||
System.out.println("Hello Spring!");
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Appointment {
|
||||
private String appointmentId;
|
||||
private String username;
|
||||
private String labId;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private String purpose;
|
||||
|
||||
public Appointment() {
|
||||
}
|
||||
|
||||
public String getAppointmentId() { return appointmentId; }
|
||||
public void setAppointmentId(String appointmentId) { this.appointmentId = appointmentId; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public Date getStartTime() { return startTime; }
|
||||
public void setStartTime(Date startTime) { this.startTime = startTime; }
|
||||
public Date getEndTime() { return endTime; }
|
||||
public void setEndTime(Date endTime) { this.endTime = endTime; }
|
||||
public String getPurpose() { return purpose; }
|
||||
public void setPurpose(String purpose) { this.purpose = purpose; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Appointment{" +
|
||||
"appointmentId='" + appointmentId + '\'' +
|
||||
", username='" + username + '\'' +
|
||||
", labId='" + labId + '\'' +
|
||||
", startTime=" + startTime +
|
||||
", endTime=" + endTime +
|
||||
", purpose='" + purpose + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
/**
|
||||
* 商品实体类
|
||||
*/
|
||||
public class Goods {
|
||||
private String goodsId; // 商品ID
|
||||
private String goodsName; // 商品名
|
||||
private double price; // 价格
|
||||
private String brand; // 品牌
|
||||
private int stock; // 库存
|
||||
|
||||
public Goods() {}
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand(String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public int getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
public void setStock(int stock) {
|
||||
this.stock = stock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Goods{" +
|
||||
"goodsId='" + goodsId + '\'' +
|
||||
", goodsName='" + goodsName + '\'' +
|
||||
", price=" + price +
|
||||
", brand='" + brand + '\'' +
|
||||
", stock=" + stock +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
public class Laboratory {
|
||||
private String labId;
|
||||
private String labName;
|
||||
private String location;
|
||||
private int capacity;
|
||||
private String status;
|
||||
|
||||
public Laboratory() {
|
||||
}
|
||||
|
||||
public String getLabId() { return labId; }
|
||||
public void setLabId(String labId) { this.labId = labId; }
|
||||
public String getLabName() { return labName; }
|
||||
public void setLabName(String labName) { this.labName = labName; }
|
||||
public String getLocation() { return location; }
|
||||
public void setLocation(String location) { this.location = location; }
|
||||
public int getCapacity() { return capacity; }
|
||||
public void setCapacity(int capacity) { this.capacity = capacity; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Laboratory{" +
|
||||
"labId='" + labId + '\'' +
|
||||
", labName='" + labName + '\'' +
|
||||
", location='" + location + '\'' +
|
||||
", capacity=" + capacity +
|
||||
", status='" + status + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
public class Material {
|
||||
private String materialId;
|
||||
private String materialName;
|
||||
private String type;
|
||||
private int stock;
|
||||
private String unit;
|
||||
|
||||
public Material() {
|
||||
}
|
||||
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getMaterialName() { return materialName; }
|
||||
public void setMaterialName(String materialName) { this.materialName = materialName; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
public int getStock() { return stock; }
|
||||
public void setStock(int stock) { this.stock = stock; }
|
||||
public String getUnit() { return unit; }
|
||||
public void setUnit(String unit) { this.unit = unit; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Material{" +
|
||||
"materialId='" + materialId + '\'' +
|
||||
", materialName='" + materialName + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", stock=" + stock +
|
||||
", unit='" + unit + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MaterialRecord {
|
||||
private String recordId;
|
||||
private String materialId;
|
||||
private String operator;
|
||||
private int nums;
|
||||
private Date operateDate;
|
||||
private String type;
|
||||
|
||||
public MaterialRecord() {
|
||||
}
|
||||
|
||||
public String getRecordId() { return recordId; }
|
||||
public void setRecordId(String recordId) { this.recordId = recordId; }
|
||||
public String getMaterialId() { return materialId; }
|
||||
public void setMaterialId(String materialId) { this.materialId = materialId; }
|
||||
public String getOperator() { return operator; }
|
||||
public void setOperator(String operator) { this.operator = operator; }
|
||||
public int getNums() { return nums; }
|
||||
public void setNums(int nums) { this.nums = nums; }
|
||||
public Date getOperateDate() { return operateDate; }
|
||||
public void setOperateDate(Date operateDate) { this.operateDate = operateDate; }
|
||||
public String getType() { return type; }
|
||||
public void setType(String type) { this.type = type; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MaterialRecord{" +
|
||||
"recordId='" + recordId + '\'' +
|
||||
", materialId='" + materialId + '\'' +
|
||||
", operator='" + operator + '\'' +
|
||||
", nums=" + nums +
|
||||
", operateDate=" + operateDate +
|
||||
", type='" + type + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 订单实体类
|
||||
*/
|
||||
public class Order {
|
||||
private String id; // 订单编号
|
||||
private String username; // 下单人
|
||||
private String goodsname; // 商品名称
|
||||
private int nums; // 购买数量
|
||||
private Date date; // 下单日期
|
||||
|
||||
public Order() {}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getGoodsname() {
|
||||
return goodsname;
|
||||
}
|
||||
|
||||
public void setGoodsname(String goodsname) {
|
||||
this.goodsname = goodsname;
|
||||
}
|
||||
|
||||
public int getNums() {
|
||||
return nums;
|
||||
}
|
||||
|
||||
public void setNums(int nums) {
|
||||
this.nums = nums;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Order{" +
|
||||
"id='" + id + '\'' +
|
||||
", username='" + username + '\'' +
|
||||
", goodsname='" + goodsname + '\'' +
|
||||
", nums=" + nums +
|
||||
", date=" + date +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
package com.ssm.ioc;
|
||||
|
||||
/**
|
||||
* 教师实体类
|
||||
*/
|
||||
public class Teacher {
|
||||
private String teacherId; // 工号
|
||||
private String name; // 姓名
|
||||
private String course; // 授课课程
|
||||
private String department; // 部门
|
||||
private int workAge; // 教龄
|
||||
|
||||
public Teacher() {}
|
||||
|
||||
public String getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
|
||||
public void setTeacherId(String teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCourse() {
|
||||
return course;
|
||||
}
|
||||
|
||||
public void setCourse(String course) {
|
||||
this.course = course;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public int getWorkAge() {
|
||||
return workAge;
|
||||
}
|
||||
|
||||
public void setWorkAge(int workAge) {
|
||||
this.workAge = workAge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Teacher{" +
|
||||
"teacherId='" + teacherId + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", course='" + course + '\'' +
|
||||
", department='" + department + '\'' +
|
||||
", workAge=" + workAge +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue