update 优化 excel 导出字典默认转为下拉框

This commit is contained in:
疯狂的狮子Li 2023-07-28 20:08:53 +08:00
parent ec6704181f
commit fea9fdaa5f
10 changed files with 18 additions and 17 deletions

View File

@ -77,14 +77,14 @@ public class SysDictData extends BaseEntity {
/**
* 是否默认Y是 N否
*/
@ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class)
@ExcelProperty(value = "是否默认", index = 5, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_yes_no")
private String isDefault;
/**
* 状态0正常 1停用
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "状态", index = 6, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;

View File

@ -53,7 +53,7 @@ public class SysDictType extends BaseEntity {
/**
* 状态0正常 1停用
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "状态", index = 3, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;

View File

@ -64,7 +64,7 @@ public class SysRole extends BaseEntity {
/**
* 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限
*/
@ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class)
@ExcelProperty(value = "数据范围", index = 4, converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope;
@ -81,7 +81,7 @@ public class SysRole extends BaseEntity {
/**
* 角色状态0正常 1停用
*/
@ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "角色状态", index = 5, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;

View File

@ -128,6 +128,9 @@ public class ExcelDownHandler implements SheetWriteHandler {
}
}
}
if (CollUtil.isEmpty(dropDownOptions)) {
return;
}
dropDownOptions.forEach(everyOptions -> {
// 如果传递了下拉框选择器参数
if (!everyOptions.getNextOptions().isEmpty()) {

View File

@ -196,10 +196,8 @@ public class ExcelUtil {
// 合并处理器
builder.registerWriteHandler(new CellMergeStrategy(list, true));
}
if (CollUtil.isNotEmpty(options)) {
// 添加下拉框操作
builder.registerWriteHandler(new ExcelDownHandler(options));
}
// 添加下拉框操作
builder.registerWriteHandler(new ExcelDownHandler(options));
builder.doWrite(list);
}

View File

@ -59,7 +59,7 @@ public class SysConfig extends BaseEntity {
/**
* 系统内置Y是 N否
*/
@ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class)
@ExcelProperty(value = "系统内置", index = 4, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_yes_no")
private String configType;

View File

@ -42,7 +42,7 @@ public class SysLogininfor implements Serializable {
/**
* 登录状态 0成功 1失败
*/
@ExcelProperty(value = "登录状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "登录状态", index = 2, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String status;

View File

@ -43,7 +43,7 @@ public class SysOperLog implements Serializable {
/**
* 业务类型0其它 1新增 2修改 3删除
*/
@ExcelProperty(value = "业务类型", converter = ExcelDictConvert.class)
@ExcelProperty(value = "业务类型", index = 2, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_oper_type")
private Integer businessType;
@ -68,7 +68,7 @@ public class SysOperLog implements Serializable {
/**
* 操作类别0其它 1后台用户 2手机端用户
*/
@ExcelProperty(value = "操作类别", converter = ExcelDictConvert.class)
@ExcelProperty(value = "操作类别", index = 5, converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=其它,1=后台用户,2=手机端用户")
private Integer operatorType;
@ -117,7 +117,7 @@ public class SysOperLog implements Serializable {
/**
* 操作状态0正常 1异常
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "状态", index = 13, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private Integer status;

View File

@ -60,7 +60,7 @@ public class SysPost extends BaseEntity {
/**
* 状态0正常 1停用
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "状态", index = 4, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;

View File

@ -53,14 +53,14 @@ public class SysUserExportVo implements Serializable {
/**
* 用户性别
*/
@ExcelProperty(value = "用户性别", converter = ExcelDictConvert.class)
@ExcelProperty(value = "用户性别", index = 5, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_user_sex")
private String sex;
/**
* 帐号状态0正常 1停用
*/
@ExcelProperty(value = "帐号状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "帐号状态", index = 6, converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
private String status;