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

This commit is contained in:
疯狂的狮子Li
2023-07-28 20:29:25 +08:00
parent 6256dcfbcc
commit 378be90929
10 changed files with 18 additions and 18 deletions

View File

@@ -79,14 +79,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

@@ -55,7 +55,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

@@ -44,7 +44,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

@@ -45,7 +45,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;
@@ -70,7 +70,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;
@@ -119,7 +119,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

@@ -17,7 +17,6 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Set;
/**
* 角色表 sys_role
@@ -65,7 +64,7 @@ public class SysRole extends BaseEntity {
/**
* 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限
*/
@ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class)
@ExcelProperty(value = "数据范围", index = 5, converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope;
@@ -82,7 +81,7 @@ public class SysRole extends BaseEntity {
/**
* 角色状态0正常 1停用
*/
@ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class)
@ExcelProperty(value = "角色状态", index = 6, 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

@@ -61,7 +61,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

@@ -62,7 +62,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;