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() {}