上传完整代码

main
wuqihuidazzling 3 days ago
parent 27e6fe7256
commit 5ec6d127d2

@ -2,7 +2,10 @@
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/Testfim/Testfim/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Testfim/Testfim/xml" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Testfim.iml" filepath="$PROJECT_DIR$/Testfim.iml" />
</modules>
</component>
</project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/Testfim/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Testfim/xml" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Testfim.iml" filepath="$PROJECT_DIR$/Testfim.iml" />
</modules>
</component>
</project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/xml" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,15 @@
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
System.out.printf("Hello and welcome!");
for (int i = 1; i <= 5; i++) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
System.out.println("i = " + i);
}
}
}

@ -0,0 +1,41 @@
package com.lab.manager.entity;
/**
*
*/
public class Lab {
// 实验室ID
private String labId;
// 实验室名称
private String labName;
// 位置
private String labLocation;
// 状态(正常/维护)
private String labStatus;
public Lab() {}
public Lab(String labId, String labName, String labLocation, String labStatus) {
this.labId = labId;
this.labName = labName;
this.labLocation = labLocation;
this.labStatus = labStatus;
}
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 getLabLocation() { return labLocation; }
public void setLabLocation(String labLocation) { this.labLocation = labLocation; }
public String getLabStatus() { return labStatus; }
public void setLabStatus(String labStatus) { this.labStatus = labStatus; }
@Override
public String toString() {
return "Lab{" +
"labId='" + labId + '\'' +
", labName='" + labName + '\'' +
'}';
}
}

@ -0,0 +1,47 @@
package com.lab.manager.entity;
/**
*
* Material
*/
public class Maintain {
// 维护记录ID
private String maintainId;
// 维护时间
private String maintainTime;
// 维护内容
private String maintainContent;
// 维护人
private String maintainPerson;
// 关联材料
private Material material;
public Maintain() {}
public Maintain(String maintainId, String maintainTime, String maintainContent, String maintainPerson, Material material) {
this.maintainId = maintainId;
this.maintainTime = maintainTime;
this.maintainContent = maintainContent;
this.maintainPerson = maintainPerson;
this.material = material;
}
public String getMaintainId() { return maintainId; }
public void setMaintainId(String maintainId) { this.maintainId = maintainId; }
public String getMaintainTime() { return maintainTime; }
public void setMaintainTime(String maintainTime) { this.maintainTime = maintainTime; }
public String getMaintainContent() { return maintainContent; }
public void setMaintainContent(String maintainContent) { this.maintainContent = maintainContent; }
public String getMaintainPerson() { return maintainPerson; }
public void setMaintainPerson(String maintainPerson) { this.maintainPerson = maintainPerson; }
public Material getMaterial() { return material; }
public void setMaterial(Material material) { this.material = material; }
@Override
public String toString() {
return "Maintain{" +
"maintainId='" + maintainId + '\'' +
", material=" + material +
'}';
}
}

@ -0,0 +1,54 @@
package com.lab.manager.entity;
/**
*
* MaterialType + Lab
*/
public class Material {
// 材料ID
private String materialId;
// 材料名称
private String materialName;
// 规格
private String materialSpec;
// 库存数量
private Integer materialStock;
// 关联材料类型
private MaterialType materialType;
// 关联所属实验室
private Lab materialLab;
public Material() {}
public Material(String materialId, String materialName, String materialSpec, Integer materialStock, MaterialType materialType, Lab materialLab) {
this.materialId = materialId;
this.materialName = materialName;
this.materialSpec = materialSpec;
this.materialStock = materialStock;
this.materialType = materialType;
this.materialLab = materialLab;
}
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 getMaterialSpec() { return materialSpec; }
public void setMaterialSpec(String materialSpec) { this.materialSpec = materialSpec; }
public Integer getMaterialStock() { return materialStock; }
public void setMaterialStock(Integer materialStock) { this.materialStock = materialStock; }
public MaterialType getMaterialType() { return materialType; }
public void setMaterialType(MaterialType materialType) { this.materialType = materialType; }
public Lab getMaterialLab() { return materialLab; }
public void setMaterialLab(Lab materialLab) { this.materialLab = materialLab; }
@Override
public String toString() {
return "Material{" +
"materialId='" + materialId + '\'' +
", materialName='" + materialName + '\'' +
", materialType=" + materialType +
", materialLab=" + materialLab +
'}';
}
}

