Browse Source

导入增加一个参数startSheetIndex 用以指定sheet位置

4.1.3.A
jueyue 9 years ago
parent
commit
96fd6bca41
2 changed files with 13 additions and 1 deletions
  1. +12
    -0
      easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/ImportParams.java
  2. +1
    -1
      easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/ExcelImportServer.java

+ 12
- 0
easypoi-base/src/main/java/org/jeecgframework/poi/excel/entity/ImportParams.java View File

@@ -41,6 +41,10 @@ public class ImportParams extends ExcelBaseParams {
* 主键设置,如何这个cell没有值,就跳过 或者认为这个是list的下面的值 * 主键设置,如何这个cell没有值,就跳过 或者认为这个是list的下面的值
*/ */
private int keyIndex = 0; private int keyIndex = 0;
/**
* 开始读取的sheet位置,默认为0
*/
private int startSheetIndex = 0;
/** /**
* 上传表格需要读取的sheet 数量,默认为1 * 上传表格需要读取的sheet 数量,默认为1
*/ */
@@ -135,4 +139,12 @@ public class ImportParams extends ExcelBaseParams {
this.lastOfInvalidRow = lastOfInvalidRow; this.lastOfInvalidRow = lastOfInvalidRow;
} }
public int getStartSheetIndex() {
return startSheetIndex;
}
public void setStartSheetIndex(int startSheetIndex) {
this.startSheetIndex = startSheetIndex;
}
} }

+ 1
- 1
easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/ExcelImportServer.java View File

@@ -326,7 +326,7 @@ public class ExcelImportServer extends ImportBaseService {
} }
createErrorCellStyle(book); createErrorCellStyle(book);
Map<String, PictureData> pictures; Map<String, PictureData> pictures;
for (int i = 0; i < params.getSheetNum(); i++) {
for (int i = params.getStartSheetIndex(); i < params.getSheetNum(); i++) {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" start to read excel by is ,startTime is {}", new Date().getTime()); LOGGER.debug(" start to read excel by is ,startTime is {}", new Date().getTime());
} }


Loading…
Cancel
Save