diff --git a/.idea/0402 第二次.iml b/.idea/0402 第二次.iml index d6ebd48..9ed2a79 100644 --- a/.idea/0402 第二次.iml +++ b/.idea/0402 第二次.iml @@ -2,7 +2,10 @@ - + + + + diff --git a/Testfim/.idea/.gitignore b/Testfim/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Testfim/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Testfim/.idea/misc.xml b/Testfim/.idea/misc.xml new file mode 100644 index 0000000..8ed5f34 --- /dev/null +++ b/Testfim/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Testfim/.idea/modules.xml b/Testfim/.idea/modules.xml new file mode 100644 index 0000000..b89b82e --- /dev/null +++ b/Testfim/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Testfim/Testfim.iml b/Testfim/Testfim.iml new file mode 100644 index 0000000..8b6e7b5 --- /dev/null +++ b/Testfim/Testfim.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Testfim/Testfim/.gitignore b/Testfim/Testfim/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/Testfim/Testfim/.gitignore @@ -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 \ No newline at end of file diff --git a/Testfim/Testfim/.idea/.gitignore b/Testfim/Testfim/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/Testfim/Testfim/.idea/.gitignore @@ -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 diff --git a/Testfim/Testfim/.idea/misc.xml b/Testfim/Testfim/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/Testfim/Testfim/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Testfim/Testfim/.idea/modules.xml b/Testfim/Testfim/.idea/modules.xml new file mode 100644 index 0000000..b89b82e --- /dev/null +++ b/Testfim/Testfim/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Testfim/Testfim/Testfim.iml b/Testfim/Testfim/Testfim.iml new file mode 100644 index 0000000..a4344ac --- /dev/null +++ b/Testfim/Testfim/Testfim.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Testfim/Testfim/src/Main.java b/Testfim/Testfim/src/Main.java new file mode 100644 index 0000000..930198c --- /dev/null +++ b/Testfim/Testfim/src/Main.java @@ -0,0 +1,15 @@ +//TIP To Run code, press or +// click the icon in the gutter. +public class Main { + public static void main(String[] args) { + //TIP Press 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 to start debugging your code. We have set one breakpoint + // for you, but you can always add more by pressing . + System.out.println("i = " + i); + } + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/Lab.java b/Testfim/Testfim/src/com.lab.manager.entity/Lab.java new file mode 100644 index 0000000..43fdf9d --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/Lab.java @@ -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 + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/Maintain.java b/Testfim/Testfim/src/com.lab.manager.entity/Maintain.java new file mode 100644 index 0000000..6ff616e --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/Maintain.java @@ -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 + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/Material.java b/Testfim/Testfim/src/com.lab.manager.entity/Material.java new file mode 100644 index 0000000..f732bd7 --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/Material.java @@ -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 + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/MaterialType.java b/Testfim/Testfim/src/com.lab.manager.entity/MaterialType.java new file mode 100644 index 0000000..e8177ae --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/MaterialType.java @@ -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 + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/Reserve.java b/Testfim/Testfim/src/com.lab.manager.entity/Reserve.java new file mode 100644 index 0000000..72b9f24 --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/Reserve.java @@ -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 + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/Scrap.java b/Testfim/Testfim/src/com.lab.manager.entity/Scrap.java new file mode 100644 index 0000000..7b7b823 --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/Scrap.java @@ -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 + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/Stock.java b/Testfim/Testfim/src/com.lab.manager.entity/Stock.java new file mode 100644 index 0000000..d875db9 --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/Stock.java @@ -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 + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/TestNew.java b/Testfim/Testfim/src/com.lab.manager.entity/TestNew.java new file mode 100644 index 0000000..9b7d12c --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/TestNew.java @@ -0,0 +1,38 @@ +package com.lab.manager.entity; + +/** + * 测试对象创建与关联关系(传统new方式,对应教材2.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); + } +} \ No newline at end of file diff --git a/Testfim/Testfim/src/com.lab.manager.entity/User.java b/Testfim/Testfim/src/com.lab.manager.entity/User.java new file mode 100644 index 0000000..fba40ee --- /dev/null +++ b/Testfim/Testfim/src/com.lab.manager.entity/User.java @@ -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 + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/Testfim/Testfim/xml/bean.xml b/Testfim/Testfim/xml/bean.xml new file mode 100644 index 0000000..e2a2020 --- /dev/null +++ b/Testfim/Testfim/xml/bean.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Testfim/out/production/Testfim/Main.class b/Testfim/out/production/Testfim/Main.class new file mode 100644 index 0000000..78ba6c1 Binary files /dev/null and b/Testfim/out/production/Testfim/Main.class differ diff --git a/Testfim/out/production/Testfim/bean.xml b/Testfim/out/production/Testfim/bean.xml new file mode 100644 index 0000000..e2a2020 --- /dev/null +++ b/Testfim/out/production/Testfim/bean.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/Lab.class b/Testfim/out/production/Testfim/com/lab/manager/entity/Lab.class new file mode 100644 index 0000000..4b41d7e Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/Lab.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/Maintain.class b/Testfim/out/production/Testfim/com/lab/manager/entity/Maintain.class new file mode 100644 index 0000000..5abf2fe Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/Maintain.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/Material.class b/Testfim/out/production/Testfim/com/lab/manager/entity/Material.class new file mode 100644 index 0000000..6eb7635 Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/Material.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/MaterialType.class b/Testfim/out/production/Testfim/com/lab/manager/entity/MaterialType.class new file mode 100644 index 0000000..1b04cf8 Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/MaterialType.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/Reserve.class b/Testfim/out/production/Testfim/com/lab/manager/entity/Reserve.class new file mode 100644 index 0000000..2cf57a5 Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/Reserve.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/Scrap.class b/Testfim/out/production/Testfim/com/lab/manager/entity/Scrap.class new file mode 100644 index 0000000..b88dde4 Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/Scrap.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/Stock.class b/Testfim/out/production/Testfim/com/lab/manager/entity/Stock.class new file mode 100644 index 0000000..5955699 Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/Stock.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/TestNew.class b/Testfim/out/production/Testfim/com/lab/manager/entity/TestNew.class new file mode 100644 index 0000000..7fd9ba5 Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/TestNew.class differ diff --git a/Testfim/out/production/Testfim/com/lab/manager/entity/User.class b/Testfim/out/production/Testfim/com/lab/manager/entity/User.class new file mode 100644 index 0000000..7732628 Binary files /dev/null and b/Testfim/out/production/Testfim/com/lab/manager/entity/User.class differ