@ -0,0 +1,36 @@
package com.lab.manager.entity;
/**
*
*/
public class MaterialType {
// 类型ID
private String typeId;
// 类型名称(化学试剂/玻璃仪器/电子元件)
private String typeName;
// 类型描述
private String typeDesc;
public MaterialType() {}
public MaterialType(String typeId, String typeName, String typeDesc) {
this.typeId = typeId;
this.typeName = typeName;
this.typeDesc = typeDesc;
}
public String getTypeId() { return typeId; }
public void setTypeId(String typeId) { this.typeId = typeId; }
public String getTypeName() { return typeName; }
public void setTypeName(String typeName) { this.typeName = typeName; }
public String getTypeDesc() { return typeDesc; }
public void setTypeDesc(String typeDesc) { this.typeDesc = typeDesc; }
@Override
public String toString() {
return "MaterialType{" +
"typeId='" + typeId + '\'' +
", typeName='" + typeName + '\'' +
'}';
}
}

@ -0,0 +1,53 @@
package com.lab.manager.entity;
/**
*
* User + Lab
*/
public class Reserve {
// 预约ID
private String reserveId;
// 预约时间
private String reserveTime;
// 预约用途
private String reserveUse;
// 预约状态
private String reserveStatus;
// 关联预约用户
private User user;
// 关联预约实验室
private Lab lab;
public Reserve() {}
public Reserve(String reserveId, String reserveTime, String reserveUse, String reserveStatus, User user, Lab lab) {
this.reserveId = reserveId;
this.reserveTime = reserveTime;
this.reserveUse = reserveUse;
this.reserveStatus = reserveStatus;
this.user = user;
this.lab = lab;
}
public String getReserveId() { return reserveId; }
public void setReserveId(String reserveId) { this.reserveId = reserveId; }
public String getReserveTime() { return reserveTime; }
public void setReserveTime(String reserveTime) { this.reserveTime = reserveTime; }
public String getReserveUse() { return reserveUse; }
public void setReserveUse(String reserveUse) { this.reserveUse = reserveUse; }
public String getReserveStatus() { return reserveStatus; }
public void setReserveStatus(String reserveStatus) { this.reserveStatus = reserveStatus; }
public User getUser() { return user; }
public void setUser(User user) { this.user = user; }
public Lab getLab() { return lab; }
public void setLab(Lab lab) { this.lab = lab; }
@Override
public String toString() {
return "Reserve{" +
"reserveId='" + reserveId + '\'' +
", user=" + user +
", lab=" + lab +
'}';
}
}

@ -0,0 +1,47 @@
package com.lab.manager.entity;
/**
*
* Material
*/
public class Scrap {
// 报废记录ID
private String scrapId;
// 报废时间
private String scrapTime;
// 报废原因
private String scrapReason;
// 报废数量
private Integer scrapCount;
// 关联材料
private Material material;
public Scrap() {}
public Scrap(String scrapId, String scrapTime, String scrapReason, Integer scrapCount, Material material) {
this.scrapId = scrapId;
this.scrapTime = scrapTime;
this.scrapReason = scrapReason;
this.scrapCount = scrapCount;
this.material = material;
}
public String getScrapId() { return scrapId; }
public void setScrapId(String scrapId) { this.scrapId = scrapId; }
public String getScrapTime() { return scrapTime; }
public void setScrapTime(String scrapTime) { this.scrapTime = scrapTime; }
public String getScrapReason() { return scrapReason; }
public void setScrapReason(String scrapReason) { this.scrapReason = scrapReason; }
public Integer getScrapCount() { return scrapCount; }
public void setScrapCount(Integer scrapCount) { this.scrapCount = scrapCount; }
public Material getMaterial() { return material; }
public void setMaterial(Material material) { this.material = material; }
@Override
public String toString() {
return "Scrap{" +
"scrapId='" + scrapId + '\'' +
", material=" + material +
'}';
}
}

@ -0,0 +1,53 @@
package com.lab.manager.entity;
/**
*
* Material
*/
public class Stock {
// 出入库记录ID
private String stockId;
// 类型:入库/出库
private String stockType;
// 操作时间
private String stockTime;
// 操作数量
private Integer stockCount;
// 操作人
private String stockPerson;
// 关联材料
private Material material;
public Stock() {}
public Stock(String stockId, String stockType, String stockTime, Integer stockCount, String stockPerson, Material material) {
this.stockId = stockId;
this.stockType = stockType;
this.stockTime = stockTime;
this.stockCount = stockCount;
this.stockPerson = stockPerson;
this.material = material;
}
public String getStockId() { return stockId; }
public void setStockId(String stockId) { this.stockId = stockId; }
public String getStockType() { return stockType; }
public void setStockType(String stockType) { this.stockType = stockType; }
public String getStockTime() { return stockTime; }
public void setStockTime(String stockTime) { this.stockTime = stockTime; }
public Integer getStockCount() { return stockCount; }
public void setStockCount(Integer stockCount) { this.stockCount = stockCount; }
public String getStockPerson() { return stockPerson; }
public void setStockPerson(String stockPerson) { this.stockPerson = stockPerson; }
public Material getMaterial() { return material; }
public void setMaterial(Material material) { this.material = material; }
@Override
public String toString() {
return "Stock{" +
"stockId='" + stockId + '\'' +
", stockType='" + stockType + '\'' +
", material=" + material +
'}';
}
}

