From ae6212db49955ad1bb22f86be97242e980247f2f Mon Sep 17 00:00:00 2001 From: han0 Date: Mon, 3 Jun 2024 17:22:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A9=BA=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=AF=BC=E8=87=B4=E7=9A=84=E5=AF=BC=E5=85=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mjkf/xinke/main/model/db/AsphaltDomestic.java | 9 +++++---- .../mjkf/xinke/main/model/db/SanmingSteel.java | 13 +++++++------ .../mjkf/xinke/main/model/db/SteelEntity.java | 15 ++++++++------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/main/java/mjkf/xinke/main/model/db/AsphaltDomestic.java b/src/main/java/mjkf/xinke/main/model/db/AsphaltDomestic.java index 5715b70..640572c 100644 --- a/src/main/java/mjkf/xinke/main/model/db/AsphaltDomestic.java +++ b/src/main/java/mjkf/xinke/main/model/db/AsphaltDomestic.java @@ -57,10 +57,11 @@ public class AsphaltDomestic extends Model { public AsphaltDomestic () {} public AsphaltDomestic (Row row) { - this.setName(row.getCell(0).getStringCellValue()); - this.setPrice(BigDecimal.valueOf(row.getCell(1).getNumericCellValue())); - this.setDate(row.getCell(2).getLocalDateTimeCellValue().toLocalDate()); - this.setFrom(row.getCell(3).getStringCellValue()); + var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK; + this.setName(row.getCell(0, policy).getStringCellValue()); + this.setPrice(BigDecimal.valueOf(row.getCell(1, policy).getNumericCellValue())); + this.setDate(row.getCell(2, policy).getLocalDateTimeCellValue().toLocalDate()); + this.setFrom(row.getCell(3, policy).getStringCellValue()); } public AsphaltDomestic update(AsphaltDomestic item) { diff --git a/src/main/java/mjkf/xinke/main/model/db/SanmingSteel.java b/src/main/java/mjkf/xinke/main/model/db/SanmingSteel.java index 0e62e08..c642b17 100644 --- a/src/main/java/mjkf/xinke/main/model/db/SanmingSteel.java +++ b/src/main/java/mjkf/xinke/main/model/db/SanmingSteel.java @@ -66,13 +66,14 @@ public class SanmingSteel extends Model { public SanmingSteel () {} public SanmingSteel (Row row) { + var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK; row.getCell(1).setCellType(CellType.STRING); - this.setName(row.getCell(0).getStringCellValue()); - this.setSpec(row.getCell(1).getStringCellValue()); - this.setMaterial(row.getCell(2).getStringCellValue()); - this.setPrice(BigDecimal.valueOf(row.getCell(3).getNumericCellValue())); - this.setFluctuating(BigDecimal.valueOf(row.getCell(4).getNumericCellValue())); - this.setDate(row.getCell(5).getLocalDateTimeCellValue().toLocalDate()); + this.setName(row.getCell(0, policy).getStringCellValue()); + this.setSpec(row.getCell(1, policy).getStringCellValue()); + this.setMaterial(row.getCell(2, policy).getStringCellValue()); + this.setPrice(BigDecimal.valueOf(row.getCell(3, policy).getNumericCellValue())); + this.setFluctuating(BigDecimal.valueOf(row.getCell(4, policy).getNumericCellValue())); + this.setDate(row.getCell(5, policy).getLocalDateTimeCellValue().toLocalDate()); } public SanmingSteel update(SanmingSteel item) { diff --git a/src/main/java/mjkf/xinke/main/model/db/SteelEntity.java b/src/main/java/mjkf/xinke/main/model/db/SteelEntity.java index 6f520c9..48b1d7c 100644 --- a/src/main/java/mjkf/xinke/main/model/db/SteelEntity.java +++ b/src/main/java/mjkf/xinke/main/model/db/SteelEntity.java @@ -31,14 +31,15 @@ public class SteelEntity> extends Model { } public void fromRow(Row row) { + var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK; row.getCell(1).setCellType(CellType.STRING); - this.setName(row.getCell(0).getStringCellValue()); - this.setSpec(row.getCell(1).getStringCellValue()); - this.setMaterial(row.getCell(2).getStringCellValue()); - this.setSource(row.getCell(3).getStringCellValue()); - this.setPrice(BigDecimal.valueOf(row.getCell(4).getNumericCellValue())); - this.setFluctuating(BigDecimal.valueOf(row.getCell(5).getNumericCellValue())); - this.setDate(row.getCell(6).getLocalDateTimeCellValue().toLocalDate()); + this.setName(row.getCell(0, policy).getStringCellValue()); + this.setSpec(row.getCell(1, policy).getStringCellValue()); + this.setMaterial(row.getCell(2, policy).getStringCellValue()); + this.setSource(row.getCell(3, policy).getStringCellValue()); + this.setPrice(BigDecimal.valueOf(row.getCell(4, policy).getNumericCellValue())); + this.setFluctuating(BigDecimal.valueOf(row.getCell(5, policy).getNumericCellValue())); + this.setDate(row.getCell(6, policy).getLocalDateTimeCellValue().toLocalDate()); } public SteelEntity() {}