项目结构调整 x 9 : 分拆字典类型的枚举分拆

This commit is contained in:
YunaiV 2021-04-30 00:35:04 +08:00
parent 1fe8d1cc89
commit 35f1eb95b6
29 changed files with 111 additions and 135 deletions

View File

@ -20,6 +20,10 @@
<properties> <properties>
<revision>1.0.0</revision> <revision>1.0.0</revision>
<!-- Maven 相关 -->
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties> </properties>
<dependencyManagement> <dependencyManagement>

View File

@ -16,12 +16,6 @@
<description>管理后台 Server提供其 API 接口</description> <description>管理后台 Server提供其 API 接口</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url> <url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>

View File

@ -4,10 +4,10 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class DashboardApplication { public class AdminServerApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(DashboardApplication.class, args); SpringApplication.run(AdminServerApplication.class, args);
} }
} }

View File

@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.infra.controller.config.vo;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -30,11 +30,11 @@ public class InfConfigExcelVO {
private String value; private String value;
@ExcelProperty(value = "参数类型", converter = DictConvert.class) @ExcelProperty(value = "参数类型", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.SYS_CONFIG_TYPE) @DictFormat(SysDictTypeConstants.CONFIG_TYPE)
private Integer type; private Integer type;
@ExcelProperty(value = "是否敏感", converter = DictConvert.class) @ExcelProperty(value = "是否敏感", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.SYS_BOOLEAN_STRING) @DictFormat(SysDictTypeConstants.BOOLEAN_STRING)
private Boolean sensitive; private Boolean sensitive;
@ExcelProperty("备注") @ExcelProperty("备注")

View File

@ -2,13 +2,12 @@ package cn.iocoder.dashboard.modules.infra.controller.job.vo.job;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.infra.enums.InfDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.INF_JOB_STATUS;
/** /**
* 定时任务 Excel VO * 定时任务 Excel VO
* *
@ -24,7 +23,7 @@ public class InfJobExcelVO {
private String name; private String name;
@ExcelProperty(value = "任务状态", converter = DictConvert.class) @ExcelProperty(value = "任务状态", converter = DictConvert.class)
@DictFormat(INF_JOB_STATUS) @DictFormat(InfDictTypeConstants.JOB_STATUS)
private Integer status; private Integer status;
@ExcelProperty("处理器的名字") @ExcelProperty("处理器的名字")

View File

@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.infra.controller.job.vo.log;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import cn.iocoder.dashboard.modules.infra.enums.InfDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -41,7 +41,7 @@ public class InfJobLogExcelVO {
private Integer duration; private Integer duration;
@ExcelProperty(value = "任务状态", converter = DictConvert.class) @ExcelProperty(value = "任务状态", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.INF_JOB_STATUS) @DictFormat(InfDictTypeConstants.JOB_STATUS)
private Integer status; private Integer status;
@ExcelProperty("结果数据") @ExcelProperty("结果数据")

View File

@ -2,13 +2,12 @@ package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.USER_TYPE;
/** /**
* API 访问日志 Excel VO * API 访问日志 Excel VO
* *
@ -27,7 +26,7 @@ public class InfApiAccessLogExcelVO {
private Long userId; private Long userId;
@ExcelProperty(value = "用户类型", converter = DictConvert.class) @ExcelProperty(value = "用户类型", converter = DictConvert.class)
@DictFormat(USER_TYPE) @DictFormat(SysDictTypeConstants.USER_TYPE)
private Integer userType; private Integer userType;
@ExcelProperty("应用名") @ExcelProperty("应用名")

View File

@ -2,14 +2,13 @@ package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apierrorlog;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.infra.enums.InfDictTypeConstants;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.INF_API_ERROR_LOG_PROCESS_STATUS;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.USER_TYPE;
/** /**
* API 错误日志 Excel VO * API 错误日志 Excel VO
* *
@ -28,7 +27,7 @@ public class InfApiErrorLogExcelVO {
private Integer userId; private Integer userId;
@ExcelProperty(value = "用户类型", converter = DictConvert.class) @ExcelProperty(value = "用户类型", converter = DictConvert.class)
@DictFormat(USER_TYPE) @DictFormat(SysDictTypeConstants.USER_TYPE)
private Integer userType; private Integer userType;
@ExcelProperty("应用名") @ExcelProperty("应用名")
@ -80,7 +79,7 @@ public class InfApiErrorLogExcelVO {
private Date createTime; private Date createTime;
@ExcelProperty(value = "处理状态", converter = DictConvert.class) @ExcelProperty(value = "处理状态", converter = DictConvert.class)
@DictFormat(INF_API_ERROR_LOG_PROCESS_STATUS) @DictFormat(InfDictTypeConstants.API_ERROR_LOG_PROCESS_STATUS)
private Integer processStatus; private Integer processStatus;
@ExcelProperty("处理时间") @ExcelProperty("处理时间")

View File

@ -0,0 +1,19 @@
package cn.iocoder.dashboard.modules.infra.enums;
/**
* Infra 字典类型的枚举类
*
* @author 芋道源码
*/
public interface InfDictTypeConstants {
String REDIS_TIMEOUT_TYPE = "inf_redis_timeout_type"; // Redis 超时类型
String JOB_STATUS = "inf_job_status"; // 定时任务状态的枚举
String JOB_LOG_STATUS = "inf_job_log_status"; // 定时任务日志状态的枚举
String API_ERROR_LOG_PROCESS_STATUS = "inf_api_error_log_process_status"; // API 错误日志的处理状态的枚举
String ERROR_CODE_TYPE = "inf_error_code_type"; // 错误码的类型枚举
}

View File

@ -2,11 +2,10 @@ package cn.iocoder.dashboard.modules.system.controller.dept.vo.post;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS;
/** /**
* 岗位 Excel 导出响应 VO * 岗位 Excel 导出响应 VO
*/ */
@ -26,7 +25,7 @@ public class SysPostExcelVO {
private Integer sort; private Integer sort;
@ExcelProperty(value = "状态", converter = DictConvert.class) @ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private String status; private String status;
} }

