diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/captcha/UnsignedMathGenerator.java b/ruoyi-common/src/main/java/com/ruoyi/common/captcha/UnsignedMathGenerator.java index 9c0f26f5b..ec2d68258 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/captcha/UnsignedMathGenerator.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/captcha/UnsignedMathGenerator.java @@ -13,73 +13,73 @@ import com.ruoyi.common.utils.StringUtils; */ public class UnsignedMathGenerator implements CodeGenerator { - private static final long serialVersionUID = -5514819971774091076L; + private static final long serialVersionUID = -5514819971774091076L; - private static final String operators = "+-*"; + private static final String operators = "+-*"; - /** - * 参与计算数字最大长度 - */ - private final int numberLength; + /** + * 参与计算数字最大长度 + */ + private final int numberLength; - /** - * 构造 - */ - public UnsignedMathGenerator() { - this(2); - } + /** + * 构造 + */ + public UnsignedMathGenerator() { + this(2); + } - /** - * 构造 - * - * @param numberLength 参与计算最大数字位数 - */ - public UnsignedMathGenerator(int numberLength) { - this.numberLength = numberLength; - } + /** + * 构造 + * + * @param numberLength 参与计算最大数字位数 + */ + public UnsignedMathGenerator(int numberLength) { + this.numberLength = numberLength; + } - @Override - public String generate() { - final int limit = getLimit(); - int min = RandomUtil.randomInt(limit); - int max = RandomUtil.randomInt(min, limit); - String number1 = Integer.toString(max); - String number2 = Integer.toString(min); - number1 = StringUtils.rightPad(number1, this.numberLength, CharUtil.SPACE); - number2 = StringUtils.rightPad(number2, this.numberLength, CharUtil.SPACE); + @Override + public String generate() { + final int limit = getLimit(); + int min = RandomUtil.randomInt(limit); + int max = RandomUtil.randomInt(min, limit); + String number1 = Integer.toString(max); + String number2 = Integer.toString(min); + number1 = StringUtils.rightPad(number1, this.numberLength, CharUtil.SPACE); + number2 = StringUtils.rightPad(number2, this.numberLength, CharUtil.SPACE); - return number1 + RandomUtil.randomChar(operators) + number2 + '='; - } + return number1 + RandomUtil.randomChar(operators) + number2 + '='; + } - @Override - public boolean verify(String code, String userInputCode) { - int result; - try { - result = Integer.parseInt(userInputCode); - } catch (NumberFormatException e) { - // 用户输入非数字 - return false; - } + @Override + public boolean verify(String code, String userInputCode) { + int result; + try { + result = Integer.parseInt(userInputCode); + } catch (NumberFormatException e) { + // 用户输入非数字 + return false; + } - final int calculateResult = (int) Calculator.conversion(code); - return result == calculateResult; - } + final int calculateResult = (int) Calculator.conversion(code); + return result == calculateResult; + } - /** - * 获取验证码长度 - * - * @return 验证码长度 - */ - public int getLength() { - return this.numberLength * 2 + 2; - } + /** + * 获取验证码长度 + * + * @return 验证码长度 + */ + public int getLength() { + return this.numberLength * 2 + 2; + } - /** - * 根据长度获取参与计算数字最大值 - * - * @return 最大值 - */ - private int getLimit() { - return Integer.parseInt("1" + StringUtils.repeat('0', this.numberLength)); - } + /** + * 根据长度获取参与计算数字最大值 + * + * @return 最大值 + */ + private int getLimit() { + return Integer.parseInt("1" + StringUtils.repeat('0', this.numberLength)); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelBigNumberConvert.java b/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelBigNumberConvert.java index df1f95a0f..690b47917 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelBigNumberConvert.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelBigNumberConvert.java @@ -20,32 +20,32 @@ import java.math.BigDecimal; @Slf4j public class ExcelBigNumberConvert implements Converter { - @Override - public Class supportJavaTypeKey() { - return Long.class; - } + @Override + public Class supportJavaTypeKey() { + return Long.class; + } - @Override - public CellDataTypeEnum supportExcelTypeKey() { - return CellDataTypeEnum.STRING; - } + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } - @Override - public Long convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { - return Convert.toLong(cellData.getData()); - } + @Override + public Long convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { + return Convert.toLong(cellData.getData()); + } - @Override - public CellData convertToExcelData(Long object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { - if (ObjectUtil.isNotNull(object)) { - String str = Convert.toStr(object); - if (str.length() > 15) { - return new CellData<>(str); - } - } - CellData cellData = new CellData<>(new BigDecimal(object)); - cellData.setType(CellDataTypeEnum.NUMBER); - return cellData; - } + @Override + public CellData convertToExcelData(Long object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { + if (ObjectUtil.isNotNull(object)) { + String str = Convert.toStr(object); + if (str.length() > 15) { + return new CellData<>(str); + } + } + CellData cellData = new CellData<>(new BigDecimal(object)); + cellData.setType(CellDataTypeEnum.NUMBER); + return cellData; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelDictConvert.java b/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelDictConvert.java index 7c4d63124..cf612c986 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelDictConvert.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelDictConvert.java @@ -24,48 +24,48 @@ import java.lang.reflect.Field; @Slf4j public class ExcelDictConvert implements Converter { - @Override - public Class supportJavaTypeKey() { - return Object.class; - } + @Override + public Class supportJavaTypeKey() { + return Object.class; + } - @Override - public CellDataTypeEnum supportExcelTypeKey() { - return null; - } + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return null; + } - @Override - public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { - ExcelDictFormat anno = getAnnotation(contentProperty.getField()); - String type = anno.dictType(); - String label = cellData.getStringValue(); - String value; - if (StringUtils.isBlank(type)) { - value = ExcelUtil.reverseByExp(label, anno.readConverterExp(), anno.separator()); - } else { - value = SpringUtils.getBean(DictService.class).getDictValue(type, label, anno.separator()); - } - return Convert.convert(contentProperty.getField().getType(), value); - } + @Override + public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { + ExcelDictFormat anno = getAnnotation(contentProperty.getField()); + String type = anno.dictType(); + String label = cellData.getStringValue(); + String value; + if (StringUtils.isBlank(type)) { + value = ExcelUtil.reverseByExp(label, anno.readConverterExp(), anno.separator()); + } else { + value = SpringUtils.getBean(DictService.class).getDictValue(type, label, anno.separator()); + } + return Convert.convert(contentProperty.getField().getType(), value); + } - @Override - public CellData convertToExcelData(Object object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { - if (StringUtils.isNull(object)) { - return new CellData<>(""); - } - ExcelDictFormat anno = getAnnotation(contentProperty.getField()); - String type = anno.dictType(); - String value = Convert.toStr(object); - String label; - if (StringUtils.isBlank(type)) { - label = ExcelUtil.convertByExp(value, anno.readConverterExp(), anno.separator()); - } else { - label = SpringUtils.getBean(DictService.class).getDictLabel(type, value, anno.separator()); - } - return new CellData<>(label); - } + @Override + public CellData convertToExcelData(Object object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { + if (StringUtils.isNull(object)) { + return new CellData<>(""); + } + ExcelDictFormat anno = getAnnotation(contentProperty.getField()); + String type = anno.dictType(); + String value = Convert.toStr(object); + String label; + if (StringUtils.isBlank(type)) { + label = ExcelUtil.convertByExp(value, anno.readConverterExp(), anno.separator()); + } else { + label = SpringUtils.getBean(DictService.class).getDictLabel(type, value, anno.separator()); + } + return new CellData<>(label); + } - private ExcelDictFormat getAnnotation(Field field) { - return AnnotationUtil.getAnnotation(field, ExcelDictFormat.class); - } + private ExcelDictFormat getAnnotation(Field field) { + return AnnotationUtil.getAnnotation(field, ExcelDictFormat.class); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java index 7c388c5ef..158da5fa7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java @@ -20,115 +20,115 @@ import lombok.experimental.Accessors; @ApiModel("请求响应对象") public class AjaxResult { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 状态码 - */ - @ApiModelProperty("消息状态码") - private int code; + /** + * 状态码 + */ + @ApiModelProperty("消息状态码") + private int code; - /** - * 返回内容 - */ - @ApiModelProperty("消息内容") - private String msg; + /** + * 返回内容 + */ + @ApiModelProperty("消息内容") + private String msg; - /** - * 数据对象 - */ - @ApiModelProperty("数据对象") - private T data; + /** + * 数据对象 + */ + @ApiModelProperty("数据对象") + private T data; - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - */ - public AjaxResult(int code, String msg) { - this.code = code; - this.msg = msg; - } + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public AjaxResult(int code, String msg) { + this.code = code; + this.msg = msg; + } - /** - * 返回成功消息 - * - * @return 成功消息 - */ - public static AjaxResult success() { - return AjaxResult.success("操作成功"); - } + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult success() { + return AjaxResult.success("操作成功"); + } - /** - * 返回成功数据 - * - * @return 成功消息 - */ - public static AjaxResult success(T data) { - return AjaxResult.success("操作成功", data); - } + /** + * 返回成功数据 + * + * @return 成功消息 + */ + public static AjaxResult success(T data) { + return AjaxResult.success("操作成功", data); + } - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @return 成功消息 - */ - public static AjaxResult success(String msg) { - return AjaxResult.success(msg, null); - } + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static AjaxResult success(String msg) { + return AjaxResult.success(msg, null); + } - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 成功消息 - */ - public static AjaxResult success(String msg, T data) { - return new AjaxResult<>(HttpStatus.HTTP_OK, msg, data); - } + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult success(String msg, T data) { + return new AjaxResult<>(HttpStatus.HTTP_OK, msg, data); + } - /** - * 返回错误消息 - * - * @return - */ - public static AjaxResult error() { - return AjaxResult.error("操作失败"); - } + /** + * 返回错误消息 + * + * @return + */ + public static AjaxResult error() { + return AjaxResult.error("操作失败"); + } - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(String msg) { - return AjaxResult.error(msg, null); - } + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(String msg) { + return AjaxResult.error(msg, null); + } - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 警告消息 - */ - public static AjaxResult error(String msg, T data) { - return new AjaxResult<>(HttpStatus.HTTP_INTERNAL_ERROR, msg, data); - } + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static AjaxResult error(String msg, T data) { + return new AjaxResult<>(HttpStatus.HTTP_INTERNAL_ERROR, msg, data); + } - /** - * 返回错误消息 - * - * @param code 状态码 - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(int code, String msg) { - return new AjaxResult<>(code, msg, null); - } + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(int code, String msg) { + return new AjaxResult<>(code, msg, null); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index b21807033..9c7857a56 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -21,48 +21,48 @@ import java.util.Map; @Accessors(chain = true) public class BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 搜索值 - */ - @ApiModelProperty(value = "搜索值") - @TableField(exist = false) - private String searchValue; + /** + * 搜索值 + */ + @ApiModelProperty(value = "搜索值") + @TableField(exist = false) + private String searchValue; - /** - * 创建者 - */ - @ApiModelProperty(value = "创建者") - @TableField(fill = FieldFill.INSERT) - private String createBy; + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者") + @TableField(fill = FieldFill.INSERT) + private String createBy; - /** - * 创建时间 - */ - @ApiModelProperty(value = "创建时间") - @TableField(fill = FieldFill.INSERT) - private Date createTime; + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + @TableField(fill = FieldFill.INSERT) + private Date createTime; - /** - * 更新者 - */ - @ApiModelProperty(value = "更新者") - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; - /** - * 更新时间 - */ - @ApiModelProperty(value = "更新时间") - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; - /** - * 请求参数 - */ - @ApiModelProperty(value = "请求参数") - @TableField(exist = false) - private Map params = new HashMap<>(); + /** + * 请求参数 + */ + @ApiModelProperty(value = "请求参数") + @TableField(exist = false) + private Map params = new HashMap<>(); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/PageQuery.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/PageQuery.java index d82779ad1..5ffd58892 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/PageQuery.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/PageQuery.java @@ -21,7 +21,7 @@ import java.io.Serializable; @Accessors(chain = true) public class PageQuery implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; /** * 分页大小 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java index c0e62c710..819e6b72a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java @@ -20,26 +20,26 @@ import java.util.List; @Accessors(chain = true) public class TreeEntity extends BaseEntity { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 父菜单名称 - */ - @TableField(exist = false) - @ApiModelProperty(value = "父菜单名称") - private String parentName; + /** + * 父菜单名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "父菜单名称") + private String parentName; - /** - * 父菜单ID - */ - @ApiModelProperty(value = "父菜单ID") - private Long parentId; + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long parentId; - /** - * 子部门 - */ - @TableField(exist = false) - @ApiModelProperty(value = "子部门") - private List children = new ArrayList<>(); + /** + * 子部门 + */ + @TableField(exist = false) + @ApiModelProperty(value = "子部门") + private List children = new ArrayList<>(); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index 17ff6606e..860f2f2c0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -26,68 +26,68 @@ import javax.validation.constraints.Size; @TableName("sys_dept") @ApiModel("部门业务对象") public class SysDept extends TreeEntity { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 部门ID - */ - @ApiModelProperty(value = "部门id") - @TableId(value = "dept_id") - private Long deptId; + /** + * 部门ID + */ + @ApiModelProperty(value = "部门id") + @TableId(value = "dept_id") + private Long deptId; - /** - * 部门名称 - */ - @ApiModelProperty(value = "部门名称") - @NotBlank(message = "部门名称不能为空") - @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") - private String deptName; + /** + * 部门名称 + */ + @ApiModelProperty(value = "部门名称") + @NotBlank(message = "部门名称不能为空") + @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") + private String deptName; - /** - * 显示顺序 - */ - @ApiModelProperty(value = "显示顺序") - @NotBlank(message = "显示顺序不能为空") - private String orderNum; + /** + * 显示顺序 + */ + @ApiModelProperty(value = "显示顺序") + @NotBlank(message = "显示顺序不能为空") + private String orderNum; - /** - * 负责人 - */ - @ApiModelProperty(value = "负责人") - private String leader; + /** + * 负责人 + */ + @ApiModelProperty(value = "负责人") + private String leader; - /** - * 联系电话 - */ - @ApiModelProperty(value = "联系电话") - @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") - private String phone; + /** + * 联系电话 + */ + @ApiModelProperty(value = "联系电话") + @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") + private String phone; - /** - * 邮箱 - */ - @ApiModelProperty(value = "邮箱") - @Email(message = "邮箱格式不正确") - @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") - private String email; + /** + * 邮箱 + */ + @ApiModelProperty(value = "邮箱") + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + private String email; - /** - * 部门状态:0正常,1停用 - */ - @ApiModelProperty(value = "部门状态:0正常,1停用") - private String status; + /** + * 部门状态:0正常,1停用 + */ + @ApiModelProperty(value = "部门状态:0正常,1停用") + private String status; - /** - * 删除标志(0代表存在 2代表删除) - */ - @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") - @TableLogic - private String delFlag; + /** + * 删除标志(0代表存在 2代表删除) + */ + @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") + @TableLogic + private String delFlag; - /** - * 祖级列表 - */ - @ApiModelProperty(value = "祖级列表") - private String ancestors; + /** + * 祖级列表 + */ + @ApiModelProperty(value = "祖级列表") + private String ancestors; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java index 3c572bd27..241aecd87 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java @@ -31,85 +31,85 @@ import javax.validation.constraints.Size; @ApiModel("字典数据业务对象") public class SysDictData extends BaseEntity { - /** - * 字典编码 - */ - @ApiModelProperty(value = "字典编码") - @ExcelProperty(value = "字典编码") - @TableId(value = "dict_code") - private Long dictCode; + /** + * 字典编码 + */ + @ApiModelProperty(value = "字典编码") + @ExcelProperty(value = "字典编码") + @TableId(value = "dict_code") + private Long dictCode; - /** - * 字典排序 - */ - @ApiModelProperty(value = "字典排序") - @ExcelProperty(value = "字典排序") - private Long dictSort; + /** + * 字典排序 + */ + @ApiModelProperty(value = "字典排序") + @ExcelProperty(value = "字典排序") + private Long dictSort; - /** - * 字典标签 - */ - @ApiModelProperty(value = "字典标签") - @ExcelProperty(value = "字典标签") - @NotBlank(message = "字典标签不能为空") - @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") - private String dictLabel; + /** + * 字典标签 + */ + @ApiModelProperty(value = "字典标签") + @ExcelProperty(value = "字典标签") + @NotBlank(message = "字典标签不能为空") + @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") + private String dictLabel; - /** - * 字典键值 - */ - @ApiModelProperty(value = "字典键值") - @ExcelProperty(value = "字典键值") - @NotBlank(message = "字典键值不能为空") - @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") - private String dictValue; + /** + * 字典键值 + */ + @ApiModelProperty(value = "字典键值") + @ExcelProperty(value = "字典键值") + @NotBlank(message = "字典键值不能为空") + @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") + private String dictValue; - /** - * 字典类型 - */ - @ApiModelProperty(value = "字典类型") - @ExcelProperty(value = "字典类型") - @NotBlank(message = "字典类型不能为空") - @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") - private String dictType; + /** + * 字典类型 + */ + @ApiModelProperty(value = "字典类型") + @ExcelProperty(value = "字典类型") + @NotBlank(message = "字典类型不能为空") + @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") + private String dictType; - /** - * 样式属性(其他样式扩展) - */ - @ApiModelProperty(value = "样式属性(其他样式扩展)") - @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") - private String cssClass; + /** + * 样式属性(其他样式扩展) + */ + @ApiModelProperty(value = "样式属性(其他样式扩展)") + @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") + private String cssClass; - /** - * 表格字典样式 - */ - @ApiModelProperty(value = "表格字典样式") - private String listClass; + /** + * 表格字典样式 + */ + @ApiModelProperty(value = "表格字典样式") + private String listClass; - /** - * 是否默认(Y是 N否) - */ - @ApiModelProperty(value = "是否默认(Y是 N否)") - @ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_yes_no") - private String isDefault; + /** + * 是否默认(Y是 N否) + */ + @ApiModelProperty(value = "是否默认(Y是 N否)") + @ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_yes_no") + private String isDefault; - /** - * 状态(0正常 1停用) - */ - @ApiModelProperty(value = "状态(0正常 1停用)") - @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_normal_disable") - private String status; + /** + * 状态(0正常 1停用) + */ + @ApiModelProperty(value = "状态(0正常 1停用)") + @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_normal_disable") + private String status; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; - public boolean getDefault() { - return UserConstants.YES.equals(this.isDefault); - } + public boolean getDefault() { + return UserConstants.YES.equals(this.isDefault); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java index c6c9b1a29..702ec09d3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java @@ -30,44 +30,44 @@ import javax.validation.constraints.Size; @ApiModel("字典类型业务对象") public class SysDictType extends BaseEntity { - /** - * 字典主键 - */ - @ApiModelProperty(value = "字典主键") - @ExcelProperty(value = "字典主键") - @TableId(value = "dict_id") - private Long dictId; + /** + * 字典主键 + */ + @ApiModelProperty(value = "字典主键") + @ExcelProperty(value = "字典主键") + @TableId(value = "dict_id") + private Long dictId; - /** - * 字典名称 - */ - @ApiModelProperty(value = "字典名称") - @ExcelProperty(value = "字典名称") - @NotBlank(message = "字典名称不能为空") - @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") - private String dictName; + /** + * 字典名称 + */ + @ApiModelProperty(value = "字典名称") + @ExcelProperty(value = "字典名称") + @NotBlank(message = "字典名称不能为空") + @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") + private String dictName; - /** - * 字典类型 - */ - @ApiModelProperty(value = "字典类型") - @ExcelProperty(value = "字典类型") - @NotBlank(message = "字典类型不能为空") - @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") - private String dictType; + /** + * 字典类型 + */ + @ApiModelProperty(value = "字典类型") + @ExcelProperty(value = "字典类型") + @NotBlank(message = "字典类型不能为空") + @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") + private String dictType; - /** - * 状态(0正常 1停用) - */ - @ApiModelProperty(value = "状态(0正常 1停用)") - @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_normal_disable") - private String status; + /** + * 状态(0正常 1停用) + */ + @ApiModelProperty(value = "状态(0正常 1停用)") + @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_normal_disable") + private String status; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index 8efc9f7a0..3febc94b7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -26,97 +26,97 @@ import javax.validation.constraints.Size; @ApiModel("菜单权限业务对象") public class SysMenu extends TreeEntity { - /** - * 菜单ID - */ - @ApiModelProperty(value = "菜单ID") - @TableId(value = "menu_id") - private Long menuId; + /** + * 菜单ID + */ + @ApiModelProperty(value = "菜单ID") + @TableId(value = "menu_id") + private Long menuId; - /** - * 菜单名称 - */ - @ApiModelProperty(value = "菜单名称") - @NotBlank(message = "菜单名称不能为空") - @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") - private String menuName; + /** + * 菜单名称 + */ + @ApiModelProperty(value = "菜单名称") + @NotBlank(message = "菜单名称不能为空") + @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") + private String menuName; - /** - * 显示顺序 - */ - @ApiModelProperty(value = "显示顺序") - @NotBlank(message = "显示顺序不能为空") - private String orderNum; + /** + * 显示顺序 + */ + @ApiModelProperty(value = "显示顺序") + @NotBlank(message = "显示顺序不能为空") + private String orderNum; - /** - * 路由地址 - */ - @ApiModelProperty(value = "路由地址") - @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") - private String path; + /** + * 路由地址 + */ + @ApiModelProperty(value = "路由地址") + @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") + private String path; - /** - * 组件路径 - */ - @ApiModelProperty(value = "组件路径") - @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") - private String component; + /** + * 组件路径 + */ + @ApiModelProperty(value = "组件路径") + @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") + private String component; /** * 路由参数 */ - @ApiModelProperty(value = "路由参数") + @ApiModelProperty(value = "路由参数") @TableField("`query`") private String query; - /** - * 是否为外链(0是 1否) - */ - @ApiModelProperty(value = "是否为外链(0是 1否)") - private String isFrame; + /** + * 是否为外链(0是 1否) + */ + @ApiModelProperty(value = "是否为外链(0是 1否)") + private String isFrame; - /** - * 是否缓存(0缓存 1不缓存) - */ - @ApiModelProperty(value = "是否缓存(0缓存 1不缓存)") - private String isCache; + /** + * 是否缓存(0缓存 1不缓存) + */ + @ApiModelProperty(value = "是否缓存(0缓存 1不缓存)") + private String isCache; - /** - * 类型(M目录 C菜单 F按钮) - */ - @ApiModelProperty(value = "类型(M目录 C菜单 F按钮)") - @NotBlank(message = "菜单类型不能为空") - private String menuType; + /** + * 类型(M目录 C菜单 F按钮) + */ + @ApiModelProperty(value = "类型(M目录 C菜单 F按钮)") + @NotBlank(message = "菜单类型不能为空") + private String menuType; - /** - * 显示状态(0显示 1隐藏) - */ - @ApiModelProperty(value = "显示状态(0显示 1隐藏)") - private String visible; + /** + * 显示状态(0显示 1隐藏) + */ + @ApiModelProperty(value = "显示状态(0显示 1隐藏)") + private String visible; - /** - * 菜单状态(0显示 1隐藏) - */ - @ApiModelProperty(value = "菜单状态(0显示 1隐藏)") - private String status; + /** + * 菜单状态(0显示 1隐藏) + */ + @ApiModelProperty(value = "菜单状态(0显示 1隐藏)") + private String status; - /** - * 权限字符串 - */ - @ApiModelProperty(value = "权限字符串") - @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") - private String perms; + /** + * 权限字符串 + */ + @ApiModelProperty(value = "权限字符串") + @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") + private String perms; - /** - * 菜单图标 - */ - @ApiModelProperty(value = "菜单图标") - private String icon; + /** + * 菜单图标 + */ + @ApiModelProperty(value = "菜单图标") + private String icon; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 1d186db52..3153e41b1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -32,113 +32,113 @@ import javax.validation.constraints.Size; @ExcelIgnoreUnannotated public class SysRole extends BaseEntity { - /** - * 角色ID - */ - @ApiModelProperty(value = "角色ID") - @ExcelProperty(value = "角色序号") - @TableId(value = "role_id") - private Long roleId; + /** + * 角色ID + */ + @ApiModelProperty(value = "角色ID") + @ExcelProperty(value = "角色序号") + @TableId(value = "role_id") + private Long roleId; - /** - * 角色名称 - */ - @ApiModelProperty(value = "角色名称") - @ExcelProperty(value = "角色名称") - @NotBlank(message = "角色名称不能为空") - @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") - private String roleName; + /** + * 角色名称 + */ + @ApiModelProperty(value = "角色名称") + @ExcelProperty(value = "角色名称") + @NotBlank(message = "角色名称不能为空") + @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") + private String roleName; - /** - * 角色权限 - */ - @ApiModelProperty(value = "角色权限") - @ExcelProperty(value = "角色权限") - @NotBlank(message = "权限字符不能为空") - @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") - private String roleKey; + /** + * 角色权限 + */ + @ApiModelProperty(value = "角色权限") + @ExcelProperty(value = "角色权限") + @NotBlank(message = "权限字符不能为空") + @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") + private String roleKey; - /** - * 角色排序 - */ - @ApiModelProperty(value = "角色排序") - @ExcelProperty(value = "角色排序") - @NotBlank(message = "显示顺序不能为空") - private String roleSort; + /** + * 角色排序 + */ + @ApiModelProperty(value = "角色排序") + @ExcelProperty(value = "角色排序") + @NotBlank(message = "显示顺序不能为空") + private String roleSort; - /** - * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) - */ - @ApiModelProperty(value = "数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)") - @ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class) - @ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") - private String dataScope; + /** + * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) + */ + @ApiModelProperty(value = "数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)") + @ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") + private String dataScope; - /** - * 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) - */ - @ApiModelProperty(value = "菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)") - private boolean menuCheckStrictly; + /** + * 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) + */ + @ApiModelProperty(value = "菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)") + private boolean menuCheckStrictly; - /** - * 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) - */ - @ApiModelProperty(value = "部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )") - private boolean deptCheckStrictly; + /** + * 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) + */ + @ApiModelProperty(value = "部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )") + private boolean deptCheckStrictly; - /** - * 角色状态(0正常 1停用) - */ - @ApiModelProperty(value = "角色状态(0正常 1停用)") - @ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_common_status") - private String status; + /** + * 角色状态(0正常 1停用) + */ + @ApiModelProperty(value = "角色状态(0正常 1停用)") + @ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_common_status") + private String status; - /** - * 删除标志(0代表存在 2代表删除) - */ - @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") - @TableLogic - private String delFlag; + /** + * 删除标志(0代表存在 2代表删除) + */ + @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") + @TableLogic + private String delFlag; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; - /** - * 用户是否存在此角色标识 默认不存在 - */ - @ApiModelProperty(value = "用户是否存在此角色标识 默认不存在") - @TableField(exist = false) - private boolean flag = false; + /** + * 用户是否存在此角色标识 默认不存在 + */ + @ApiModelProperty(value = "用户是否存在此角色标识 默认不存在") + @TableField(exist = false) + private boolean flag = false; - /** - * 菜单组 - */ - @ApiModelProperty(value = "菜单组") - @TableField(exist = false) - private Long[] menuIds; + /** + * 菜单组 + */ + @ApiModelProperty(value = "菜单组") + @TableField(exist = false) + private Long[] menuIds; - /** - * 部门组(数据权限) - */ - @ApiModelProperty(value = "部门组(数据权限)") - @TableField(exist = false) - private Long[] deptIds; + /** + * 部门组(数据权限) + */ + @ApiModelProperty(value = "部门组(数据权限)") + @TableField(exist = false) + private Long[] deptIds; - public SysRole(Long roleId) { - this.roleId = roleId; - } + public SysRole(Long roleId) { + this.roleId = roleId; + } - @ApiModelProperty(value = "是否管理员") - public boolean isAdmin() { - return isAdmin(this.roleId); - } + @ApiModelProperty(value = "是否管理员") + public boolean isAdmin() { + return isAdmin(this.roleId); + } - public static boolean isAdmin(Long roleId) { - return roleId != null && 1L == roleId; - } + public static boolean isAdmin(Long roleId) { + return roleId != null && 1L == roleId; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 2d991a5be..09b82e992 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -34,158 +34,158 @@ import java.util.List; @ApiModel("用户信息业务对象") public class SysUser extends BaseEntity { - /** - * 用户ID - */ - @ApiModelProperty(value = "用户ID") - @TableId(value = "user_id") - private Long userId; + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID") + @TableId(value = "user_id") + private Long userId; - /** - * 部门ID - */ - @ApiModelProperty(value = "部门ID") - private Long deptId; + /** + * 部门ID + */ + @ApiModelProperty(value = "部门ID") + private Long deptId; - /** - * 用户账号 - */ - @ApiModelProperty(value = "用户账号") + /** + * 用户账号 + */ + @ApiModelProperty(value = "用户账号") @Xss(message = "用户账号不能包含脚本字符") @NotBlank(message = "用户账号不能为空") - @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") - private String userName; + @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") + private String userName; - /** - * 用户昵称 - */ + /** + * 用户昵称 + */ @ApiModelProperty(value = "用户昵称") @Xss(message = "用户昵称不能包含脚本字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") - private String nickName; + private String nickName; - /** - * 用户邮箱 - */ + /** + * 用户邮箱 + */ @Sensitive(strategy = SensitiveStrategy.EMAIL) - @ApiModelProperty(value = "用户邮箱") - @Email(message = "邮箱格式不正确") - @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") - private String email; + @ApiModelProperty(value = "用户邮箱") + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + private String email; - /** - * 手机号码 - */ + /** + * 手机号码 + */ @Sensitive(strategy = SensitiveStrategy.PHONE) - @ApiModelProperty(value = "手机号码") - private String phonenumber; + @ApiModelProperty(value = "手机号码") + private String phonenumber; - /** - * 用户性别 - */ - @ApiModelProperty(value = "用户性别") - private String sex; + /** + * 用户性别 + */ + @ApiModelProperty(value = "用户性别") + private String sex; - /** - * 用户头像 - */ - @ApiModelProperty(value = "用户头像") - private String avatar; + /** + * 用户头像 + */ + @ApiModelProperty(value = "用户头像") + private String avatar; - /** - * 密码 - */ - @ApiModelProperty(value = "密码") - @TableField( - insertStrategy = FieldStrategy.NOT_EMPTY, - updateStrategy = FieldStrategy.NOT_EMPTY, - whereStrategy = FieldStrategy.NOT_EMPTY - ) - private String password; + /** + * 密码 + */ + @ApiModelProperty(value = "密码") + @TableField( + insertStrategy = FieldStrategy.NOT_EMPTY, + updateStrategy = FieldStrategy.NOT_EMPTY, + whereStrategy = FieldStrategy.NOT_EMPTY + ) + private String password; - @JsonIgnore - @JsonProperty - public String getPassword() { - return password; - } + @JsonIgnore + @JsonProperty + public String getPassword() { + return password; + } - /** - * 帐号状态(0正常 1停用) - */ - @ApiModelProperty(value = "帐号状态(0正常 1停用)") - private String status; + /** + * 帐号状态(0正常 1停用) + */ + @ApiModelProperty(value = "帐号状态(0正常 1停用)") + private String status; - /** - * 删除标志(0代表存在 2代表删除) - */ - @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") - @TableLogic - private String delFlag; + /** + * 删除标志(0代表存在 2代表删除) + */ + @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") + @TableLogic + private String delFlag; - /** - * 最后登录IP - */ - @ApiModelProperty(value = "最后登录IP") - private String loginIp; + /** + * 最后登录IP + */ + @ApiModelProperty(value = "最后登录IP") + private String loginIp; - /** - * 最后登录时间 - */ - @ApiModelProperty(value = "最后登录时间") - private Date loginDate; + /** + * 最后登录时间 + */ + @ApiModelProperty(value = "最后登录时间") + private Date loginDate; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; - /** - * 部门对象 - */ - @ApiModelProperty(value = "部门对象") - @TableField(exist = false) - private SysDept dept; + /** + * 部门对象 + */ + @ApiModelProperty(value = "部门对象") + @TableField(exist = false) + private SysDept dept; - /** - * 角色对象 - */ - @ApiModelProperty(value = "角色对象") - @TableField(exist = false) - private List roles; + /** + * 角色对象 + */ + @ApiModelProperty(value = "角色对象") + @TableField(exist = false) + private List roles; - /** - * 角色组 - */ - @ApiModelProperty(value = "角色组") - @TableField(exist = false) - private Long[] roleIds; + /** + * 角色组 + */ + @ApiModelProperty(value = "角色组") + @TableField(exist = false) + private Long[] roleIds; - /** - * 岗位组 - */ - @ApiModelProperty(value = "岗位组") - @TableField(exist = false) - private Long[] postIds; + /** + * 岗位组 + */ + @ApiModelProperty(value = "岗位组") + @TableField(exist = false) + private Long[] postIds; - /** - * 数据权限 当前角色ID - */ - @ApiModelProperty(value = "角色ID") - @TableField(exist = false) - private Long roleId; + /** + * 数据权限 当前角色ID + */ + @ApiModelProperty(value = "角色ID") + @TableField(exist = false) + private Long roleId; - public SysUser(Long userId) { - this.userId = userId; - } + public SysUser(Long userId) { + this.userId = userId; + } - @ApiModelProperty(value = "是否管理员") - public boolean isAdmin() { - return isAdmin(this.userId); - } + @ApiModelProperty(value = "是否管理员") + public boolean isAdmin() { + return isAdmin(this.userId); + } - public static boolean isAdmin(Long userId) { - return userId != null && 1L == userId; - } + public static boolean isAdmin(Long userId) { + return userId != null && 1L == userId; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java index e11ec94ec..9532db3b8 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/BaseMapperPlus.java @@ -22,15 +22,15 @@ import java.util.Map; */ public interface BaseMapperPlus extends BaseMapper { - /** - * 单sql批量插入( 全量填充 ) - */ - int insertAll(@Param("list") Collection batchList); + /** + * 单sql批量插入( 全量填充 ) + */ + int insertAll(@Param("list") Collection batchList); /** * 根据 ID 查询 */ - default V selectVoById(Serializable id, Class voClass){ + default V selectVoById(Serializable id, Class voClass) { T obj = this.selectById(id); if (ObjectUtil.isNull(obj)) { return null; @@ -41,7 +41,7 @@ public interface BaseMapperPlus extends BaseMapper { /** * 查询(根据ID 批量查询) */ - default List selectVoBatchIds(Collection idList, Class voClass){ + default List selectVoBatchIds(Collection idList, Class voClass) { List list = this.selectBatchIds(idList); if (CollUtil.isEmpty(list)) { return CollUtil.newArrayList(); @@ -52,7 +52,7 @@ public interface BaseMapperPlus extends BaseMapper { /** * 查询(根据 columnMap 条件) */ - default List selectVoByMap(Map map, Class voClass){ + default List selectVoByMap(Map map, Class voClass) { List list = this.selectByMap(map); if (CollUtil.isEmpty(list)) { return CollUtil.newArrayList(); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java index f45a14ef9..897b246de 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/IServicePlus.java @@ -19,98 +19,98 @@ import java.util.function.Function; */ public interface IServicePlus extends IService { - /** - * @param id 主键id - * @return V对象 - */ - V getVoById(Serializable id); + /** + * @param id 主键id + * @return V对象 + */ + V getVoById(Serializable id); - /** - * @param convertor 自定义转换器 - */ - default V getVoById(Serializable id, Function convertor) { - return convertor.apply(getById(id)); - } + /** + * @param convertor 自定义转换器 + */ + default V getVoById(Serializable id, Function convertor) { + return convertor.apply(getById(id)); + } - /** - * @param idList id列表 - * @return V对象 - */ - List listVoByIds(Collection idList); + /** + * @param idList id列表 + * @return V对象 + */ + List listVoByIds(Collection idList); - /** - * @param convertor 自定义转换器 - */ - default List listVoByIds(Collection idList, - Function, List> convertor) { - List list = getBaseMapper().selectBatchIds(idList); - if (list == null) { - return null; - } - return convertor.apply(list); - } + /** + * @param convertor 自定义转换器 + */ + default List listVoByIds(Collection idList, + Function, List> convertor) { + List list = getBaseMapper().selectBatchIds(idList); + if (list == null) { + return null; + } + return convertor.apply(list); + } - /** - * @param columnMap 表字段 map 对象 - * @return V对象 - */ - List listVoByMap(Map columnMap); + /** + * @param columnMap 表字段 map 对象 + * @return V对象 + */ + List listVoByMap(Map columnMap); - /** - * @param convertor 自定义转换器 - */ - default List listVoByMap(Map columnMap, - Function, List> convertor) { - List list = getBaseMapper().selectByMap(columnMap); - if (list == null) { - return null; - } - return convertor.apply(list); - } + /** + * @param convertor 自定义转换器 + */ + default List listVoByMap(Map columnMap, + Function, List> convertor) { + List list = getBaseMapper().selectByMap(columnMap); + if (list == null) { + return null; + } + return convertor.apply(list); + } - /** - * @param queryWrapper 查询条件 - * @return V对象 - */ - V getVoOne(Wrapper queryWrapper); + /** + * @param queryWrapper 查询条件 + * @return V对象 + */ + V getVoOne(Wrapper queryWrapper); - /** - * @param convertor 自定义转换器 - */ - default V getVoOne(Wrapper queryWrapper, Function convertor) { - return convertor.apply(getOne(queryWrapper, true)); - } + /** + * @param convertor 自定义转换器 + */ + default V getVoOne(Wrapper queryWrapper, Function convertor) { + return convertor.apply(getOne(queryWrapper, true)); + } - /** - * @param queryWrapper 查询条件 - * @return V对象 - */ - List listVo(Wrapper queryWrapper); + /** + * @param queryWrapper 查询条件 + * @return V对象 + */ + List listVo(Wrapper queryWrapper); - /** - * @param convertor 自定义转换器 - */ - default List listVo(Wrapper queryWrapper, Function, List> convertor) { - List list = getBaseMapper().selectList(queryWrapper); - if (list == null) { - return null; - } - return convertor.apply(list); - } + /** + * @param convertor 自定义转换器 + */ + default List listVo(Wrapper queryWrapper, Function, List> convertor) { + List list = getBaseMapper().selectList(queryWrapper); + if (list == null) { + return null; + } + return convertor.apply(list); + } - default List listVo() { - return listVo(Wrappers.emptyWrapper()); - } + default List listVo() { + return listVo(Wrappers.emptyWrapper()); + } - /** - * @param convertor 自定义转换器 - */ - default List listVo(Function, List> convertor) { - return listVo(Wrappers.emptyWrapper(), convertor); - } + /** + * @param convertor 自定义转换器 + */ + default List listVo(Function, List> convertor) { + return listVo(Wrappers.emptyWrapper(), convertor); + } - boolean saveAll(Collection entityList); + boolean saveAll(Collection entityList); - boolean saveOrUpdateAll(Collection entityList); + boolean saveOrUpdateAll(Collection entityList); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java index 740cc2885..50f848037 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/core/ServicePlusImpl.java @@ -31,172 +31,172 @@ import java.util.Map; @SuppressWarnings("unchecked") public class ServicePlusImpl, T, V> extends ServiceImpl implements IServicePlus { - @Autowired - protected M baseMapper; + @Autowired + protected M baseMapper; - @Override - public M getBaseMapper() { - return baseMapper; - } + @Override + public M getBaseMapper() { + return baseMapper; + } - protected Class entityClass = currentModelClass(); + protected Class entityClass = currentModelClass(); - @Override - public Class getEntityClass() { - return entityClass; - } + @Override + public Class getEntityClass() { + return entityClass; + } - protected Class mapperClass = currentMapperClass(); + protected Class mapperClass = currentMapperClass(); - protected Class voClass = currentVoClass(); + protected Class voClass = currentVoClass(); - public Class getVoClass() { - return voClass; - } + public Class getVoClass() { + return voClass; + } - @Override - protected Class currentMapperClass() { - return (Class) ReflectionKit.getSuperClassGenericType(this.getClass(), ServicePlusImpl.class, 0); - } + @Override + protected Class currentMapperClass() { + return (Class) ReflectionKit.getSuperClassGenericType(this.getClass(), ServicePlusImpl.class, 0); + } - @Override - protected Class currentModelClass() { - return (Class) ReflectionKit.getSuperClassGenericType(this.getClass(), ServicePlusImpl.class, 1); - } + @Override + protected Class currentModelClass() { + return (Class) ReflectionKit.getSuperClassGenericType(this.getClass(), ServicePlusImpl.class, 1); + } - protected Class currentVoClass() { - return (Class) ReflectionKit.getSuperClassGenericType(this.getClass(), ServicePlusImpl.class, 2); - } + protected Class currentVoClass() { + return (Class) ReflectionKit.getSuperClassGenericType(this.getClass(), ServicePlusImpl.class, 2); + } - /** - * 单条执行性能差 适用于列表对象内容不确定 - */ - @Override - public boolean saveBatch(Collection entityList, int batchSize) { - return super.saveBatch(entityList, batchSize); - } + /** + * 单条执行性能差 适用于列表对象内容不确定 + */ + @Override + public boolean saveBatch(Collection entityList, int batchSize) { + return super.saveBatch(entityList, batchSize); + } - @Override - public boolean saveOrUpdate(T entity) { - return super.saveOrUpdate(entity); - } + @Override + public boolean saveOrUpdate(T entity) { + return super.saveOrUpdate(entity); + } - /** - * 单条执行性能差 适用于列表对象内容不确定 - */ - @Override - public boolean saveOrUpdateBatch(Collection entityList, int batchSize) { - return super.saveOrUpdateBatch(entityList, batchSize); - } + /** + * 单条执行性能差 适用于列表对象内容不确定 + */ + @Override + public boolean saveOrUpdateBatch(Collection entityList, int batchSize) { + return super.saveOrUpdateBatch(entityList, batchSize); + } - @Override - public boolean updateBatchById(Collection entityList, int batchSize) { - return super.updateBatchById(entityList, batchSize); - } + @Override + public boolean updateBatchById(Collection entityList, int batchSize) { + return super.updateBatchById(entityList, batchSize); + } - /** - * 单sql批量插入( 全量填充 无视数据库默认值 ) - * 适用于无脑插入 - */ - @Override - public boolean saveBatch(Collection entityList) { - return saveBatch(entityList, DEFAULT_BATCH_SIZE); - } + /** + * 单sql批量插入( 全量填充 无视数据库默认值 ) + * 适用于无脑插入 + */ + @Override + public boolean saveBatch(Collection entityList) { + return saveBatch(entityList, DEFAULT_BATCH_SIZE); + } - @Override - public boolean saveOrUpdateBatch(Collection entityList) { - return saveOrUpdateBatch(entityList, DEFAULT_BATCH_SIZE); - } + @Override + public boolean saveOrUpdateBatch(Collection entityList) { + return saveOrUpdateBatch(entityList, DEFAULT_BATCH_SIZE); + } - @Override - public boolean updateBatchById(Collection entityList) { - return updateBatchById(entityList, DEFAULT_BATCH_SIZE); - } + @Override + public boolean updateBatchById(Collection entityList) { + return updateBatchById(entityList, DEFAULT_BATCH_SIZE); + } - /** - * 单sql批量插入( 全量填充 ) - */ - @Override - public boolean saveAll(Collection entityList) { - if (CollUtil.isEmpty(entityList)) { - return false; - } - return baseMapper.insertAll(entityList) == entityList.size(); - } + /** + * 单sql批量插入( 全量填充 ) + */ + @Override + public boolean saveAll(Collection entityList) { + if (CollUtil.isEmpty(entityList)) { + return false; + } + return baseMapper.insertAll(entityList) == entityList.size(); + } - /** - * 全量保存或更新 ( 按主键区分 ) - */ - @Override - public boolean saveOrUpdateAll(Collection entityList) { - if (CollUtil.isEmpty(entityList)) { - return false; - } - TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass); - Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!"); - String keyProperty = tableInfo.getKeyProperty(); - Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!"); - List addList = new ArrayList<>(); - List updateList = new ArrayList<>(); - int row = 0; - for (T entity : entityList) { - Object id = ReflectUtils.invokeGetter(entity, keyProperty); - if (ObjectUtil.isNull(id)) { - addList.add(entity); - } else { - updateList.add(entity); - } - } - if (CollUtil.isNotEmpty(updateList) && updateBatchById(updateList)) { - row += updateList.size(); - } + /** + * 全量保存或更新 ( 按主键区分 ) + */ + @Override + public boolean saveOrUpdateAll(Collection entityList) { + if (CollUtil.isEmpty(entityList)) { + return false; + } + TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass); + Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!"); + String keyProperty = tableInfo.getKeyProperty(); + Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!"); + List addList = new ArrayList<>(); + List updateList = new ArrayList<>(); + int row = 0; + for (T entity : entityList) { + Object id = ReflectUtils.invokeGetter(entity, keyProperty); + if (ObjectUtil.isNull(id)) { + addList.add(entity); + } else { + updateList.add(entity); + } + } + if (CollUtil.isNotEmpty(updateList) && updateBatchById(updateList)) { + row += updateList.size(); + } if (CollUtil.isNotEmpty(addList)) { row += baseMapper.insertAll(addList); } - return row == entityList.size(); - } + return row == entityList.size(); + } - /** - * 根据 ID 查询 - */ - @Override - public V getVoById(Serializable id) { + /** + * 根据 ID 查询 + */ + @Override + public V getVoById(Serializable id) { return getBaseMapper().selectVoById(id, voClass); - } + } - /** - * 查询(根据ID 批量查询) - */ - @Override - public List listVoByIds(Collection idList) { + /** + * 查询(根据ID 批量查询) + */ + @Override + public List listVoByIds(Collection idList) { return getBaseMapper().selectVoBatchIds(idList, voClass); - } + } - /** - * 查询(根据 columnMap 条件) - */ - @Override - public List listVoByMap(Map columnMap) { + /** + * 查询(根据 columnMap 条件) + */ + @Override + public List listVoByMap(Map columnMap) { return getBaseMapper().selectVoByMap(columnMap, voClass); - } + } - /** - * 根据 Wrapper,查询一条记录
- *

结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")

- */ - @Override - public V getVoOne(Wrapper queryWrapper) { + /** + * 根据 Wrapper,查询一条记录
+ *

结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")

+ */ + @Override + public V getVoOne(Wrapper queryWrapper) { return getBaseMapper().selectVoOne(queryWrapper, voClass); - } + } - /** - * 查询列表 - */ - @Override - public List listVo(Wrapper queryWrapper) { + /** + * 查询列表 + */ + @Override + public List listVo(Wrapper queryWrapper) { return getBaseMapper().selectVoList(queryWrapper, voClass); - } + } /** * 翻页查询 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/methods/InsertAll.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/methods/InsertAll.java index 403ea539b..9920dc5bf 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/methods/InsertAll.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/methods/InsertAll.java @@ -21,81 +21,81 @@ import java.util.List; */ public class InsertAll extends AbstractMethod { - private final static String[] FILL_PROPERTY = {"createTime", "createBy", "updateTime", "updateBy"}; + private final static String[] FILL_PROPERTY = {"createTime", "createBy", "updateTime", "updateBy"}; - @Override - public MappedStatement injectMappedStatement(Class mapperClass, Class modelClass, TableInfo tableInfo) { - final String sql = ""; - final String fieldSql = prepareFieldSql(tableInfo); - final String valueSql = prepareValuesSqlForMysqlBatch(tableInfo); - KeyGenerator keyGenerator = new NoKeyGenerator(); - String sqlMethod = "insertAll"; - String keyProperty = null; - String keyColumn = null; - // 表包含主键处理逻辑,如果不包含主键当普通字段处理 - if (StringUtils.isNotBlank(tableInfo.getKeyProperty())) { - if (tableInfo.getIdType() == IdType.AUTO) { - /** 自增主键 */ - keyGenerator = new Jdbc3KeyGenerator(); - keyProperty = tableInfo.getKeyProperty(); - keyColumn = tableInfo.getKeyColumn(); - } else { - if (null != tableInfo.getKeySequence()) { - keyGenerator = TableInfoHelper.genKeyGenerator(sqlMethod, tableInfo, builderAssistant); - keyProperty = tableInfo.getKeyProperty(); - keyColumn = tableInfo.getKeyColumn(); - } - } - } - final String sqlResult = String.format(sql, tableInfo.getTableName(), fieldSql, valueSql); - SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); - return this.addInsertMappedStatement(mapperClass, modelClass, sqlMethod, sqlSource, keyGenerator, keyProperty, keyColumn); - } + @Override + public MappedStatement injectMappedStatement(Class mapperClass, Class modelClass, TableInfo tableInfo) { + final String sql = ""; + final String fieldSql = prepareFieldSql(tableInfo); + final String valueSql = prepareValuesSqlForMysqlBatch(tableInfo); + KeyGenerator keyGenerator = new NoKeyGenerator(); + String sqlMethod = "insertAll"; + String keyProperty = null; + String keyColumn = null; + // 表包含主键处理逻辑,如果不包含主键当普通字段处理 + if (StringUtils.isNotBlank(tableInfo.getKeyProperty())) { + if (tableInfo.getIdType() == IdType.AUTO) { + /** 自增主键 */ + keyGenerator = new Jdbc3KeyGenerator(); + keyProperty = tableInfo.getKeyProperty(); + keyColumn = tableInfo.getKeyColumn(); + } else { + if (null != tableInfo.getKeySequence()) { + keyGenerator = TableInfoHelper.genKeyGenerator(sqlMethod, tableInfo, builderAssistant); + keyProperty = tableInfo.getKeyProperty(); + keyColumn = tableInfo.getKeyColumn(); + } + } + } + final String sqlResult = String.format(sql, tableInfo.getTableName(), fieldSql, valueSql); + SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); + return this.addInsertMappedStatement(mapperClass, modelClass, sqlMethod, sqlSource, keyGenerator, keyProperty, keyColumn); + } - private String prepareFieldSql(TableInfo tableInfo) { - StringBuilder fieldSql = new StringBuilder(); - if (StringUtils.isNotBlank(tableInfo.getKeyColumn())) { - fieldSql.append(tableInfo.getKeyColumn()).append(","); - } - tableInfo.getFieldList().forEach(x -> fieldSql.append(x.getColumn()).append(",")); - fieldSql.delete(fieldSql.length() - 1, fieldSql.length()); - fieldSql.insert(0, "("); - fieldSql.append(")"); - return fieldSql.toString(); - } + private String prepareFieldSql(TableInfo tableInfo) { + StringBuilder fieldSql = new StringBuilder(); + if (StringUtils.isNotBlank(tableInfo.getKeyColumn())) { + fieldSql.append(tableInfo.getKeyColumn()).append(","); + } + tableInfo.getFieldList().forEach(x -> fieldSql.append(x.getColumn()).append(",")); + fieldSql.delete(fieldSql.length() - 1, fieldSql.length()); + fieldSql.insert(0, "("); + fieldSql.append(")"); + return fieldSql.toString(); + } - private String prepareValuesSqlForMysqlBatch(TableInfo tableInfo) { - final StringBuilder valueSql = new StringBuilder(); - valueSql.append(""); - if (StringUtils.isNotBlank(tableInfo.getKeyColumn())) { - valueSql.append("\n#{item.").append(tableInfo.getKeyProperty()).append("},\n"); - } - List fieldList = tableInfo.getFieldList(); - int last = fieldList.size() - 1; - for (int i = 0; i < fieldList.size(); i++) { - String property = fieldList.get(i).getProperty(); - if (!StringUtils.equalsAny(property, FILL_PROPERTY)) { - valueSql.append(""); - valueSql.append("#{item.").append(property).append("}"); - if (i != last) { - valueSql.append(","); - } - valueSql.append(""); - valueSql.append(""); - valueSql.append("DEFAULT"); - if (i != last) { - valueSql.append(","); - } - valueSql.append(""); - } else { - valueSql.append("#{item.").append(property).append("}"); - if (i != last) { - valueSql.append(","); - } - } - } - valueSql.append(""); - return valueSql.toString(); - } + private String prepareValuesSqlForMysqlBatch(TableInfo tableInfo) { + final StringBuilder valueSql = new StringBuilder(); + valueSql.append(""); + if (StringUtils.isNotBlank(tableInfo.getKeyColumn())) { + valueSql.append("\n#{item.").append(tableInfo.getKeyProperty()).append("},\n"); + } + List fieldList = tableInfo.getFieldList(); + int last = fieldList.size() - 1; + for (int i = 0; i < fieldList.size(); i++) { + String property = fieldList.get(i).getProperty(); + if (!StringUtils.equalsAny(property, FILL_PROPERTY)) { + valueSql.append(""); + valueSql.append("#{item.").append(property).append("}"); + if (i != last) { + valueSql.append(","); + } + valueSql.append(""); + valueSql.append(""); + valueSql.append("DEFAULT"); + if (i != last) { + valueSql.append(","); + } + valueSql.append(""); + } else { + valueSql.append("#{item.").append(property).append("}"); + if (i != last) { + valueSql.append(","); + } + } + } + valueSql.append(""); + return valueSql.toString(); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java index 46b01b94d..b2537c18e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java @@ -22,42 +22,42 @@ import java.util.List; @Accessors(chain = true) @ApiModel("分页响应对象") public class TableDataInfo implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 总记录数 - */ - @ApiModelProperty("总记录数") - private long total; + /** + * 总记录数 + */ + @ApiModelProperty("总记录数") + private long total; - /** - * 列表数据 - */ - @ApiModelProperty("列表数据") - private List rows; + /** + * 列表数据 + */ + @ApiModelProperty("列表数据") + private List rows; - /** - * 消息状态码 - */ - @ApiModelProperty("消息状态码") - private int code; + /** + * 消息状态码 + */ + @ApiModelProperty("消息状态码") + private int code; - /** - * 消息内容 - */ - @ApiModelProperty("消息内容") - private String msg; + /** + * 消息内容 + */ + @ApiModelProperty("消息内容") + private String msg; - /** - * 分页 - * - * @param list 列表数据 - * @param total 总记录数 - */ - public TableDataInfo(List list, long total) { - this.rows = list; - this.total = total; - } + /** + * 分页 + * + * @param list 列表数据 + * @param total 总记录数 + */ + public TableDataInfo(List list, long total) { + this.rows = list; + this.total = total; + } public static TableDataInfo build(IPage page) { TableDataInfo rspData = new TableDataInfo<>(); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java index 53bc3d4dd..0b1d3f41e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java @@ -20,339 +20,339 @@ import java.util.*; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class StringUtils extends org.apache.commons.lang3.StringUtils { - /** - * 获取参数不为空值 - * - * @param value defaultValue 要判断的value - * @return value 返回值 - */ - public static T nvl(T value, T defaultValue) { - return ObjectUtil.defaultIfNull(value, defaultValue); - } + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) { + return ObjectUtil.defaultIfNull(value, defaultValue); + } - /** - * 获取参数不为空值 - * - * @param str defaultValue 要判断的value - * @return value 返回值 - */ - public static String blankToDefault(String str, String defaultValue) { - return StrUtil.blankToDefault(str, defaultValue); - } + /** + * 获取参数不为空值 + * + * @param str defaultValue 要判断的value + * @return value 返回值 + */ + public static String blankToDefault(String str, String defaultValue) { + return StrUtil.blankToDefault(str, defaultValue); + } - /** - * * 判断一个Collection是否为空, 包含List,Set,Queue - * - * @param coll 要判断的Collection - * @return true:为空 false:非空 - */ - public static boolean isEmpty(Collection coll) { - return CollUtil.isEmpty(coll); - } + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) { + return CollUtil.isEmpty(coll); + } - /** - * * 判断一个Collection是否非空,包含List,Set,Queue - * - * @param coll 要判断的Collection - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Collection coll) { - return !isEmpty(coll); - } + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) { + return !isEmpty(coll); + } - /** - * * 判断一个对象数组是否为空 - * - * @param objects 要判断的对象数组 - * * @return true:为空 false:非空 - */ - public static boolean isEmpty(Object[] objects) { - return ArrayUtil.isEmpty(objects); - } + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + * * @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) { + return ArrayUtil.isEmpty(objects); + } - /** - * * 判断一个对象数组是否非空 - * - * @param objects 要判断的对象数组 - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Object[] objects) { - return !isEmpty(objects); - } + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) { + return !isEmpty(objects); + } - /** - * * 判断一个对象是否为空 - * - * @param object 要判断的对象数组 - * * @return true:为空 false:非空 - */ - public static boolean isEmpty(Object object) { - return ObjectUtil.isEmpty(object); - } + /** + * * 判断一个对象是否为空 + * + * @param object 要判断的对象数组 + * * @return true:为空 false:非空 + */ + public static boolean isEmpty(Object object) { + return ObjectUtil.isEmpty(object); + } - /** - * * 判断一个对象是否非空 - * - * @param object 要判断的对象数组 - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Object object) { - return !isEmpty(object); - } + /** + * * 判断一个对象是否非空 + * + * @param object 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object object) { + return !isEmpty(object); + } - /** - * * 判断一个Map是否为空 - * - * @param map 要判断的Map - * @return true:为空 false:非空 - */ - public static boolean isEmpty(Map map) { - return MapUtil.isEmpty(map); - } + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) { + return MapUtil.isEmpty(map); + } - /** - * * 判断一个Map是否为空 - * - * @param map 要判断的Map - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Map map) { - return !isEmpty(map); - } + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) { + return !isEmpty(map); + } - /** - * * 判断一个字符串是否为空串 - * - * @param str String - * @return true:为空 false:非空 - */ - public static boolean isEmpty(String str) { - return StrUtil.isEmpty(str); - } + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) { + return StrUtil.isEmpty(str); + } - /** - * * 判断一个字符串是否为非空串 - * - * @param str String - * @return true:非空串 false:空串 - */ - public static boolean isNotEmpty(String str) { - return !isEmpty(str); - } + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) { + return !isEmpty(str); + } - /** - * * 判断一个对象是否为空 - * - * @param object Object - * @return true:为空 false:非空 - */ - public static boolean isNull(Object object) { - return ObjectUtil.isNull(object); - } + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) { + return ObjectUtil.isNull(object); + } - /** - * * 判断一个对象是否非空 - * - * @param object Object - * @return true:非空 false:空 - */ - public static boolean isNotNull(Object object) { - return !isNull(object); - } + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) { + return !isNull(object); + } - /** - * * 判断一个对象是否是数组类型(Java基本型别的数组) - * - * @param object 对象 - * @return true:是数组 false:不是数组 - */ - public static boolean isArray(Object object) { - return ArrayUtil.isArray(object); - } + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) { + return ArrayUtil.isArray(object); + } - /** - * 去空格 - */ - public static String trim(String str) { - return StrUtil.trim(str); - } + /** + * 去空格 + */ + public static String trim(String str) { + return StrUtil.trim(str); + } - /** - * 截取字符串 - * - * @param str 字符串 - * @param start 开始 - * @return 结果 - */ - public static String substring(final String str, int start) { - return substring(str, start, str.length()); - } + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) { + return substring(str, start, str.length()); + } - /** - * 截取字符串 - * - * @param str 字符串 - * @param start 开始 - * @param end 结束 - * @return 结果 - */ - public static String substring(final String str, int start, int end) { - return StrUtil.sub(str, start, end); - } + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) { + return StrUtil.sub(str, start, end); + } - /** - * 格式化文本, {} 表示占位符
- * 此方法只是简单将占位符 {} 按照顺序替换为参数
- * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
- * 例:
- * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
- * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
- * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
- * - * @param template 文本模板,被替换的部分用 {} 表示 - * @param params 参数值 - * @return 格式化后的文本 - */ - public static String format(String template, Object... params) { - return StrUtil.format(template, params); - } + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) { + return StrUtil.format(template, params); + } - /** - * 是否为http(s)://开头 - * - * @param link 链接 - * @return 结果 - */ - public static boolean ishttp(String link) { - return Validator.isUrl(link); - } + /** + * 是否为http(s)://开头 + * + * @param link 链接 + * @return 结果 + */ + public static boolean ishttp(String link) { + return Validator.isUrl(link); + } - /** - * 字符串转set - * - * @param str 字符串 - * @param sep 分隔符 - * @return set集合 - */ - public static Set str2Set(String str, String sep) { - return new HashSet<>(str2List(str, sep, true, false)); - } + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static Set str2Set(String str, String sep) { + return new HashSet<>(str2List(str, sep, true, false)); + } - /** - * 字符串转list - * - * @param str 字符串 - * @param sep 分隔符 - * @param filterBlank 过滤纯空白 - * @param trim 去掉首尾空白 - * @return list集合 - */ - public static List str2List(String str, String sep, boolean filterBlank, boolean trim) { - List list = new ArrayList<>(); - if (isEmpty(str)) { - return list; - } + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static List str2List(String str, String sep, boolean filterBlank, boolean trim) { + List list = new ArrayList<>(); + if (isEmpty(str)) { + return list; + } - // 过滤空白字符串 - if (filterBlank && isBlank(str)) { - return list; - } - String[] split = str.split(sep); - for (String string : split) { - if (filterBlank && isBlank(string)) { - continue; - } - if (trim) { - string = trim(string); - } - list.add(string); - } + // 过滤空白字符串 + if (filterBlank && isBlank(str)) { + return list; + } + String[] split = str.split(sep); + for (String string : split) { + if (filterBlank && isBlank(string)) { + continue; + } + if (trim) { + string = trim(string); + } + list.add(string); + } - return list; - } + return list; + } - /** - * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写 - * - * @param cs 指定字符串 - * @param searchCharSequences 需要检查的字符串数组 - * @return 是否包含任意一个字符串 - */ - public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) { - return StrUtil.containsAnyIgnoreCase(cs, searchCharSequences); - } + /** + * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写 + * + * @param cs 指定字符串 + * @param searchCharSequences 需要检查的字符串数组 + * @return 是否包含任意一个字符串 + */ + public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) { + return StrUtil.containsAnyIgnoreCase(cs, searchCharSequences); + } - /** - * 驼峰转下划线命名 - */ - public static String toUnderScoreCase(String str) { - return StrUtil.toUnderlineCase(str); - } + /** + * 驼峰转下划线命名 + */ + public static String toUnderScoreCase(String str) { + return StrUtil.toUnderlineCase(str); + } - /** - * 是否包含字符串 - * - * @param str 验证字符串 - * @param strs 字符串组 - * @return 包含返回true - */ - public static boolean inStringIgnoreCase(String str, String... strs) { - return StrUtil.equalsAnyIgnoreCase(str, strs); - } + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) { + return StrUtil.equalsAnyIgnoreCase(str, strs); + } - /** - * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld - * - * @param name 转换前的下划线大写方式命名的字符串 - * @return 转换后的驼峰式命名的字符串 - */ - public static String convertToCamelCase(String name) { - return StrUtil.upperFirst(StrUtil.toCamelCase(name)); - } + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) { + return StrUtil.upperFirst(StrUtil.toCamelCase(name)); + } - /** - * 驼峰式命名法 例如:user_name->userName - */ - public static String toCamelCase(String s) { - return StrUtil.toCamelCase(s); - } + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) { + return StrUtil.toCamelCase(s); + } - /** - * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 - * - * @param str 指定字符串 - * @param strs 需要检查的字符串数组 - * @return 是否匹配 - */ - public static boolean matches(String str, List strs) { - if (isEmpty(str) || isEmpty(strs)) { - return false; - } - for (String pattern : strs) { - if (isMatch(pattern, str)) { - return true; - } - } - return false; - } + /** + * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 + * + * @param str 指定字符串 + * @param strs 需要检查的字符串数组 + * @return 是否匹配 + */ + public static boolean matches(String str, List strs) { + if (isEmpty(str) || isEmpty(strs)) { + return false; + } + for (String pattern : strs) { + if (isMatch(pattern, str)) { + return true; + } + } + return false; + } - /** - * 判断url是否与规则配置: - * ? 表示单个字符; - * * 表示一层路径内的任意字符串,不可跨层级; - * ** 表示任意层路径; - * - * @param pattern 匹配规则 - * @param url 需要匹配的url - * @return - */ - public static boolean isMatch(String pattern, String url) { + /** + * 判断url是否与规则配置: + * ? 表示单个字符; + * * 表示一层路径内的任意字符串,不可跨层级; + * ** 表示任意层路径; + * + * @param pattern 匹配规则 + * @param url 需要匹配的url + * @return + */ + public static boolean isMatch(String pattern, String url) { AntPathMatcher matcher = new AntPathMatcher(); return matcher.match(pattern, url); - } + } - @SuppressWarnings("unchecked") - public static T cast(Object obj) { - return (T) obj; - } + @SuppressWarnings("unchecked") + public static T cast(Object obj) { + return (T) obj; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ValidatorUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ValidatorUtils.java index 522b989b9..1fe2eaf64 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ValidatorUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ValidatorUtils.java @@ -17,9 +17,9 @@ import java.util.Set; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class ValidatorUtils { - private static final Validator VALID = SpringUtils.getBean(Validator.class); + private static final Validator VALID = SpringUtils.getBean(Validator.class); - public static void validate(T object, Class... groups) { + public static void validate(T object, Class... groups) { Set> validate = VALID.validate(object, groups); if (!validate.isEmpty()) { throw new ConstraintViolationException("参数校验异常", validate); diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java index 40b031b51..f56888219 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java @@ -27,22 +27,22 @@ import javax.validation.constraints.NotNull; @RequestMapping("/demo/i18n") public class TestI18nController { - /** - * 通过code获取国际化内容 - * code为 messages.properties 中的 key - * - * 测试使用 user.register.success - */ - @ApiOperation("通过code获取国际化内容") - @GetMapping() - public AjaxResult get(@ApiParam("国际化code") String code) { - return AjaxResult.success(MessageUtils.message(code)); - } + /** + * 通过code获取国际化内容 + * code为 messages.properties 中的 key + *

+ * 测试使用 user.register.success + */ + @ApiOperation("通过code获取国际化内容") + @GetMapping() + public AjaxResult get(@ApiParam("国际化code") String code) { + return AjaxResult.success(MessageUtils.message(code)); + } /** * Validator 校验国际化 * 不传值 分别查看异常返回 - * + *

* 测试使用 not.null */ @ApiOperation("Validator 校验国际化") @@ -54,7 +54,7 @@ public class TestI18nController { /** * Bean 校验国际化 * 不传值 分别查看异常返回 - * + *

* 测试使用 not.null */ @ApiOperation("Bean 校验国际化") diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java index 74b57d991..f36ae2b3f 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java @@ -18,12 +18,12 @@ import lombok.experimental.Accessors; @TableName("test_demo") public class TestDemo extends BaseEntity { - private static final long serialVersionUID=1L; + private static final long serialVersionUID = 1L; - /** - * 主键 - */ + /** + * 主键 + */ @TableId(value = "id") private Long id; @@ -40,7 +40,7 @@ public class TestDemo extends BaseEntity { /** * 排序号 */ - @OrderBy(asc = false, sort = 1) + @OrderBy(asc = false, sort = 1) private Long orderNum; /** diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java index 92e005b85..7459362f5 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java @@ -21,7 +21,7 @@ import lombok.experimental.Accessors; @TableName("test_tree") public class TestTree extends TreeEntity { - private static final long serialVersionUID=1L; + private static final long serialVersionUID = 1L; /** diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestDemoBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestDemoBo.java index 63d28368b..5c41204d7 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestDemoBo.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestDemoBo.java @@ -26,43 +26,43 @@ public class TestDemoBo extends BaseEntity { /** * 主键 */ - @ApiModelProperty("主键") - @NotNull(message = "主键不能为空", groups = { EditGroup.class }) + @ApiModelProperty("主键") + @NotNull(message = "主键不能为空", groups = {EditGroup.class}) private Long id; /** * 部门id */ - @ApiModelProperty("部门id") - @NotNull(message = "部门id不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("部门id") + @NotNull(message = "部门id不能为空", groups = {AddGroup.class, EditGroup.class}) private Long deptId; /** * 用户id */ - @ApiModelProperty("用户id") - @NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("用户id") + @NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class}) private Long userId; /** * 排序号 */ - @ApiModelProperty("排序号") - @NotNull(message = "排序号不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("排序号") + @NotNull(message = "排序号不能为空", groups = {AddGroup.class, EditGroup.class}) private Long orderNum; /** * key键 */ - @ApiModelProperty("key键") - @NotBlank(message = "key键不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("key键") + @NotBlank(message = "key键不能为空", groups = {AddGroup.class, EditGroup.class}) private String testKey; /** * 值 */ - @ApiModelProperty("值") - @NotBlank(message = "值不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("值") + @NotBlank(message = "值不能为空", groups = {AddGroup.class, EditGroup.class}) private String value; } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestTreeBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestTreeBo.java index c561dd7a1..29f4ac973 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestTreeBo.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/bo/TestTreeBo.java @@ -26,29 +26,29 @@ public class TestTreeBo extends TreeEntity { /** * 主键 */ - @ApiModelProperty("主键") - @NotNull(message = "主键不能为空", groups = { EditGroup.class }) + @ApiModelProperty("主键") + @NotNull(message = "主键不能为空", groups = {EditGroup.class}) private Long id; /** * 部门id */ - @ApiModelProperty("部门id") - @NotNull(message = "部门id不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("部门id") + @NotNull(message = "部门id不能为空", groups = {AddGroup.class, EditGroup.class}) private Long deptId; /** * 用户id */ - @ApiModelProperty("用户id") - @NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("用户id") + @NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class}) private Long userId; /** * 树节点名 */ - @ApiModelProperty("树节点名") - @NotBlank(message = "树节点名不能为空", groups = { AddGroup.class, EditGroup.class }) + @ApiModelProperty("树节点名") + @NotBlank(message = "树节点名不能为空", groups = {AddGroup.class, EditGroup.class}) private String treeName; } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestDemoVo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestDemoVo.java index 4919bbde2..ef26ff325 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestDemoVo.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestDemoVo.java @@ -9,7 +9,6 @@ import lombok.Data; import java.util.Date; - /** * 测试单表视图对象 test_demo * @@ -21,77 +20,77 @@ import java.util.Date; @ExcelIgnoreUnannotated public class TestDemoVo { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 主键 + /** + * 主键 */ - @ExcelProperty(value = "主键") - @ApiModelProperty("主键") - private Long id; + @ExcelProperty(value = "主键") + @ApiModelProperty("主键") + private Long id; /** * 部门id */ - @ExcelProperty(value = "部门id") - @ApiModelProperty("部门id") - private Long deptId; + @ExcelProperty(value = "部门id") + @ApiModelProperty("部门id") + private Long deptId; /** * 用户id */ - @ExcelProperty(value = "用户id") - @ApiModelProperty("用户id") - private Long userId; + @ExcelProperty(value = "用户id") + @ApiModelProperty("用户id") + private Long userId; /** * 排序号 */ - @ExcelProperty(value = "排序号") - @ApiModelProperty("排序号") - private Long orderNum; + @ExcelProperty(value = "排序号") + @ApiModelProperty("排序号") + private Long orderNum; /** * key键 */ - @ExcelProperty(value = "key键") - @ApiModelProperty("key键") - private String testKey; + @ExcelProperty(value = "key键") + @ApiModelProperty("key键") + private String testKey; /** * 值 */ - @ExcelProperty(value = "值") - @ApiModelProperty("值") - private String value; + @ExcelProperty(value = "值") + @ApiModelProperty("值") + private String value; /** * 创建时间 */ - @ExcelProperty(value = "创建时间") - @ApiModelProperty("创建时间") - private Date createTime; + @ExcelProperty(value = "创建时间") + @ApiModelProperty("创建时间") + private Date createTime; /** * 创建人 */ - @ExcelProperty(value = "创建人") - @ApiModelProperty("创建人") - private String createBy; + @ExcelProperty(value = "创建人") + @ApiModelProperty("创建人") + private String createBy; /** * 更新时间 */ - @ExcelProperty(value = "更新时间") - @ApiModelProperty("更新时间") - private Date updateTime; + @ExcelProperty(value = "更新时间") + @ApiModelProperty("更新时间") + private Date updateTime; /** * 更新人 */ - @ExcelProperty(value = "更新人") - @ApiModelProperty("更新人") - private String updateBy; + @ExcelProperty(value = "更新人") + @ApiModelProperty("更新人") + private String updateBy; } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestTreeVo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestTreeVo.java index dab816243..309a0ae4e 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestTreeVo.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/TestTreeVo.java @@ -9,7 +9,6 @@ import lombok.Data; import java.util.Date; - /** * 测试树表视图对象 test_tree * @@ -21,48 +20,48 @@ import java.util.Date; @ExcelIgnoreUnannotated public class TestTreeVo { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 主键 + /** + * 主键 */ - @ApiModelProperty("主键") - private Long id; + @ApiModelProperty("主键") + private Long id; /** * 父id */ - @ExcelProperty(value = "父id") - @ApiModelProperty("父id") - private Long parentId; + @ExcelProperty(value = "父id") + @ApiModelProperty("父id") + private Long parentId; /** * 部门id */ - @ExcelProperty(value = "部门id") - @ApiModelProperty("部门id") - private Long deptId; + @ExcelProperty(value = "部门id") + @ApiModelProperty("部门id") + private Long deptId; /** * 用户id */ - @ExcelProperty(value = "用户id") - @ApiModelProperty("用户id") - private Long userId; + @ExcelProperty(value = "用户id") + @ApiModelProperty("用户id") + private Long userId; /** * 树节点名 */ - @ExcelProperty(value = "树节点名") - @ApiModelProperty("树节点名") - private String treeName; + @ExcelProperty(value = "树节点名") + @ApiModelProperty("树节点名") + private String treeName; /** * 创建时间 */ - @ExcelProperty(value = "创建时间") - @ApiModelProperty("创建时间") - private Date createTime; + @ExcelProperty(value = "创建时间") + @ApiModelProperty("创建时间") + private Date createTime; } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java index 12834d300..4ea7298c2 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java @@ -1,11 +1,11 @@ package com.ruoyi.demo.service; import com.ruoyi.common.core.domain.PageQuery; -import com.ruoyi.demo.domain.TestDemo; -import com.ruoyi.demo.domain.vo.TestDemoVo; -import com.ruoyi.demo.domain.bo.TestDemoBo; import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.demo.domain.TestDemo; +import com.ruoyi.demo.domain.bo.TestDemoBo; +import com.ruoyi.demo.domain.vo.TestDemoVo; import java.util.Collection; import java.util.List; @@ -18,46 +18,50 @@ import java.util.List; */ public interface ITestDemoService extends IServicePlus { - /** - * 查询单个 - * @return - */ - TestDemoVo queryById(Long id); - - /** - * 查询列表 - */ - TableDataInfo queryPageList(TestDemoBo bo, PageQuery pageQuery); - - /** - * 自定义分页查询 - */ - TableDataInfo customPageList(TestDemoBo bo, PageQuery pageQuery); + /** + * 查询单个 + * + * @return + */ + TestDemoVo queryById(Long id); /** - * 查询列表 - */ - List queryList(TestDemoBo bo); + * 查询列表 + */ + TableDataInfo queryPageList(TestDemoBo bo, PageQuery pageQuery); - /** - * 根据新增业务对象插入测试单表 - * @param bo 测试单表新增业务对象 - * @return - */ - Boolean insertByBo(TestDemoBo bo); + /** + * 自定义分页查询 + */ + TableDataInfo customPageList(TestDemoBo bo, PageQuery pageQuery); - /** - * 根据编辑业务对象修改测试单表 - * @param bo 测试单表编辑业务对象 - * @return - */ - Boolean updateByBo(TestDemoBo bo); + /** + * 查询列表 + */ + List queryList(TestDemoBo bo); - /** - * 校验并删除数据 - * @param ids 主键集合 - * @param isValid 是否校验,true-删除前校验,false-不校验 - * @return - */ - Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + /** + * 根据新增业务对象插入测试单表 + * + * @param bo 测试单表新增业务对象 + * @return + */ + Boolean insertByBo(TestDemoBo bo); + + /** + * 根据编辑业务对象修改测试单表 + * + * @param bo 测试单表编辑业务对象 + * @return + */ + Boolean updateByBo(TestDemoBo bo); + + /** + * 校验并删除数据 + * + * @param ids 主键集合 + * @param isValid 是否校验,true-删除前校验,false-不校验 + * @return + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java index 9b8acb9c6..0fa5c99bf 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java @@ -1,9 +1,9 @@ package com.ruoyi.demo.service; -import com.ruoyi.demo.domain.TestTree; -import com.ruoyi.demo.domain.vo.TestTreeVo; -import com.ruoyi.demo.domain.bo.TestTreeBo; import com.ruoyi.common.core.mybatisplus.core.IServicePlus; +import com.ruoyi.demo.domain.TestTree; +import com.ruoyi.demo.domain.bo.TestTreeBo; +import com.ruoyi.demo.domain.vo.TestTreeVo; import java.util.Collection; import java.util.List; @@ -15,36 +15,40 @@ import java.util.List; * @date 2021-07-26 */ public interface ITestTreeService extends IServicePlus { - /** - * 查询单个 - * @return - */ - TestTreeVo queryById(Long id); + /** + * 查询单个 + * + * @return + */ + TestTreeVo queryById(Long id); - /** - * 查询列表 - */ - List queryList(TestTreeBo bo); + /** + * 查询列表 + */ + List queryList(TestTreeBo bo); - /** - * 根据新增业务对象插入测试树表 - * @param bo 测试树表新增业务对象 - * @return - */ - Boolean insertByBo(TestTreeBo bo); + /** + * 根据新增业务对象插入测试树表 + * + * @param bo 测试树表新增业务对象 + * @return + */ + Boolean insertByBo(TestTreeBo bo); - /** - * 根据编辑业务对象修改测试树表 - * @param bo 测试树表编辑业务对象 - * @return - */ - Boolean updateByBo(TestTreeBo bo); + /** + * 根据编辑业务对象修改测试树表 + * + * @param bo 测试树表编辑业务对象 + * @return + */ + Boolean updateByBo(TestTreeBo bo); - /** - * 校验并删除数据 - * @param ids 主键集合 - * @param isValid 是否校验,true-删除前校验,false-不校验 - * @return - */ - Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + /** + * 校验并删除数据 + * + * @param ids 主键集合 + * @param isValid 是否校验,true-删除前校验,false-不校验 + * @return + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java index a647d241a..604525ef5 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java @@ -28,75 +28,75 @@ import java.util.Map; @Service public class TestDemoServiceImpl extends ServicePlusImpl implements ITestDemoService { - @Override - public TestDemoVo queryById(Long id) { - return getVoById(id); - } + @Override + public TestDemoVo queryById(Long id) { + return getVoById(id); + } - @Override - public TableDataInfo queryPageList(TestDemoBo bo, PageQuery pageQuery) { + @Override + public TableDataInfo queryPageList(TestDemoBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = pageVo(pageQuery.build(), lqw); - return TableDataInfo.build(result); - } + return TableDataInfo.build(result); + } - /** - * 自定义分页查询 - */ - @Override - public TableDataInfo customPageList(TestDemoBo bo, PageQuery pageQuery) { + /** + * 自定义分页查询 + */ + @Override + public TableDataInfo customPageList(TestDemoBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); - Page result = baseMapper.customPageList(pageQuery.build(), lqw); - return TableDataInfo.build(result); - } + Page result = baseMapper.customPageList(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } - @Override - public List queryList(TestDemoBo bo) { - return listVo(buildQueryWrapper(bo)); - } + @Override + public List queryList(TestDemoBo bo) { + return listVo(buildQueryWrapper(bo)); + } - private LambdaQueryWrapper buildQueryWrapper(TestDemoBo bo) { - Map params = bo.getParams(); - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.like(StringUtils.isNotBlank(bo.getTestKey()), TestDemo::getTestKey, bo.getTestKey()); - lqw.eq(StringUtils.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue()); - lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, - TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); - return lqw; - } + private LambdaQueryWrapper buildQueryWrapper(TestDemoBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getTestKey()), TestDemo::getTestKey, bo.getTestKey()); + lqw.eq(StringUtils.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue()); + lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, + TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); + return lqw; + } - @Override - public Boolean insertByBo(TestDemoBo bo) { - TestDemo add = BeanUtil.toBean(bo, TestDemo.class); - validEntityBeforeSave(add); - boolean flag = save(add); - if (flag) { - bo.setId(add.getId()); - } - return flag; - } + @Override + public Boolean insertByBo(TestDemoBo bo) { + TestDemo add = BeanUtil.toBean(bo, TestDemo.class); + validEntityBeforeSave(add); + boolean flag = save(add); + if (flag) { + bo.setId(add.getId()); + } + return flag; + } - @Override - public Boolean updateByBo(TestDemoBo bo) { - TestDemo update = BeanUtil.toBean(bo, TestDemo.class); - validEntityBeforeSave(update); - return updateById(update); - } + @Override + public Boolean updateByBo(TestDemoBo bo) { + TestDemo update = BeanUtil.toBean(bo, TestDemo.class); + validEntityBeforeSave(update); + return updateById(update); + } - /** - * 保存前的数据校验 - * - * @param entity 实体类数据 - */ - private void validEntityBeforeSave(TestDemo entity) { - //TODO 做一些数据校验,如唯一约束 - } + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(TestDemo entity) { + //TODO 做一些数据校验,如唯一约束 + } - @Override - public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if (isValid) { - //TODO 做一些业务上的校验,判断是否需要校验 - } - return removeByIds(ids); - } + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if (isValid) { + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java index c4097e667..99a39f362 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java @@ -26,59 +26,59 @@ import java.util.Map; @Service public class TestTreeServiceImpl extends ServicePlusImpl implements ITestTreeService { - @Override - public TestTreeVo queryById(Long id) { - return getVoById(id); - } + @Override + public TestTreeVo queryById(Long id) { + return getVoById(id); + } -// @DS("slave") // 切换从库查询 - @Override - public List queryList(TestTreeBo bo) { + // @DS("slave") // 切换从库查询 + @Override + public List queryList(TestTreeBo bo) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); return listVo(lqw); - } + } - private LambdaQueryWrapper buildQueryWrapper(TestTreeBo bo) { - Map params = bo.getParams(); - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.like(StringUtils.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName()); - lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, - TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); - return lqw; - } + private LambdaQueryWrapper buildQueryWrapper(TestTreeBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName()); + lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, + TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); + return lqw; + } - @Override - public Boolean insertByBo(TestTreeBo bo) { - TestTree add = BeanUtil.toBean(bo, TestTree.class); - validEntityBeforeSave(add); - boolean flag = save(add); - if (flag) { - bo.setId(add.getId()); - } - return flag; - } + @Override + public Boolean insertByBo(TestTreeBo bo) { + TestTree add = BeanUtil.toBean(bo, TestTree.class); + validEntityBeforeSave(add); + boolean flag = save(add); + if (flag) { + bo.setId(add.getId()); + } + return flag; + } - @Override - public Boolean updateByBo(TestTreeBo bo) { - TestTree update = BeanUtil.toBean(bo, TestTree.class); - validEntityBeforeSave(update); - return updateById(update); - } + @Override + public Boolean updateByBo(TestTreeBo bo) { + TestTree update = BeanUtil.toBean(bo, TestTree.class); + validEntityBeforeSave(update); + return updateById(update); + } - /** - * 保存前的数据校验 - * - * @param entity 实体类数据 - */ - private void validEntityBeforeSave(TestTree entity) { - //TODO 做一些数据校验,如唯一约束 - } + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(TestTree entity) { + //TODO 做一些数据校验,如唯一约束 + } - @Override - public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if (isValid) { - //TODO 做一些业务上的校验,判断是否需要校验 - } - return removeByIds(ids); - } + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if (isValid) { + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } } diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/MonitorAdminApplication.java b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/MonitorAdminApplication.java index 1d1cbca58..d4f038c94 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/MonitorAdminApplication.java +++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/MonitorAdminApplication.java @@ -11,9 +11,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MonitorAdminApplication { - public static void main(String[] args) { - SpringApplication.run(MonitorAdminApplication.class, args); - System.out.println("Admin 监控启动成功" ); - } + public static void main(String[] args) { + SpringApplication.run(MonitorAdminApplication.class, args); + System.out.println("Admin 监控启动成功"); + } } diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java index 04a0fdef0..2b04f712f 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java +++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java @@ -16,33 +16,33 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { - private final String adminContextPath; + private final String adminContextPath; - public SecurityConfig(AdminServerProperties adminServerProperties) { - this.adminContextPath = adminServerProperties.getContextPath(); - } + public SecurityConfig(AdminServerProperties adminServerProperties) { + this.adminContextPath = adminServerProperties.getContextPath(); + } - @Override - protected void configure(HttpSecurity httpSecurity) throws Exception { - SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); - successHandler.setTargetUrlParameter("redirectTo"); - successHandler.setDefaultTargetUrl(adminContextPath + "/"); - // admin监控 用户鉴权 - httpSecurity.authorizeRequests() - //授予对所有静态资产和登录页面的公共访问权限。 - .antMatchers(adminContextPath + "/assets/**").permitAll() - .antMatchers(adminContextPath + "/login").permitAll() + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception { + SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); + successHandler.setTargetUrlParameter("redirectTo"); + successHandler.setDefaultTargetUrl(adminContextPath + "/"); + // admin监控 用户鉴权 + httpSecurity.authorizeRequests() + //授予对所有静态资产和登录页面的公共访问权限。 + .antMatchers(adminContextPath + "/assets/**").permitAll() + .antMatchers(adminContextPath + "/login").permitAll() .antMatchers("/actuator").permitAll() .antMatchers("/actuator/**").permitAll() - //必须对每个其他请求进行身份验证 - .anyRequest().authenticated().and() - //配置登录和注销 - .formLogin().loginPage(adminContextPath + "/login") - .successHandler(successHandler).and() - .logout().logoutUrl(adminContextPath + "/logout").and() - //启用HTTP-Basic支持。这是Spring Boot Admin Client注册所必需的 - .httpBasic().and().csrf().disable() - .headers().frameOptions().disable(); - } + //必须对每个其他请求进行身份验证 + .anyRequest().authenticated().and() + //配置登录和注销 + .formLogin().loginPage(adminContextPath + "/login") + .successHandler(successHandler).and() + .logout().logoutUrl(adminContextPath + "/logout").and() + //启用HTTP-Basic支持。这是Spring Boot Admin Client注册所必需的 + .httpBasic().and().csrf().disable() + .headers().frameOptions().disable(); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java index 95f3c9b73..728773d94 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java @@ -23,9 +23,9 @@ import java.util.concurrent.ScheduledExecutorService; @Configuration public class AsyncConfig extends AsyncConfigurerSupport { - @Autowired - @Qualifier("scheduledExecutorService") - private ScheduledExecutorService scheduledExecutorService; + @Autowired + @Qualifier("scheduledExecutorService") + private ScheduledExecutorService scheduledExecutorService; /** * 异步执行需要使用权限框架自带的包装线程池 保证权限信息的传递 @@ -44,7 +44,7 @@ public class AsyncConfig extends AsyncConfigurerSupport { throwable.printStackTrace(); StringBuilder sb = new StringBuilder(); sb.append("Exception message - ").append(throwable.getMessage()) - .append(", Method name - ").append(method.getName()); + .append(", Method name - ").append(method.getName()); if (ArrayUtil.isNotEmpty(objects)) { sb.append(", Parameter value - ").append(Arrays.toString(objects)); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java index 735f7e35e..6f7a82ecc 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java @@ -21,11 +21,10 @@ public class DruidConfig { /** * 去除监控页面底部的广告 */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Bean @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true") - public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) - { + public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) { // 获取web监控页面的参数 DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); // 提取common.js的配置路径 @@ -33,16 +32,14 @@ public class DruidConfig { String commonJsPattern = pattern.replaceAll("\\*", "js/common.js"); final String filePath = "support/http/resources/js/common.js"; // 创建filter进行过滤 - Filter filter = new Filter() - { + Filter filter = new Filter() { @Override - public void init(javax.servlet.FilterConfig filterConfig) throws ServletException - { + public void init(javax.servlet.FilterConfig filterConfig) throws ServletException { } + @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException - { + throws IOException, ServletException { chain.doFilter(request, response); // 重置缓冲区,响应头不会被重置 // response.resetBuffer(); @@ -53,9 +50,9 @@ public class DruidConfig { text = text.replaceAll("powered.*?shrek.wang", ""); response.getWriter().write(text); } + @Override - public void destroy() - { + public void destroy() { } }; FilterRegistrationBean registrationBean = new FilterRegistrationBean(); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java index 20b52a8e2..e64fa3a7f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java @@ -17,30 +17,30 @@ import java.util.Locale; @Configuration public class I18nConfig { - @Bean - public LocaleResolver localeResolver() { - return new I18nLocaleResolver(); - } + @Bean + public LocaleResolver localeResolver() { + return new I18nLocaleResolver(); + } - /** - * 获取请求头国际化信息 - */ - static class I18nLocaleResolver implements LocaleResolver { + /** + * 获取请求头国际化信息 + */ + static class I18nLocaleResolver implements LocaleResolver { - @Override - public Locale resolveLocale(HttpServletRequest httpServletRequest) { - String language = httpServletRequest.getHeader("content-language"); - Locale locale = Locale.getDefault(); - if (StrUtil.isNotBlank(language)) { - String[] split = language.split("_"); - locale = new Locale(split[0], split[1]); - } - return locale; - } + @Override + public Locale resolveLocale(HttpServletRequest httpServletRequest) { + String language = httpServletRequest.getHeader("content-language"); + Locale locale = Locale.getDefault(); + if (StrUtil.isNotBlank(language)) { + String[] split = language.split("_"); + locale = new Locale(split[0], split[1]); + } + return locale; + } - @Override - public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) { + @Override + public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) { - } - } + } + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/JacksonConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/JacksonConfig.java index 55756d49b..a5d637165 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/JacksonConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/JacksonConfig.java @@ -28,23 +28,23 @@ import java.util.TimeZone; @Configuration public class JacksonConfig { - @Primary - @Bean - public ObjectMapper getObjectMapper(Jackson2ObjectMapperBuilder builder, JacksonProperties jacksonProperties) { - ObjectMapper objectMapper = builder.createXmlMapper(false).build(); - // 全局配置序列化返回 JSON 处理 - SimpleModule simpleModule = new SimpleModule(); - simpleModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE); - simpleModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE); - simpleModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE); - simpleModule.addSerializer(BigDecimal.class, ToStringSerializer.instance); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(jacksonProperties.getDateFormat()); - simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter)); - simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter)); - objectMapper.registerModule(simpleModule); - objectMapper.setTimeZone(TimeZone.getDefault()); - log.info("初始化 jackson 配置"); - return objectMapper; - } + @Primary + @Bean + public ObjectMapper getObjectMapper(Jackson2ObjectMapperBuilder builder, JacksonProperties jacksonProperties) { + ObjectMapper objectMapper = builder.createXmlMapper(false).build(); + // 全局配置序列化返回 JSON 处理 + SimpleModule simpleModule = new SimpleModule(); + simpleModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE); + simpleModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE); + simpleModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE); + simpleModule.addSerializer(BigDecimal.class, ToStringSerializer.instance); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(jacksonProperties.getDateFormat()); + simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter)); + simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter)); + objectMapper.registerModule(simpleModule); + objectMapper.setTimeZone(TimeZone.getDefault()); + log.info("初始化 jackson 配置"); + return objectMapper; + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java index 5daaa9acd..d7f238b72 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java @@ -31,17 +31,17 @@ import java.util.List; @MapperScan("${mybatis-plus.mapperPackage}") public class MybatisPlusConfig { - @Bean - public MybatisPlusInterceptor mybatisPlusInterceptor() { - MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); // 数据权限处理 interceptor.addInnerInterceptor(dataPermissionInterceptor()); - // 分页插件 - interceptor.addInnerInterceptor(paginationInnerInterceptor()); - // 乐观锁插件 - interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); - return interceptor; - } + // 分页插件 + interceptor.addInnerInterceptor(paginationInnerInterceptor()); + // 乐观锁插件 + interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); + return interceptor; + } /** * 数据权限拦截器 @@ -50,47 +50,47 @@ public class MybatisPlusConfig { return new PlusDataPermissionInterceptor(); } - /** - * 分页插件,自动识别数据库类型 - */ - public PaginationInnerInterceptor paginationInnerInterceptor() { - PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); - // 设置最大单页限制数量,默认 500 条,-1 不受限制 - paginationInnerInterceptor.setMaxLimit(-1L); - // 分页合理化 - paginationInnerInterceptor.setOverflow(true); - return paginationInnerInterceptor; - } + /** + * 分页插件,自动识别数据库类型 + */ + public PaginationInnerInterceptor paginationInnerInterceptor() { + PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); + // 设置最大单页限制数量,默认 500 条,-1 不受限制 + paginationInnerInterceptor.setMaxLimit(-1L); + // 分页合理化 + paginationInnerInterceptor.setOverflow(true); + return paginationInnerInterceptor; + } - /** - * 乐观锁插件 - */ - public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() { - return new OptimisticLockerInnerInterceptor(); - } + /** + * 乐观锁插件 + */ + public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() { + return new OptimisticLockerInnerInterceptor(); + } - /** - * 元对象字段填充控制器 - */ - @Bean - public MetaObjectHandler metaObjectHandler() { - return new CreateAndUpdateMetaObjectHandler(); - } + /** + * 元对象字段填充控制器 + */ + @Bean + public MetaObjectHandler metaObjectHandler() { + return new CreateAndUpdateMetaObjectHandler(); + } - /** - * sql注入器配置 - */ - @Bean - public ISqlInjector sqlInjector() { - return new DefaultSqlInjector() { - @Override - public List getMethodList(Class mapperClass, TableInfo tableInfo) { - List methodList = super.getMethodList(mapperClass, tableInfo); - methodList.add(new InsertAll()); - return methodList; - } - }; - } + /** + * sql注入器配置 + */ + @Bean + public ISqlInjector sqlInjector() { + return new DefaultSqlInjector() { + @Override + public List getMethodList(Class mapperClass, TableInfo tableInfo) { + List methodList = super.getMethodList(mapperClass, tableInfo); + methodList.add(new InsertAll()); + return methodList; + } + }; + } /** * 使用网卡信息绑定雪花生成器 @@ -101,24 +101,24 @@ public class MybatisPlusConfig { return new DefaultIdentifierGenerator(NetUtil.getLocalhost()); } - /** - * PaginationInnerInterceptor 分页插件,自动识别数据库类型 - * https://baomidou.com/pages/97710a/ - * OptimisticLockerInnerInterceptor 乐观锁插件 - * https://baomidou.com/pages/0d93c0/ - * MetaObjectHandler 元对象字段填充控制器 - * https://baomidou.com/pages/4c6bcf/ - * ISqlInjector sql注入器 - * https://baomidou.com/pages/42ea4a/ - * BlockAttackInnerInterceptor 如果是对全表的删除或更新操作,就会终止该操作 - * https://baomidou.com/pages/f9a237/ - * IllegalSQLInnerInterceptor sql性能规范插件(垃圾SQL拦截) - * IdentifierGenerator 自定义主键策略 - * https://baomidou.com/pages/568eb2/ - * TenantLineInnerInterceptor 多租户插件 - * https://baomidou.com/pages/aef2f2/ - * DynamicTableNameInnerInterceptor 动态表名插件 - * https://baomidou.com/pages/2a45ff/ - */ + /** + * PaginationInnerInterceptor 分页插件,自动识别数据库类型 + * https://baomidou.com/pages/97710a/ + * OptimisticLockerInnerInterceptor 乐观锁插件 + * https://baomidou.com/pages/0d93c0/ + * MetaObjectHandler 元对象字段填充控制器 + * https://baomidou.com/pages/4c6bcf/ + * ISqlInjector sql注入器 + * https://baomidou.com/pages/42ea4a/ + * BlockAttackInnerInterceptor 如果是对全表的删除或更新操作,就会终止该操作 + * https://baomidou.com/pages/f9a237/ + * IllegalSQLInnerInterceptor sql性能规范插件(垃圾SQL拦截) + * IdentifierGenerator 自定义主键策略 + * https://baomidou.com/pages/568eb2/ + * TenantLineInnerInterceptor 多租户插件 + * https://baomidou.com/pages/aef2f2/ + * DynamicTableNameInnerInterceptor 动态表名插件 + * https://baomidou.com/pages/2a45ff/ + */ } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index bf6bc8f9f..29d79d10a 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -34,7 +34,7 @@ public class SwaggerConfig { private SwaggerProperties swaggerProperties; @Autowired - private TokenProperties tokenProperties; + private TokenProperties tokenProperties; @Autowired private OpenApiExtensionResolver openApiExtensionResolver; @@ -44,30 +44,30 @@ public class SwaggerConfig { */ @PostConstruct public void createRestApi() { - for (SwaggerProperties.Groups group : swaggerProperties.getGroups()) { - String basePackage = group.getBasePackage(); - Docket docket = new Docket(DocumentationType.OAS_30) - .enable(swaggerProperties.getEnabled()) - // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) - .apiInfo(apiInfo()) - // 设置哪些接口暴露给Swagger展示 - .select() - // 扫描所有有注解的api,用这种方式更灵活 - //.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) - // 扫描指定包中的swagger注解 - .apis(RequestHandlerSelectors.basePackage(basePackage)) - // 扫描所有 .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) - .build() - .groupName(group.getName()) - // 设置安全模式,swagger可以设置访问token - .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()) - .extensions(openApiExtensionResolver.buildExtensions(group.getName())) - .pathMapping(swaggerProperties.getPathMapping()); - String beanName = StringUtils.substringAfterLast(basePackage, ".") + "Docket"; - SpringUtils.registerBean(beanName, docket); - } + for (SwaggerProperties.Groups group : swaggerProperties.getGroups()) { + String basePackage = group.getBasePackage(); + Docket docket = new Docket(DocumentationType.OAS_30) + .enable(swaggerProperties.getEnabled()) + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + //.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + .apis(RequestHandlerSelectors.basePackage(basePackage)) + // 扫描所有 .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build() + .groupName(group.getName()) + // 设置安全模式,swagger可以设置访问token + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()) + .extensions(openApiExtensionResolver.buildExtensions(group.getName())) + .pathMapping(swaggerProperties.getPathMapping()); + String beanName = StringUtils.substringAfterLast(basePackage, ".") + "Docket"; + SpringUtils.registerBean(beanName, docket); + } } /** @@ -75,8 +75,8 @@ public class SwaggerConfig { */ private List securitySchemes() { List apiKeyList = new ArrayList(); - String header = tokenProperties.getHeader(); - apiKeyList.add(new ApiKey(header, header, In.HEADER.toValue())); + String header = tokenProperties.getHeader(); + apiKeyList.add(new ApiKey(header, header, In.HEADER.toValue())); return apiKeyList; } @@ -86,10 +86,10 @@ public class SwaggerConfig { private List securityContexts() { List securityContexts = new ArrayList<>(); securityContexts.add( - SecurityContext.builder() - .securityReferences(defaultAuth()) - .operationSelector(o -> o.requestMappingPattern().matches("/.*")) - .build()); + SecurityContext.builder() + .securityReferences(defaultAuth()) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) + .build()); return securityContexts; } @@ -112,14 +112,14 @@ public class SwaggerConfig { // 用ApiInfoBuilder进行定制 SwaggerProperties.Contact contact = swaggerProperties.getContact(); return new ApiInfoBuilder() - // 设置标题 - .title(swaggerProperties.getTitle()) - // 描述 - .description(swaggerProperties.getDescription()) - // 作者信息 - .contact(new Contact(contact.getName(), contact.getUrl(), contact.getEmail())) - // 版本 - .version(swaggerProperties.getVersion()) - .build(); + // 设置标题 + .title(swaggerProperties.getTitle()) + // 描述 + .description(swaggerProperties.getDescription()) + // 作者信息 + .contact(new Contact(contact.getName(), contact.getUrl(), contact.getEmail())) + // 版本 + .version(swaggerProperties.getVersion()) + .build(); } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java index 354d8c304..1b41c66cf 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java @@ -16,23 +16,23 @@ import org.springframework.stereotype.Component; @ConfigurationProperties(prefix = "captcha") public class CaptchaProperties { - /** - * 验证码类型 - */ + /** + * 验证码类型 + */ private CaptchaType type; - /** - * 验证码类别 - */ + /** + * 验证码类别 + */ private CaptchaCategory category; - /** - * 数字验证码位数 - */ + /** + * 数字验证码位数 + */ private Integer numberLength; - /** - * 字符验证码长度 - */ + /** + * 字符验证码长度 + */ private Integer charLength; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java index 4516da269..0b9024d21 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java @@ -20,217 +20,217 @@ import java.util.List; @ConfigurationProperties(prefix = "redisson") public class RedissonProperties { - /** - * 线程池数量,默认值 = 当前处理核数量 * 2 - */ - private int threads; + /** + * 线程池数量,默认值 = 当前处理核数量 * 2 + */ + private int threads; - /** - * Netty线程池数量,默认值 = 当前处理核数量 * 2 - */ - private int nettyThreads; + /** + * Netty线程池数量,默认值 = 当前处理核数量 * 2 + */ + private int nettyThreads; - /** - * 传输模式 - */ - private TransportMode transportMode; + /** + * 传输模式 + */ + private TransportMode transportMode; - /** - * 单机服务配置 - */ - private SingleServerConfig singleServerConfig; + /** + * 单机服务配置 + */ + private SingleServerConfig singleServerConfig; - /** - * 集群服务配置 - */ - private ClusterServersConfig clusterServersConfig; + /** + * 集群服务配置 + */ + private ClusterServersConfig clusterServersConfig; - /** - * 缓存组 - */ - private List cacheGroup; + /** + * 缓存组 + */ + private List cacheGroup; - @Data - @NoArgsConstructor - public static class SingleServerConfig { + @Data + @NoArgsConstructor + public static class SingleServerConfig { - /** - * 客户端名称 - */ - private String clientName; + /** + * 客户端名称 + */ + private String clientName; - /** - * 最小空闲连接数 - */ - private int connectionMinimumIdleSize; + /** + * 最小空闲连接数 + */ + private int connectionMinimumIdleSize; - /** - * 连接池大小 - */ - private int connectionPoolSize; + /** + * 连接池大小 + */ + private int connectionPoolSize; - /** - * 连接空闲超时,单位:毫秒 - */ - private int idleConnectionTimeout; + /** + * 连接空闲超时,单位:毫秒 + */ + private int idleConnectionTimeout; - /** - * 命令等待超时,单位:毫秒 - */ - private int timeout; + /** + * 命令等待超时,单位:毫秒 + */ + private int timeout; - /** - * 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 - */ - private int retryAttempts; + /** + * 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 + */ + private int retryAttempts; - /** - * 命令重试发送时间间隔,单位:毫秒 - */ - private int retryInterval; + /** + * 命令重试发送时间间隔,单位:毫秒 + */ + private int retryInterval; - /** - * 发布和订阅连接的最小空闲连接数 - */ - private int subscriptionConnectionMinimumIdleSize; + /** + * 发布和订阅连接的最小空闲连接数 + */ + private int subscriptionConnectionMinimumIdleSize; - /** - * 发布和订阅连接池大小 - */ - private int subscriptionConnectionPoolSize; + /** + * 发布和订阅连接池大小 + */ + private int subscriptionConnectionPoolSize; - /** - * 单个连接最大订阅数量 - */ - private int subscriptionsPerConnection; + /** + * 单个连接最大订阅数量 + */ + private int subscriptionsPerConnection; - /** - * DNS监测时间间隔,单位:毫秒 - */ - private int dnsMonitoringInterval; + /** + * DNS监测时间间隔,单位:毫秒 + */ + private int dnsMonitoringInterval; - } + } - @Data - @NoArgsConstructor - public static class ClusterServersConfig { + @Data + @NoArgsConstructor + public static class ClusterServersConfig { - /** - * 客户端名称 - */ - private String clientName; + /** + * 客户端名称 + */ + private String clientName; - /** - * master最小空闲连接数 - */ - private int masterConnectionMinimumIdleSize; + /** + * master最小空闲连接数 + */ + private int masterConnectionMinimumIdleSize; - /** - * master连接池大小 - */ - private int masterConnectionPoolSize; + /** + * master连接池大小 + */ + private int masterConnectionPoolSize; - /** - * slave最小空闲连接数 - */ - private int slaveConnectionMinimumIdleSize; + /** + * slave最小空闲连接数 + */ + private int slaveConnectionMinimumIdleSize; - /** - * slave连接池大小 - */ - private int slaveConnectionPoolSize; + /** + * slave连接池大小 + */ + private int slaveConnectionPoolSize; - /** - * 连接空闲超时,单位:毫秒 - */ - private int idleConnectionTimeout; + /** + * 连接空闲超时,单位:毫秒 + */ + private int idleConnectionTimeout; - /** - * ping超时 - */ - private int pingConnectionInterval; + /** + * ping超时 + */ + private int pingConnectionInterval; - /** - * 命令等待超时,单位:毫秒 - */ - private int timeout; + /** + * 命令等待超时,单位:毫秒 + */ + private int timeout; - /** - * 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 - */ - private int retryAttempts; + /** + * 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 + */ + private int retryAttempts; - /** - * 命令重试发送时间间隔,单位:毫秒 - */ - private int retryInterval; + /** + * 命令重试发送时间间隔,单位:毫秒 + */ + private int retryInterval; - /** - * 错误重试次数 - */ - private int failedSlaveReconnectionInterval; + /** + * 错误重试次数 + */ + private int failedSlaveReconnectionInterval; - /** - * 发布和订阅连接池最小空闲连接数 - */ - private int subscriptionConnectionMinimumIdleSize; + /** + * 发布和订阅连接池最小空闲连接数 + */ + private int subscriptionConnectionMinimumIdleSize; - /** - * 发布和订阅连接池大小 - */ - private int subscriptionConnectionPoolSize; + /** + * 发布和订阅连接池大小 + */ + private int subscriptionConnectionPoolSize; - /** - * 单个连接最大订阅数量 - */ - private int subscriptionsPerConnection; + /** + * 单个连接最大订阅数量 + */ + private int subscriptionsPerConnection; - /** - * 扫描间隔 - */ - private int scanInterval; + /** + * 扫描间隔 + */ + private int scanInterval; - /** - * DNS监测时间间隔,单位:毫秒 - */ - private int dnsMonitoringInterval; + /** + * DNS监测时间间隔,单位:毫秒 + */ + private int dnsMonitoringInterval; - /** - * 读取模式 - */ - private ReadMode readMode; + /** + * 读取模式 + */ + private ReadMode readMode; - /** - * 订阅模式 - */ - private SubscriptionMode subscriptionMode; + /** + * 订阅模式 + */ + private SubscriptionMode subscriptionMode; - } + } - @Data - @NoArgsConstructor - public static class CacheGroup { + @Data + @NoArgsConstructor + public static class CacheGroup { - /** - * 组id - */ - private String groupId; + /** + * 组id + */ + private String groupId; - /** - * 组过期时间 - */ - private long ttl; + /** + * 组过期时间 + */ + private long ttl; - /** - * 组最大空闲时间 - */ - private long maxIdleTime; + /** + * 组最大空闲时间 + */ + private long maxIdleTime; - /** - * 组最大长度 - */ - private int maxSize; + /** + * 组最大长度 + */ + private int maxSize; - } + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java index 9c4cd238c..c2b3f97b6 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java @@ -21,10 +21,10 @@ public class SwaggerProperties { * 验证码类型 */ private Boolean enabled; - /** - * 设置请求的统一前缀 - */ - private String pathMapping; + /** + * 设置请求的统一前缀 + */ + private String pathMapping; /** * 验证码类别 */ @@ -38,51 +38,51 @@ public class SwaggerProperties { */ private String version; - /** - * 联系方式 - */ + /** + * 联系方式 + */ private Contact contact; - /** - * 组配置 - */ - private List groups; + /** + * 组配置 + */ + private List groups; @Data - @NoArgsConstructor - public static class Contact { + @NoArgsConstructor + public static class Contact { - /** - * 联系人 - */ - private String name; + /** + * 联系人 + */ + private String name; - /** - * 联系人url - */ - private String url; + /** + * 联系人url + */ + private String url; - /** - * 联系人email - */ - private String email; + /** + * 联系人email + */ + private String email; - } + } - @Data - @NoArgsConstructor - public static class Groups { + @Data + @NoArgsConstructor + public static class Groups { - /** - * 组名 - */ - private String name; + /** + * 组名 + */ + private String name; - /** - * 基础包路径 - */ - private String basePackage; + /** + * 基础包路径 + */ + private String basePackage; - } + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/CreateAndUpdateMetaObjectHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/CreateAndUpdateMetaObjectHandler.java index 7cf64c46b..4c4f36c6b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/CreateAndUpdateMetaObjectHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/CreateAndUpdateMetaObjectHandler.java @@ -22,43 +22,43 @@ import java.util.Date; @Slf4j public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler { - @Override - public void insertFill(MetaObject metaObject) { - try { - if (ObjectUtil.isNotNull(metaObject) && metaObject.getOriginalObject() instanceof BaseEntity) { - BaseEntity baseEntity = (BaseEntity) metaObject.getOriginalObject(); - Date current = new Date(); - // 创建时间为空 则填充 - if (ObjectUtil.isNull(baseEntity.getCreateTime())) { - baseEntity.setCreateTime(current); - } - // 更新时间为空 则填充 - if (ObjectUtil.isNull(baseEntity.getUpdateTime())) { - baseEntity.setUpdateTime(current); - } - String username = getLoginUsername(); - // 当前已登录 且 创建人为空 则填充 - if (StringUtils.isNotBlank(username) - && StringUtils.isBlank(baseEntity.getCreateBy())) { - baseEntity.setCreateBy(username); - } - // 当前已登录 且 更新人为空 则填充 - if (StringUtils.isNotBlank(username) - && StringUtils.isBlank(baseEntity.getUpdateBy())) { - baseEntity.setUpdateBy(username); - } - } - } catch (Exception e) { - throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED); - } - } + @Override + public void insertFill(MetaObject metaObject) { + try { + if (ObjectUtil.isNotNull(metaObject) && metaObject.getOriginalObject() instanceof BaseEntity) { + BaseEntity baseEntity = (BaseEntity) metaObject.getOriginalObject(); + Date current = new Date(); + // 创建时间为空 则填充 + if (ObjectUtil.isNull(baseEntity.getCreateTime())) { + baseEntity.setCreateTime(current); + } + // 更新时间为空 则填充 + if (ObjectUtil.isNull(baseEntity.getUpdateTime())) { + baseEntity.setUpdateTime(current); + } + String username = getLoginUsername(); + // 当前已登录 且 创建人为空 则填充 + if (StringUtils.isNotBlank(username) + && StringUtils.isBlank(baseEntity.getCreateBy())) { + baseEntity.setCreateBy(username); + } + // 当前已登录 且 更新人为空 则填充 + if (StringUtils.isNotBlank(username) + && StringUtils.isBlank(baseEntity.getUpdateBy())) { + baseEntity.setUpdateBy(username); + } + } + } catch (Exception e) { + throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED); + } + } - @Override - public void updateFill(MetaObject metaObject) { - try { - if (ObjectUtil.isNotNull(metaObject) && metaObject.getOriginalObject() instanceof BaseEntity) { - BaseEntity baseEntity = (BaseEntity) metaObject.getOriginalObject(); - Date current = new Date(); + @Override + public void updateFill(MetaObject metaObject) { + try { + if (ObjectUtil.isNotNull(metaObject) && metaObject.getOriginalObject() instanceof BaseEntity) { + BaseEntity baseEntity = (BaseEntity) metaObject.getOriginalObject(); + Date current = new Date(); // 更新时间填充(不管为不为空) baseEntity.setUpdateTime(current); String username = getLoginUsername(); @@ -66,24 +66,24 @@ public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler { if (StringUtils.isNotBlank(username)) { baseEntity.setUpdateBy(username); } - } - } catch (Exception e) { - throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED); - } - } + } + } catch (Exception e) { + throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED); + } + } - /** - * 获取登录用户名 - */ - private String getLoginUsername() { - LoginUser loginUser; - try { - loginUser = SecurityUtils.getLoginUser(); - } catch (Exception e) { - log.warn("自动注入警告 => 用户未登录"); - return null; - } - return loginUser.getUsername(); - } + /** + * 获取登录用户名 + */ + private String getLoginUsername() { + LoginUser loginUser; + try { + loginUser = SecurityUtils.getLoginUser(); + } catch (Exception e) { + log.warn("自动注入警告 => 用户未登录"); + return null; + } + return loginUser.getUsername(); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/jackson/BigNumberSerializer.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/jackson/BigNumberSerializer.java index 1781b94be..a4aee1552 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/jackson/BigNumberSerializer.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/jackson/BigNumberSerializer.java @@ -15,28 +15,28 @@ import java.io.IOException; @JacksonStdImpl public class BigNumberSerializer extends NumberSerializer { - /** - * 根据 JS Number.MAX_SAFE_INTEGER 与 Number.MIN_SAFE_INTEGER 得来 - */ - private static final long MAX_SAFE_INTEGER = 9007199254740991L; - private static final long MIN_SAFE_INTEGER = -9007199254740991L; + /** + * 根据 JS Number.MAX_SAFE_INTEGER 与 Number.MIN_SAFE_INTEGER 得来 + */ + private static final long MAX_SAFE_INTEGER = 9007199254740991L; + private static final long MIN_SAFE_INTEGER = -9007199254740991L; - /** - * 提供实例 - */ - public static final BigNumberSerializer INSTANCE = new BigNumberSerializer(Number.class); + /** + * 提供实例 + */ + public static final BigNumberSerializer INSTANCE = new BigNumberSerializer(Number.class); - public BigNumberSerializer(Class rawType) { - super(rawType); - } + public BigNumberSerializer(Class rawType) { + super(rawType); + } - @Override - public void serialize(Number value, JsonGenerator gen, SerializerProvider provider) throws IOException { - // 超出范围 序列化位字符串 - if (value.longValue() > MIN_SAFE_INTEGER && value.longValue() < MAX_SAFE_INTEGER) { - super.serialize(value, gen, provider); - } else { - gen.writeString(value.toString()); - } - } + @Override + public void serialize(Number value, JsonGenerator gen, SerializerProvider provider) throws IOException { + // 超出范围 序列化位字符串 + if (value.longValue() > MIN_SAFE_INTEGER && value.longValue() < MAX_SAFE_INTEGER) { + super.serialize(value, gen, provider); + } else { + gen.writeString(value.toString()); + } + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java index ef77a219a..9d27874e9 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java @@ -18,24 +18,24 @@ import java.util.concurrent.ScheduledExecutorService; @Component public class ShutdownManager { - @Autowired - @Qualifier("scheduledExecutorService") - private ScheduledExecutorService scheduledExecutorService; + @Autowired + @Qualifier("scheduledExecutorService") + private ScheduledExecutorService scheduledExecutorService; - @PreDestroy - public void destroy() { - shutdownAsyncManager(); - } + @PreDestroy + public void destroy() { + shutdownAsyncManager(); + } - /** - * 停止异步执行任务 - */ - private void shutdownAsyncManager() { - try { - log.info("====关闭后台任务任务线程池===="); - Threads.shutdownAndAwaitTermination(scheduledExecutorService); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } + /** + * 停止异步执行任务 + */ + private void shutdownAsyncManager() { + try { + log.info("====关闭后台任务任务线程池===="); + Threads.shutdownAndAwaitTermination(scheduledExecutorService); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java index 76d8090c8..969af512c 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java @@ -28,28 +28,28 @@ import java.io.IOException; @Configuration public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler { - @Autowired - private TokenService tokenService; + @Autowired + private TokenService tokenService; - @Autowired - private LogininforService asyncService; + @Autowired + private LogininforService asyncService; - /** - * 退出处理 - */ - @Override - public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) - throws IOException, ServletException { - LoginUser loginUser = tokenService.getLoginUser(request); + /** + * 退出处理 + */ + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException, ServletException { + LoginUser loginUser = tokenService.getLoginUser(request); String message = MessageUtils.message("user.logout.success"); if (StringUtils.isNotNull(loginUser)) { - String userName = loginUser.getUsername(); - // 删除用户缓存记录 - tokenService.delLoginUser(loginUser.getToken()); - // 记录用户退出日志 - asyncService.recordLogininfor(userName, Constants.LOGOUT, message, request); - } - ServletUtils.renderString(response, JsonUtils.toJsonString(AjaxResult.error(HttpStatus.HTTP_OK, message))); - } + String userName = loginUser.getUsername(); + // 删除用户缓存记录 + tokenService.delLoginUser(loginUser.getToken()); + // 记录用户退出日志 + asyncService.recordLogininfor(userName, Constants.LOGOUT, message, request); + } + ServletUtils.renderString(response, JsonUtils.toJsonString(AjaxResult.error(HttpStatus.HTTP_OK, message))); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java index 3b9fce0b5..19c7cd84b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java @@ -70,7 +70,7 @@ public class SysConfig extends BaseEntity { */ @ApiModelProperty(value = "系统内置(Y是 N否)") @ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_yes_no") + @ExcelDictFormat(dictType = "sys_yes_no") private String configType; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java index 84ab555ec..ff77cee95 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java @@ -52,7 +52,7 @@ public class SysOperLog implements Serializable { */ @ApiModelProperty(value = "业务类型(0其它 1新增 2修改 3删除)") @ExcelProperty(value = "业务类型", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_oper_type") + @ExcelDictFormat(dictType = "sys_oper_type") private Integer businessType; /** @@ -81,7 +81,7 @@ public class SysOperLog implements Serializable { */ @ApiModelProperty(value = "操作类别(0其它 1后台用户 2手机端用户)") @ExcelProperty(value = "操作类别", converter = ExcelDictConvert.class) - @ExcelDictFormat(readConverterExp = "0=其它,1=后台用户,2=手机端用户") + @ExcelDictFormat(readConverterExp = "0=其它,1=后台用户,2=手机端用户") private Integer operatorType; /** @@ -138,7 +138,7 @@ public class SysOperLog implements Serializable { */ @ApiModelProperty(value = "操作状态(0正常 1异常)") @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_common_status") + @ExcelDictFormat(dictType = "sys_common_status") private Integer status; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java index 0793d04fe..d7d75e349 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java @@ -19,35 +19,35 @@ import lombok.experimental.Accessors; @TableName("sys_oss") public class SysOss extends BaseEntity { - /** - * 对象存储主键 - */ - @TableId(value = "oss_id", type = IdType.AUTO) - private Long ossId; + /** + * 对象存储主键 + */ + @TableId(value = "oss_id", type = IdType.AUTO) + private Long ossId; - /** - * 文件名 - */ - private String fileName; + /** + * 文件名 + */ + private String fileName; - /** - * 原名 - */ - private String originalName; + /** + * 原名 + */ + private String originalName; - /** - * 文件后缀名 - */ - private String fileSuffix; + /** + * 文件后缀名 + */ + private String fileSuffix; - /** - * URL地址 - */ - private String url; + /** + * URL地址 + */ + private String url; - /** - * 服务商 - */ - private String service; + /** + * 服务商 + */ + private String service; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java index b0b8a11e5..6b99ceb49 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java @@ -69,8 +69,8 @@ public class SysPost extends BaseEntity { * 状态(0正常 1停用) */ @ApiModelProperty(value = "状态(0正常 1停用)") - @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) - @ExcelDictFormat(dictType = "sys_common_status") + @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_common_status") private String status; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index a604a12b7..9672fe07f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -426,9 +426,8 @@ public class SysMenuServiceImpl extends ServicePlusImpl