导入表头名称无法确定或太长,可根据列下标对应。

This commit is contained in:
呼叫彩虹 2021-12-23 09:32:37 +00:00 committed by Gitee
parent be412faf6c
commit 23d0f1c11c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 8 additions and 1 deletions

View File

@ -51,6 +51,11 @@ public @interface Excel
*/
public int scale() default -1;
/**
* index 下标 默认:-1(默认不开启下标)
*/
public int index() default -1;
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/

View File

@ -24,7 +24,7 @@ public class SysUser extends BaseEntity
private static final long serialVersionUID = 1L;
/** 用户ID */
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号", index = 0)
private Long userId;
/** 部门ID */

View File

@ -277,6 +277,8 @@ public class ExcelUtil<T>
if (column != null)
{
fieldsMap.put(column, objects);
} else if(attr.index != -1){
fieldsMap.put(attr.index, objects);
}
}
for (int i = titleNum + 1; i <= rows; i++)