@ -0,0 +1,38 @@
package com.lab.manager.entity;
/**
* new2.4
*/
public class TestNew {
public static void main(String[] args) {
// 1. 基础对象
User user = new User("U001", "张三", "123456", "教师", "13800138000");
Lab lab = new Lab("L001", "化学实验室", "实验楼302", "正常");
MaterialType type = new MaterialType("T001", "化学试剂", "液体实验试剂");
// 2. 材料(关联类型+实验室)
Material material = new Material("M001", "无水乙醇", "500ml", 100, type, lab);
// 3. 维护记录关联材料a
Maintain maintain = new Maintain("Mt001", "2025-06-01", "更换标签", "管理员", material);
// 4. 报废记录(关联材料)
Scrap scrap = new Scrap("Sp001", "2025-06-02", "过期失效", 5, material);
// 5. 预约(关联用户+实验室)
Reserve reserve = new Reserve("R001", "2025-06-03", "教学实验", "已通过", user, lab);
// 6. 出入库(关联材料)
Stock stock = new Stock("St001", "入库", "2025-06-01", 50, "管理员", material);
// 输出验证
System.out.println("===== 传统new方式创建对象 =====");
System.out.println("用户:" + user);
System.out.println("实验室:" + lab);
System.out.println("材料:" + material);
System.out.println("维护记录:" + maintain);
System.out.println("报废记录:" + scrap);
System.out.println("预约记录:" + reserve);
System.out.println("出入库记录:" + stock);
}
}

@ -0,0 +1,50 @@
package com.lab.manager.entity;
/**
*
*/
public class User {
// 用户ID
private String userId;
// 用户名
private String userName;
// 密码
private String userPwd;
// 角色(管理员/教师/学生)
private String userRole;
// 联系方式
private String userPhone;
// 无参构造
public User() {}
// 全参构造
public User(String userId, String userName, String userPwd, String userRole, String userPhone) {
this.userId = userId;
this.userName = userName;
this.userPwd = userPwd;
this.userRole = userRole;
this.userPhone = userPhone;
}
// getter & setter
public String getUserId() { return userId; }
public void setUserId(String userId) { this.userId = userId; }
public String getUserName() { return userName; }
public void setUserName(String userName) { this.userName = userName; }
public String getUserPwd() { return userPwd; }
public void setUserPwd(String userPwd) { this.userPwd = userPwd; }
public String getUserRole() { return userRole; }
public void setUserRole(String userRole) { this.userRole = userRole; }
public String getUserPhone() { return userPhone; }
public void setUserPhone(String userPhone) { this.userPhone = userPhone; }
@Override
public String toString() {
return "User{" +
"userId='" + userId + '\'' +
", userName='" + userName + '\'' +
", userRole='" + userRole + '\'' +
'}';
}
}

