I have a spreadsheet that looks like so...
US LC US MC
40 55.39 3.26
39 54.39 1.26
This is it's POJO:
@Data
public class ExcelObject {
private BigDecimal timePeriod;
private BigDecimal usLc;
private BigDecimal usMc;
}
I need to transform this sheet and save it to the database like so...
TIME_PERIOD, LABEL, ALLOCATION
40, "US LC", 55.39
40, "US MC", 3.26
39, "US LC", 54.39
39, "US MC", 1.26
This is the POJO for the transformed ExcelObject
:
@Data
public class ExcelItem {
private BigDecimal timePeriod;
private String label;
private BigDecimal allocation;
}
What's the best Spring Batch strategy to accomplish this transformation? I have a row mapper to map the data as-is from the spreadsheet. I was thinking in my processor I'd make the transformation. But how do I return 4 results from the processor, and write 4 rows? Thanks.
question from:
https://stackoverflow.com/questions/65853077/spring-batch-map-and-write-1-many-rows 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…