bugfix-增加RoleExportExcelVO,数据范围导出字段从字典表中取值;RoleSaveReqVO中code字段名改为角色标识,保持提示文案一致
parent
35f5ee4677
commit
59fc020616
|
@ -13,6 +13,7 @@ public interface DictTypeConstants {
|
|||
// ========== SYSTEM 模块 ==========
|
||||
|
||||
String USER_SEX = "system_user_sex"; // 用户性别
|
||||
String DATA_SCOPE = "system_data_scope"; // 数据范围
|
||||
|
||||
String LOGIN_TYPE = "system_login_type"; // 登录日志的类型
|
||||
String LOGIN_RESULT = "system_login_result"; // 登录结果
|
||||
|
|
|
@ -27,10 +27,10 @@ public interface ErrorCodeConstants {
|
|||
// ========== 角色模块 1-002-002-000 ==========
|
||||
ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1_002_002_000, "角色不存在");
|
||||
ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1_002_002_001, "已经存在名为【{}】的角色");
|
||||
ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1_002_002_002, "已经存在编码为【{}】的角色");
|
||||
ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1_002_002_002, "已经存在标识为【{}】的角色");
|
||||
ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1_002_002_003, "不能操作类型为系统内置的角色");
|
||||
ErrorCode ROLE_IS_DISABLE = new ErrorCode(1_002_002_004, "名字为【{}】的角色已被禁用");
|
||||
ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "编码【{}】不能使用");
|
||||
ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "标识【{}】不能使用");
|
||||
|
||||
// ========== 用户模块 1-002-003-000 ==========
|
||||
ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "用户账号已经存在");
|
||||
|
|
|
@ -93,8 +93,8 @@ public class RoleController {
|
|||
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<RoleDO> list = roleService.getRolePage(exportReqVO).getList();
|
||||
// 输出
|
||||
ExcelUtils.write(response, "角色数据.xls", "数据", RoleRespVO.class,
|
||||
BeanUtils.toBean(list, RoleRespVO.class));
|
||||
ExcelUtils.write(response, "角色数据.xls", "数据", RoleExportExcelVO.class,
|
||||
BeanUtils.toBean(list, RoleExportExcelVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package cn.iocoder.yudao.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoleExportExcelVO {
|
||||
|
||||
@ExcelProperty("角色序号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("角色名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("角色标志")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("角色排序")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty(value = "角色状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty(value = "数据范围", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.DATA_SCOPE)
|
||||
private Integer dataScope;
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
package cn.iocoder.yudao.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
@ -14,29 +9,22 @@ import java.util.Set;
|
|||
|
||||
@Schema(description = "管理后台 - 角色信息 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RoleRespVO {
|
||||
|
||||
@Schema(description = "角色编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("角色序号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "管理员")
|
||||
@ExcelProperty("角色名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "角色标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "admin")
|
||||
@NotBlank(message = "角色标志不能为空")
|
||||
@ExcelProperty("角色标志")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@ExcelProperty("角色排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "角色状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "角色类型,参见 RoleTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
|
@ -46,7 +34,6 @@ public class RoleRespVO {
|
|||
private String remark;
|
||||
|
||||
@Schema(description = "数据范围,参见 DataScopeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("数据范围")
|
||||
private Integer dataScope;
|
||||
|
||||
@Schema(description = "数据范围(指定部门数组)", example = "1")
|
||||
|
|
|
@ -24,7 +24,7 @@ public class RoleSaveReqVO {
|
|||
|
||||
@NotBlank(message = "角色标志不能为空")
|
||||
@Size(max = 100, message = "角色标志长度不能超过 100 个字符")
|
||||
@Schema(description = "角色编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ADMIN")
|
||||
@Schema(description = "角色标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "ADMIN")
|
||||
@DiffLogField(name = "角色标志")
|
||||
private String code;
|
||||
|
||||
|
|
Loading…
Reference in New Issue