View File

@ -2,11 +2,10 @@ package cn.iocoder.dashboard.modules.system.controller.dict.vo.data;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS;
/** /**
* 字典数据 Excel 导出响应 VO * 字典数据 Excel 导出响应 VO
*/ */
@ -29,7 +28,7 @@ public class SysDictDataExcelVO {
private String dictType; private String dictType;
@ExcelProperty(value = "状态", converter = DictConvert.class) @ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
} }

View File

@ -2,11 +2,10 @@ package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS;
/** /**
* 字典类型 Excel 导出响应 VO * 字典类型 Excel 导出响应 VO
*/ */
@ -23,7 +22,7 @@ public class SysDictTypeExcelVO {
private String type; private String type;
@ExcelProperty(value = "状态", converter = DictConvert.class) @ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
} }

View File

@ -2,13 +2,12 @@ package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.infra.enums.InfDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_ERROR_CODE_TYPE;
/** /**
* 错误码 Excel VO * 错误码 Excel VO
* *
@ -21,7 +20,7 @@ public class SysErrorCodeExcelVO {
private Long id; private Long id;
@ExcelProperty(value = "错误码类型", converter = DictConvert.class) @ExcelProperty(value = "错误码类型", converter = DictConvert.class)
@DictFormat(SYS_ERROR_CODE_TYPE) @DictFormat(InfDictTypeConstants.ERROR_CODE_TYPE)
private Integer type; private Integer type;
@ExcelProperty("应用名") @ExcelProperty("应用名")

View File

@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -21,7 +21,7 @@ public class SysLoginLogExcelVO {
private String username; private String username;
@ExcelProperty(value = "登陆结果", converter = DictConvert.class) @ExcelProperty(value = "登陆结果", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.SYS_LOGIN_RESULT) @DictFormat(SysDictTypeConstants.LOGIN_RESULT)
private Integer result; private Integer result;
@ExcelProperty("登陆 IP") @ExcelProperty("登陆 IP")

View File

@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -24,7 +24,7 @@ public class SysOperateLogExcelVO {
private String name; private String name;
@ExcelProperty(value = "操作类型", converter = DictConvert.class) @ExcelProperty(value = "操作类型", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.SYS_OPERATE_TYPE) @DictFormat(SysDictTypeConstants.OPERATE_TYPE)
private String type; private String type;
@ExcelProperty("操作人") @ExcelProperty("操作人")

View File

@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.permission.vo.role;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -28,7 +28,7 @@ public class SysRoleExcelVO {
private Integer dataScope; private Integer dataScope;
@ExcelProperty(value = "角色状态", converter = DictConvert.class) @ExcelProperty(value = "角色状态", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private String status; private String status;
} }

View File

@ -3,14 +3,13 @@ package cn.iocoder.dashboard.modules.system.controller.sms.vo.log;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.framework.excel.core.convert.JsonConvert; import cn.iocoder.dashboard.framework.excel.core.convert.JsonConvert;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*;
/** /**
* 短信日志 Excel VO * 短信日志 Excel VO
* *
@ -35,7 +34,7 @@ public class SysSmsLogExcelVO {
private String templateCode; private String templateCode;
@ExcelProperty(value = "短信类型", converter = DictConvert.class) @ExcelProperty(value = "短信类型", converter = DictConvert.class)
@DictFormat(SYS_SMS_TEMPLATE_TYPE) @DictFormat(SysDictTypeConstants.SMS_TEMPLATE_TYPE)
private Integer templateType; private Integer templateType;
@ExcelProperty("短信内容") @ExcelProperty("短信内容")
@ -54,11 +53,11 @@ public class SysSmsLogExcelVO {
private Long userId; private Long userId;
@ExcelProperty(value = "用户类型", converter = DictConvert.class) @ExcelProperty(value = "用户类型", converter = DictConvert.class)
@DictFormat(USER_TYPE) @DictFormat(SysDictTypeConstants.USER_TYPE)
private Integer userType; private Integer userType;
@ExcelProperty(value = "发送状态", converter = DictConvert.class) @ExcelProperty(value = "发送状态", converter = DictConvert.class)
@DictFormat(SYS_SMS_SEND_STATUS) @DictFormat(SysDictTypeConstants.SMS_SEND_STATUS)
private Integer sendStatus; private Integer sendStatus;
@ExcelProperty("发送时间") @ExcelProperty("发送时间")
@ -83,7 +82,7 @@ public class SysSmsLogExcelVO {
private String apiSerialNo; private String apiSerialNo;
@ExcelProperty(value = "接收状态", converter = DictConvert.class) @ExcelProperty(value = "接收状态", converter = DictConvert.class)
@DictFormat(SYS_SMS_RECEIVE_STATUS) @DictFormat(SysDictTypeConstants.SMS_RECEIVE_STATUS)
private Integer receiveStatus; private Integer receiveStatus;
@ExcelProperty("接收时间") @ExcelProperty("接收时间")

View File

@ -2,13 +2,12 @@ package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*;
/** /**
* 短信模板 Excel VO * 短信模板 Excel VO
* *
@ -21,11 +20,11 @@ public class SysSmsTemplateExcelVO {
private Long id; private Long id;
@ExcelProperty(value = "短信签名", converter = DictConvert.class) @ExcelProperty(value = "短信签名", converter = DictConvert.class)
@DictFormat(SYS_SMS_TEMPLATE_TYPE) @DictFormat(SysDictTypeConstants.SMS_TEMPLATE_TYPE)
private Integer type; private Integer type;
@ExcelProperty(value = "开启状态", converter = DictConvert.class) @ExcelProperty(value = "开启状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
@ExcelProperty("模板编码") @ExcelProperty("模板编码")
@ -47,7 +46,7 @@ public class SysSmsTemplateExcelVO {
private Long channelId; private Long channelId;
@ExcelProperty(value = "短信渠道编码", converter = DictConvert.class) @ExcelProperty(value = "短信渠道编码", converter = DictConvert.class)
@DictFormat(SYS_SMS_CHANNEL_CODE) @DictFormat(SysDictTypeConstants.SMS_CHANNEL_CODE)
private String channelCode; private String channelCode;
@ExcelProperty("创建时间") @ExcelProperty("创建时间")

View File

@ -2,14 +2,12 @@ package cn.iocoder.dashboard.modules.system.controller.user.vo.user;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_COMMON_STATUS;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_USER_SEX;
/** /**
* 用户 Excel 导出 VO * 用户 Excel 导出 VO
*/ */
@ -32,11 +30,11 @@ public class SysUserExcelVO {
private String mobile; private String mobile;
@ExcelProperty(value = "用户性别", converter = DictConvert.class) @ExcelProperty(value = "用户性别", converter = DictConvert.class)
@DictFormat(SYS_USER_SEX) @DictFormat(SysDictTypeConstants.USER_SEX)
private Integer sex; private Integer sex;
@ExcelProperty(value = "帐号状态", converter = DictConvert.class) @ExcelProperty(value = "帐号状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
@ExcelProperty("最后登录IP") @ExcelProperty("最后登录IP")

View File

@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.user.vo.user;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum; import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
@ -34,11 +34,11 @@ public class SysUserImportExcelVO {
private String mobile; private String mobile;
@ExcelProperty(value = "用户性别", converter = DictConvert.class) @ExcelProperty(value = "用户性别", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.SYS_USER_SEX) @DictFormat(SysDictTypeConstants.USER_SEX)
private Integer sex; private Integer sex;
@ExcelProperty(value = "账号状态", converter = DictConvert.class) @ExcelProperty(value = "账号状态", converter = DictConvert.class)
@DictFormat(SysDictTypeEnum.SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
} }

View File

@ -0,0 +1,25 @@
package cn.iocoder.dashboard.modules.system.enums;
/**
* System 字典类型的枚举类
*
* @author 芋道源码
*/
public interface SysDictTypeConstants {
String USER_TYPE = "user_type"; // 用户类型
String COMMON_STATUS = "sys_common_status"; // 系统状态
String USER_SEX = "sys_user_sex"; // 用户性别
String OPERATE_TYPE = "sys_operate_type"; // 操作类型
String LOGIN_RESULT = "sys_login_result"; // 登陆结果
String CONFIG_TYPE = "sys_config_type"; // 参数配置类型
String BOOLEAN_STRING = "sys_boolean_string"; // Boolean 是否类型
String SMS_CHANNEL_CODE = "sys_sms_channel_code"; // 短信渠道编码
String SMS_TEMPLATE_TYPE = "sys_sms_template_type"; // 短信模板类型
String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态
String SMS_RECEIVE_STATUS = "sys_sms_receive_status"; // 短信接收状态
}

View File

@ -2,13 +2,13 @@ package cn.iocoder.dashboard.modules.tool.controller.test.vo;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import cn.iocoder.dashboard.modules.infra.enums.InfDictTypeConstants;
import cn.iocoder.dashboard.modules.system.enums.SysDictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*;
/** /**
* 测试示例 Excel VO * 测试示例 Excel VO
* *
@ -24,15 +24,15 @@ public class ToolTestDemoExcelVO {
private String name; private String name;
@ExcelProperty(value = "状态", converter = DictConvert.class) @ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS) @DictFormat(SysDictTypeConstants.COMMON_STATUS)
private Integer status; private Integer status;
@ExcelProperty(value = "类型", converter = DictConvert.class) @ExcelProperty(value = "类型", converter = DictConvert.class)
@DictFormat(SYS_OPERATE_TYPE) @DictFormat(SysDictTypeConstants.OPERATE_TYPE)
private Integer type; private Integer type;
@ExcelProperty(value = "分类", converter = DictConvert.class) @ExcelProperty(value = "分类", converter = DictConvert.class)
@DictFormat(INF_REDIS_TIMEOUT_TYPE) @DictFormat(InfDictTypeConstants.REDIS_TIMEOUT_TYPE)
private Integer category; private Integer category;
@ExcelProperty("备注") @ExcelProperty("备注")

View File

@ -18,7 +18,6 @@ import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEn
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum;
import cn.iocoder.dashboard.modules.tool.dal.dataobject.codegen.ToolCodegenColumnDO; import cn.iocoder.dashboard.modules.tool.dal.dataobject.codegen.ToolCodegenColumnDO;
import cn.iocoder.dashboard.modules.tool.dal.dataobject.codegen.ToolCodegenTableDO; import cn.iocoder.dashboard.modules.tool.dal.dataobject.codegen.ToolCodegenTableDO;
import cn.iocoder.dashboard.util.collection.CollectionUtils; import cn.iocoder.dashboard.util.collection.CollectionUtils;
@ -126,7 +125,8 @@ public class ToolCodegenEngine {
// VO 独有字段 // VO 独有字段
globalBindingMap.put("PageParamClassName", PageParam.class.getName()); globalBindingMap.put("PageParamClassName", PageParam.class.getName());
globalBindingMap.put("DictFormatClassName", DictFormat.class.getName()); globalBindingMap.put("DictFormatClassName", DictFormat.class.getName());
globalBindingMap.put("SysDictTypeEnumClassName", SysDictTypeEnum.class.getName()); // TODO 芋艿代码生成器解决下枚举类
// globalBindingMap.put("SysDictTypeEnumClassName", SysDictTypeEnum.class.getName());
// DO 独有字段 // DO 独有字段
globalBindingMap.put("baseDOFields", ToolCodegenBuilder.BASE_DO_FIELDS); globalBindingMap.put("baseDOFields", ToolCodegenBuilder.BASE_DO_FIELDS);
globalBindingMap.put("BaseDOClassName", BaseDO.class.getName()); globalBindingMap.put("BaseDOClassName", BaseDO.class.getName());

View File

@ -1,7 +1,7 @@
package cn.iocoder.dashboard.modules.system.service.sms; package cn.iocoder.dashboard.modules.system.service.sms;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.iocoder.dashboard.framework.test.core.BaseMockitoUnitTest; import cn.iocoder.dashboard.BaseMockitoUnitTest;
import cn.iocoder.dashboard.common.core.KeyValue; import cn.iocoder.dashboard.common.core.KeyValue;
import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.common.enums.CommonStatusEnum;
import cn.iocoder.dashboard.common.enums.UserTypeEnum; import cn.iocoder.dashboard.common.enums.UserTypeEnum;

View File

@ -15,14 +15,6 @@
<properties> <properties>
<revision>1.0.0</revision> <revision>1.0.0</revision>
<!-- Maven 相关 -->
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<resource.delimiter>@</resource.delimiter>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<!-- 统一依赖管理 --> <!-- 统一依赖管理 -->
<spring.boot.version>2.4.4</spring.boot.version> <spring.boot.version>2.4.4</spring.boot.version>
<!-- Web 相关 --> <!-- Web 相关 -->

View File

@ -16,16 +16,6 @@
<description>基础框架,各种组件的拓展</description> <description>基础框架,各种组件的拓展</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url> <url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<resource.delimiter>@</resource.delimiter>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
</properties>
<dependencies> <dependencies>
<!-- Spring 核心 --> <!-- Spring 核心 -->
<dependency> <dependency>

View File

@ -1,7 +1,5 @@
package cn.iocoder.dashboard.framework.excel.core.annotations; package cn.iocoder.dashboard.framework.excel.core.annotations;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
@ -14,6 +12,11 @@ import java.lang.annotation.*;
@Inherited @Inherited
public @interface DictFormat { public @interface DictFormat {
SysDictTypeEnum value(); /**
* 例如说SysDictTypeConstantsInfDictTypeConstants
*
* @return 字典类型
*/
String value();
} }

