fix: 修复空字段导致的导入问题
This commit is contained in:
@@ -57,10 +57,11 @@ public class AsphaltDomestic extends Model<AsphaltDomestic> {
|
||||
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) {
|
||||
|
@@ -66,13 +66,14 @@ public class SanmingSteel extends Model<SanmingSteel> {
|
||||
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) {
|
||||
|
@@ -31,14 +31,15 @@ public class SteelEntity<T extends Model<?>> extends Model<T> {
|
||||
}
|
||||
|
||||
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() {}
|
||||
|
Reference in New Issue
Block a user