@ -0,0 +1,79 @@
<?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">
<!-- 1. 用户管理 -->
<bean id="user" class="com.lab.manager.entity.User">
<property name="userId" value="U001"/>
<property name="userName" value="张三"/>
<property name="userPwd" value="123456"/>
<property name="userRole" value="教师"/>
<property name="userPhone" value="13800138000"/>
</bean>
<!-- 2. 实验室管理 -->
<bean id="lab" class="com.lab.manager.entity.Lab">
<property name="labId" value="L001"/>
<property name="labName" value="化学实验室"/>
<property name="labLocation" value="实验楼302"/>
<property name="labStatus" value="正常"/>
</bean>
<!-- 3. 材料类型管理 -->
<bean id="materialType" class="com.lab.manager.entity.MaterialType">
<property name="typeId" value="T001"/>
<property name="typeName" value="化学试剂"/>
<property name="typeDesc" value="液体实验试剂"/>
</bean>
<!-- 4. 材料管理(关联:材料类型 + 实验室) -->
<bean id="material" class="com.lab.manager.entity.Material">
<property name="materialId" value="M001"/>
<property name="materialName" value="无水乙醇"/>
<property name="materialSpec" value="500ml"/>
<property name="materialStock" value="100"/>
<property name="materialType" ref="materialType"/>
<property name="materialLab" ref="lab"/>
</bean>
<!-- 5. 材料维护管理(关联:材料) -->
<bean id="maintain" class="com.lab.manager.entity.Maintain">
<property name="maintainId" value="Mt001"/>
<property name="maintainTime" value="2025-06-01"/>
<property name="maintainContent" value="更换标签"/>
<property name="maintainPerson" value="管理员"/>
<property name="material" ref="material"/>
</bean>
<!-- 6. 材料报废管理(关联:材料) -->
<bean id="scrap" class="com.lab.manager.entity.Scrap">
<property name="scrapId" value="Sp001"/>
<property name="scrapTime" value="2025-06-02"/>
<property name="scrapReason" value="过期失效"/>
<property name="scrapCount" value="5"/>
<property name="material" ref="material"/>
</bean>
<!-- 7. 预约管理(关联:用户 + 实验室) -->
<bean id="reserve" class="com.lab.manager.entity.Reserve">
<property name="reserveId" value="R001"/>
<property name="reserveTime" value="2025-06-03"/>
<property name="reserveUse" value="教学实验"/>
<property name="reserveStatus" value="已通过"/>
<property name="user" ref="user"/>
<property name="lab" ref="lab"/>
</bean>
<!-- 8. 材料出入库管理(关联:材料) -->
<bean id="stock" class="com.lab.manager.entity.Stock">
<property name="stockId" value="St001"/>
<property name="stockType" value="入库"/>
<property name="stockTime" value="2025-06-01"/>
<property name="stockCount" value="50"/>
<property name="stockPerson" value="管理员"/>
<property name="material" ref="material"/>
</bean>
</beans>

@ -0,0 +1,79 @@
<?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">
<!-- 1. 用户管理 -->
<bean id="user" class="com.lab.manager.entity.User">
<property name="userId" value="U001"/>
<property name="userName" value="张三"/>
<property name="userPwd" value="123456"/>
<property name="userRole" value="教师"/>
<property name="userPhone" value="13800138000"/>
</bean>
<!-- 2. 实验室管理 -->
<bean id="lab" class="com.lab.manager.entity.Lab">
<property name="labId" value="L001"/>
<property name="labName" value="化学实验室"/>
<property name="labLocation" value="实验楼302"/>
<property name="labStatus" value="正常"/>
</bean>
<!-- 3. 材料类型管理 -->
<bean id="materialType" class="com.lab.manager.entity.MaterialType">
<property name="typeId" value="T001"/>
<property name="typeName" value="化学试剂"/>
<property name="typeDesc" value="液体实验试剂"/>
</bean>
<!-- 4. 材料管理(关联:材料类型 + 实验室) -->
<bean id="material" class="com.lab.manager.entity.Material">
<property name="materialId" value="M001"/>
<property name="materialName" value="无水乙醇"/>
<property name="materialSpec" value="500ml"/>
<property name="materialStock" value="100"/>
<property name="materialType" ref="materialType"/>
<property name="materialLab" ref="lab"/>
</bean>
<!-- 5. 材料维护管理(关联:材料) -->
<bean id="maintain" class="com.lab.manager.entity.Maintain">
<property name="maintainId" value="Mt001"/>
<property name="maintainTime" value="2025-06-01"/>
<property name="maintainContent" value="更换标签"/>
<property name="maintainPerson" value="管理员"/>
<property name="material" ref="material"/>
</bean>
<!-- 6. 材料报废管理(关联:材料) -->
<bean id="scrap" class="com.lab.manager.entity.Scrap">
<property name="scrapId" value="Sp001"/>
<property name="scrapTime" value="2025-06-02"/>
<property name="scrapReason" value="过期失效"/>
<property name="scrapCount" value="5"/>
<property name="material" ref="material"/>
</bean>
<!-- 7. 预约管理(关联:用户 + 实验室) -->
<bean id="reserve" class="com.lab.manager.entity.Reserve">
<property name="reserveId" value="R001"/>
<property name="reserveTime" value="2025-06-03"/>
<property name="reserveUse" value="教学实验"/>
<property name="reserveStatus" value="已通过"/>
<property name="user" ref="user"/>
<property name="lab" ref="lab"/>
</bean>
<!-- 8. 材料出入库管理(关联:材料) -->
<bean id="stock" class="com.lab.manager.entity.Stock">
<property name="stockId" value="St001"/>
<property name="stockType" value="入库"/>
<property name="stockTime" value="2025-06-01"/>
<property name="stockCount" value="50"/>
<property name="stockPerson" value="管理员"/>
<property name="material" ref="material"/>
</bean>
</beans>
Loading…
Cancel
Save