View File

@ -5,7 +5,6 @@ import cn.hutool.core.convert.Convert;
import cn.iocoder.dashboard.framework.dict.core.dto.DictDataRespDTO; import cn.iocoder.dashboard.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.dashboard.framework.dict.core.util.DictUtils; import cn.iocoder.dashboard.framework.dict.core.util.DictUtils;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum;
import com.alibaba.excel.converters.Converter; import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum; import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData; import com.alibaba.excel.metadata.CellData;
@ -35,9 +34,9 @@ public class DictConvert implements Converter<Object> {
public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) { GlobalConfiguration globalConfiguration) {
// 使用字典解析 // 使用字典解析
SysDictTypeEnum type = getType(contentProperty); String type = getType(contentProperty);
String label = cellData.getStringValue(); String label = cellData.getStringValue();
DictDataRespDTO dictData = DictUtils.parseDictDataFromCache(type.getValue(), label); DictDataRespDTO dictData = DictUtils.parseDictDataFromCache(type, label);
if (dictData == null) { if (dictData == null) {
log.error("[convertToJavaData][type({}) 解析不掉 label({})]", type, label); log.error("[convertToJavaData][type({}) 解析不掉 label({})]", type, label);
return null; return null;
@ -56,9 +55,9 @@ public class DictConvert implements Converter<Object> {
} }
// 使用字典格式化 // 使用字典格式化
SysDictTypeEnum type = getType(contentProperty); String type = getType(contentProperty);
String value = String.valueOf(object); String value = String.valueOf(object);
DictDataRespDTO dictData = DictUtils.getDictDataFromCache(type.getValue(), value); DictDataRespDTO dictData = DictUtils.getDictDataFromCache(type, value);
if (dictData == null) { if (dictData == null) {
log.error("[convertToExcelData][type({}) 转换不了 label({})]", type, value); log.error("[convertToExcelData][type({}) 转换不了 label({})]", type, value);
return new CellData<>(""); return new CellData<>("");
@ -67,7 +66,7 @@ public class DictConvert implements Converter<Object> {
return new CellData<>(dictData.getLabel()); return new CellData<>(dictData.getLabel());
} }
private static SysDictTypeEnum getType(ExcelContentProperty contentProperty) { private static String getType(ExcelContentProperty contentProperty) {
return contentProperty.getField().getAnnotation(DictFormat.class).value(); return contentProperty.getField().getAnnotation(DictFormat.class).value();
} }

View File

@ -1,39 +0,0 @@
package cn.iocoder.dashboard.modules.system.enums.dict;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 字典类型的类型枚举
*/
@Getter
@AllArgsConstructor
public enum SysDictTypeEnum {
USER_TYPE("user_type"), // 用户类型
SYS_USER_SEX("sys_user_sex"), // 用户性别
SYS_COMMON_STATUS("sys_common_status"), // 系统状态
SYS_OPERATE_TYPE("sys_operate_type"), // 操作类型
SYS_LOGIN_RESULT("sys_login_result"), // 登陆结果
SYS_CONFIG_TYPE("sys_config_type"), // 参数配置类型
SYS_BOOLEAN_STRING("sys_boolean_string"), // Boolean 是否类型
SYS_SMS_CHANNEL_CODE("sys_sms_channel_code"), // 短信渠道编码
SYS_SMS_TEMPLATE_TYPE("sys_sms_template_type"), // 短信模板类型
SYS_SMS_SEND_STATUS("sys_sms_send_status"), // 短信发送状态
SYS_SMS_RECEIVE_STATUS("sys_sms_receive_status"), // 短信接收状态
SYS_ERROR_CODE_TYPE("inf_error_code_type"), // 错误码的类型枚举
INF_REDIS_TIMEOUT_TYPE("inf_redis_timeout_type"), // Redis 超时类型
INF_JOB_STATUS("inf_job_status"), // 定时任务状态的枚举
INF_JOB_LOG_STATUS("inf_job_log_status"), // 定时任务日志状态的枚举
INF_API_ERROR_LOG_PROCESS_STATUS("inf_api_error_log_process_status"), // API 错误日志的处理状态的枚举
;
/**
*
*/
private final String value;
}