fix -- 同步 RuoYi-Vue-Plus

This commit is contained in:
konbai
2022-03-19 14:05:07 +08:00
parent e2fd862f74
commit 56a81b7704
99 changed files with 6085 additions and 1161 deletions

View File

@@ -22,8 +22,8 @@ public @interface RepeatSubmit {
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
/**
* 提示消息
* 提示消息 支持国际化 格式为 {code}
*/
String message() default "不允许重复提交,请稍候再试";
String message() default "{repeat.submit.message}";
}

View File

@@ -65,12 +65,12 @@ public interface Constants {
/**
* 登录用户 redis key
*/
public static final String LOGIN_TOKEN_KEY = "Authorization:login:token:";
String LOGIN_TOKEN_KEY = "Authorization:login:token:";
/**
* 在线用户 redis key
*/
public static final String ONLINE_TOKEN_KEY = "online_tokens:";
String ONLINE_TOKEN_KEY = "online_tokens:";
/**
* 防重提交 redis key

View File

@@ -22,11 +22,21 @@ public interface UserConstants {
*/
String EXCEPTION = "1";
/**
* 用户正常状态
*/
String USER_NORMAL = "0";
/**
* 用户封禁状态
*/
String USER_DISABLE = "1";
/**
* 角色正常状态
*/
String ROLE_NORMAL = "0";
/**
* 角色封禁状态
*/
@@ -62,6 +72,16 @@ public interface UserConstants {
*/
String NO_FRAME = "1";
/**
* 菜单正常状态
*/
String MENU_NORMAL = "0";
/**
* 菜单停用状态
*/
String MENU_DISABLE = "1";
/**
* 菜单类型(目录)
*/

View File

@@ -16,7 +16,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
public class TreeEntity extends BaseEntity {
public class TreeEntity<T> extends BaseEntity {
private static final long serialVersionUID = 1L;
@@ -38,6 +38,6 @@ public class TreeEntity extends BaseEntity {
*/
@TableField(exist = false)
@ApiModelProperty(value = "子部门")
private List<?> children = new ArrayList<>();
private List<T> children = new ArrayList<>();
}

View File

@@ -24,7 +24,7 @@ import javax.validation.constraints.Size;
@EqualsAndHashCode(callSuper = true)
@TableName("sys_dept")
@ApiModel("部门业务对象")
public class SysDept extends TreeEntity {
public class SysDept extends TreeEntity<SysDept> {
private static final long serialVersionUID = 1L;
/**

View File

@@ -1,8 +1,8 @@
package com.ruoyi.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.TreeEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -23,7 +23,7 @@ import javax.validation.constraints.Size;
@EqualsAndHashCode(callSuper = true)
@TableName("sys_menu")
@ApiModel("菜单权限业务对象")
public class SysMenu extends TreeEntity {
public class SysMenu extends TreeEntity<SysMenu> {
/**
* 菜单ID
@@ -65,8 +65,7 @@ public class SysMenu extends TreeEntity {
* 路由参数
*/
@ApiModelProperty(value = "路由参数")
@TableField("`query`")
private String query;
private String queryParam;
/**
* 是否为外链0是 1否
@@ -103,6 +102,7 @@ public class SysMenu extends TreeEntity {
* 权限字符串
*/
@ApiModelProperty(value = "权限字符串")
@JsonInclude(JsonInclude.Include.NON_NULL)
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
private String perms;

View File

@@ -0,0 +1,49 @@
package com.ruoyi.common.enums;
import com.ruoyi.common.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 数据库类型
*
* @author Lion Li
*/
@Getter
@AllArgsConstructor
public enum DataBaseType {
/**
* MySQL
*/
MY_SQL("MySQL"),
/**
* Oracle
*/
ORACLE("Oracle"),
/**
* PostgreSQL
*/
POSTGRE_SQL("PostgreSQL"),
/**
* SQL Server
*/
SQL_SERVER("Microsoft SQL Server");
private final String type;
public static DataBaseType find(String databaseProductName) {
if (StringUtils.isBlank(databaseProductName)) {
return null;
}
for (DataBaseType type : values()) {
if (type.getType().equals(databaseProductName)) {
return type;
}
}
return null;
}
}

View File

@@ -49,4 +49,4 @@ public class GlobalException extends RuntimeException {
this.message = message;
return this;
}
}
}

View File

@@ -62,4 +62,4 @@ public final class ServiceException extends RuntimeException {
this.detailMessage = detailMessage;
return this;
}
}
}

View File

@@ -0,0 +1,70 @@
package com.ruoyi.common.helper;
import cn.hutool.core.convert.Convert;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.ruoyi.common.enums.DataBaseType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.spring.SpringUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import javax.sql.DataSource;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
/**
* 数据库助手
*
* @author Lion Li
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DataBaseHelper {
/**
* 获取当前数据库类型
*/
public static DataBaseType getDataBaseType() {
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) SpringUtils.getBean(DataSource.class);
DataSource dataSource = ds.determineDataSource();
try {
DatabaseMetaData metaData = dataSource.getConnection().getMetaData();
String databaseProductName = metaData.getDatabaseProductName();
return DataBaseType.find(databaseProductName);
} catch (SQLException e) {
throw new ServiceException(e.getMessage());
}
}
public static boolean isMySql() {
return DataBaseType.MY_SQL == getDataBaseType();
}
public static boolean isOracle() {
return DataBaseType.ORACLE == getDataBaseType();
}
public static boolean isPostgerSql() {
return DataBaseType.POSTGRE_SQL == getDataBaseType();
}
public static boolean isSqlServer() {
return DataBaseType.SQL_SERVER == getDataBaseType();
}
public static String findInSet(Object var1, String var2) {
DataBaseType dataBasyType = getDataBaseType();
String var = Convert.toStr(var1);
if (dataBasyType == DataBaseType.SQL_SERVER) {
// charindex(',100,' , ',0,100,101,') <> 0
return "charindex('," + var + ",' , ','+" + var2 + "+',') <> 0";
} else if (dataBasyType == DataBaseType.POSTGRE_SQL) {
// (select position(',100,' in ',0,100,101,')) <> 0
return "(select position('," + var + ",' in ','||" + var2 + "||',')) <> 0";
} else if (dataBasyType == DataBaseType.ORACLE) {
// instr(',0,100,101,' , ',100,') <> 0
return "instr(','||" + var2 + "||',' , '," + var + ",') <> 0";
}
// find_in_set(100 , '0,100,101')
return "find_in_set(" + var + " , " + var2 + ") <> 0";
}
}

View File

@@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
/**
* 登录鉴权助手
*
*
* user_type 为 用户类型 同一个用户表 可以有多种用户类型 例如 pc,app
* deivce 为 设备类型 同一个用户类型 可以有 多种设备类型 例如 web,ios
* 可以组成 用户类型与设备类型多对多的 权限灵活控制