1. 调整忘了
This commit is contained in:
parent
45e5e2bc49
commit
e9328b4542
|
|
@ -27,6 +27,11 @@
|
||||||
<artifactId>chushang-common-core</artifactId>
|
<artifactId>chushang-common-core</artifactId>
|
||||||
<version>${common.version}</version>
|
<version>${common.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-data-scope</artifactId>
|
||||||
|
<version>${common.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
<artifactId>chushang-common-easy-es</artifactId>
|
<artifactId>chushang-common-easy-es</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,6 @@ public interface CommonConstants {
|
||||||
*/
|
*/
|
||||||
String TRACE_ID = "traceId";
|
String TRACE_ID = "traceId";
|
||||||
String SPAN = "span";
|
String SPAN = "span";
|
||||||
|
String START_TIME = "startTime";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,10 @@ public interface SecurityConstants {
|
||||||
* 角色权限
|
* 角色权限
|
||||||
*/
|
*/
|
||||||
String ROLE_PERMISSION = "role_permission";
|
String ROLE_PERMISSION = "role_permission";
|
||||||
|
/**
|
||||||
|
* 租户字段
|
||||||
|
*/
|
||||||
|
String TENANT_ID = "tenant_id";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,4 +120,20 @@ public class JwtUtils
|
||||||
{
|
{
|
||||||
return Convert.toStr(claims.get(key), "");
|
return Convert.toStr(claims.get(key), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getTenantId(Claims claims) {
|
||||||
|
return getValue(claims, SecurityConstants.TENANT_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据令牌获取用户ID
|
||||||
|
*
|
||||||
|
* @param token 令牌
|
||||||
|
* @return 用户ID
|
||||||
|
*/
|
||||||
|
public static String getTenantId(String token)
|
||||||
|
{
|
||||||
|
Claims claims = parseToken(token);
|
||||||
|
return getValue(claims, SecurityConstants.TENANT_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package com.chushang.common.core.web;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -28,6 +29,8 @@ import java.util.Map;
|
||||||
*
|
*
|
||||||
* @author lengleng
|
* @author lengleng
|
||||||
*/
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
@ToString
|
@ToString
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
@ -39,18 +42,13 @@ public class Result<T> implements Serializable {
|
||||||
public static final int FAIL_CODE = 500;
|
public static final int FAIL_CODE = 500;
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private int code;
|
private int code;
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private String msg;
|
private String msg;
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private T data;
|
private T data;
|
||||||
|
|
||||||
public static Result<Map<String, Object>> putAll(Map<String, Object> params) {
|
public static Result<Map<String, Object>> putAll(Map<String, Object> params) {
|
||||||
|
|
@ -132,4 +130,8 @@ public class Result<T> implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return SUCCESS_CODE == this.code;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>chushang-common</artifactId>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>chushang-common-data-scope</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.chushang.system.annotation;
|
package com.chushang.datascope.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package com.chushang.system.aspect;
|
package com.chushang.datascope.aspect;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.chushang.common.core.exception.ResultException;
|
||||||
import com.chushang.common.core.text.Convert;
|
import com.chushang.common.core.text.Convert;
|
||||||
import com.chushang.common.mybatis.page.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import com.chushang.common.core.util.StringUtils;
|
import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.mybatis.base.BaseEntity;
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import com.chushang.datascope.annotation.DataScope;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import com.chushang.security.context.SecurityContextHolder;
|
import com.chushang.security.context.SecurityContextHolder;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.annotation.DataScope;
|
|
||||||
import com.chushang.system.entity.po.SysRole;
|
|
||||||
import com.chushang.system.entity.po.SysUser;
|
|
||||||
import com.chushang.security.entity.vo.LoginUser;
|
import com.chushang.security.entity.vo.LoginUser;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
|
@ -20,6 +20,7 @@ import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -33,32 +34,31 @@ public class DataScopeAspect {
|
||||||
* 数据权限过滤关键字
|
* 数据权限过滤关键字
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE = "dataScope";
|
public static final String DATA_SCOPE = "dataScope";
|
||||||
|
/**
|
||||||
|
* 部门角色权限过滤
|
||||||
|
*/
|
||||||
public static final String ROLE_SCOPE = "roleScope";
|
public static final String ROLE_SCOPE = "roleScope";
|
||||||
/**
|
/**
|
||||||
* 全部数据权限
|
* 全部数据权限
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE_ALL = "1";
|
public static final String DATA_SCOPE_ALL = "1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定数据权限
|
* 自定数据权限
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE_CUSTOM = "2";
|
public static final String DATA_SCOPE_CUSTOM = "2";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门数据权限
|
* 部门数据权限
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE_DEPT = "3";
|
public static final String DATA_SCOPE_DEPT = "3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门及以下数据权限
|
* 部门及以下数据权限
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
|
public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仅本人数据权限
|
* 仅本人数据权限
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE_SELF = "5";
|
public static final String DATA_SCOPE_SELF = "5";
|
||||||
@Pointcut("@annotation(com.chushang.system.annotation.DataScope)")
|
@Pointcut("@annotation(com.chushang.datascope.annotation.DataScope)")
|
||||||
public void dataScopePointCut() {
|
public void dataScopePointCut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,13 +73,12 @@ public class DataScopeAspect {
|
||||||
|
|
||||||
protected void handleDataScope(final JoinPoint joinPoint) {
|
protected void handleDataScope(final JoinPoint joinPoint) {
|
||||||
// 获取当前的用户
|
// 获取当前的用户
|
||||||
LoginUser<SysUser> loginUser = SecurityUtils.getLoginUser();
|
LoginUser<?,DataScopeEntity> loginUser = SecurityUtils.getLoginUser();
|
||||||
if (StringUtils.isNotNull(loginUser)) {
|
if (StringUtils.isNotNull(loginUser)) {
|
||||||
SysUser currentUser = loginUser.getSysUser();
|
List<DataScopeEntity> scopes = loginUser.getScopes();
|
||||||
|
Long userId = loginUser.getUserId();
|
||||||
// 如果是超级管理员,则不过滤数据
|
// 如果是超级管理员,则不过滤数据
|
||||||
if (StringUtils.isNotNull(currentUser)
|
if (!SecurityUtils.isAdmin())
|
||||||
&& !currentUser.isAdmin()
|
|
||||||
&& !SecurityUtils.isAdmin())
|
|
||||||
{
|
{
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
|
|
@ -87,8 +86,8 @@ public class DataScopeAspect {
|
||||||
method.getAnnotation(DataScope.class);
|
method.getAnnotation(DataScope.class);
|
||||||
String permission = StringUtils.defaultIfEmpty(dataScope.permission(),
|
String permission = StringUtils.defaultIfEmpty(dataScope.permission(),
|
||||||
SecurityContextHolder.getPermission());
|
SecurityContextHolder.getPermission());
|
||||||
dataScopeFilter(joinPoint, currentUser, dataScope.deptAlias(),
|
dataScopeFilter(joinPoint, scopes, dataScope.deptAlias(),
|
||||||
dataScope.userAlias(), permission);
|
dataScope.userAlias(), permission, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -96,22 +95,23 @@ public class DataScopeAspect {
|
||||||
/**
|
/**
|
||||||
* 数据范围过滤
|
* 数据范围过滤
|
||||||
*
|
*
|
||||||
* @param joinPoint 切点
|
* @param joinPoint 切点
|
||||||
* @param user 用户
|
* @param dataScopes 用户角色数据权限
|
||||||
* @param deptAlias 部门别名
|
* @param deptAlias 部门别名
|
||||||
* @param userAlias 用户别名
|
* @param userAlias 用户别名
|
||||||
|
* @param userId 用户id
|
||||||
*/
|
*/
|
||||||
public void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission) {
|
public void dataScopeFilter(JoinPoint joinPoint, List<DataScopeEntity> dataScopes, String deptAlias, String userAlias, String permission, Long userId) {
|
||||||
StringBuilder dataScopeSqlString = new StringBuilder();
|
StringBuilder dataScopeSqlString = new StringBuilder();
|
||||||
// 根据部门过滤role 显示
|
// 根据部门过滤role 显示
|
||||||
StringBuilder roleSqlString = new StringBuilder();
|
StringBuilder roleSqlString = new StringBuilder();
|
||||||
List<String> conditions = new ArrayList<>();
|
List<String> conditions = new ArrayList<>();
|
||||||
for (SysRole role : user.getRoles()) {
|
for (DataScopeEntity scope : dataScopes) {
|
||||||
String dataScope = role.getDataScope();
|
String dataScope = scope.getScope();
|
||||||
|
Set<String> permissions = scope.getPermissions();
|
||||||
if (!DATA_SCOPE_CUSTOM.equals(dataScope) && conditions.contains(dataScope)) {
|
if (!DATA_SCOPE_CUSTOM.equals(dataScope) && conditions.contains(dataScope)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Set<String> permissions = role.getPermissions();
|
|
||||||
if (StringUtils.isNotEmpty(permission) && CollectionUtil.isNotEmpty(permissions)
|
if (StringUtils.isNotEmpty(permission) && CollectionUtil.isNotEmpty(permissions)
|
||||||
&& !CollectionUtil.containsAny(permissions, Convert.toList(permission))) {
|
&& !CollectionUtil.containsAny(permissions, Convert.toList(permission))) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -122,41 +122,31 @@ public class DataScopeAspect {
|
||||||
} else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
|
} else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
|
||||||
dataScopeSqlString.append(StringUtils.format(
|
dataScopeSqlString.append(StringUtils.format(
|
||||||
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
|
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
|
||||||
role.getRoleId()));
|
scope.getRoleId()));
|
||||||
} else if (DATA_SCOPE_DEPT.equals(dataScope)) {
|
} else if (DATA_SCOPE_DEPT.equals(dataScope)) {
|
||||||
dataScopeSqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
|
dataScopeSqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, scope.getDeptId()));
|
||||||
|
|
||||||
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
|
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
|
||||||
dataScopeSqlString.append(StringUtils.format(
|
dataScopeSqlString.append(StringUtils.format(
|
||||||
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
|
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
|
||||||
deptAlias, user.getDeptId(), user.getDeptId()));
|
deptAlias, scope.getDeptId(), scope.getDeptId()));
|
||||||
// 当且仅当用在角色列表页面, 并且角色为 部门及以下
|
// 当且仅当用在角色列表页面, 并且角色为 部门及以下
|
||||||
roleSqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} OR find_in_set( {}, ancestors ) ) ",
|
roleSqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} OR find_in_set( {}, ancestors ) ) ",
|
||||||
"r", user.getDeptId(), user.getDeptId()));
|
"r", scope.getDeptId(), scope.getDeptId()));
|
||||||
} else if (DATA_SCOPE_SELF.equals(dataScope)) {
|
} else if (DATA_SCOPE_SELF.equals(dataScope)) {
|
||||||
if (StringUtils.isNotBlank(userAlias)) {
|
if (StringUtils.isNotBlank(userAlias)) {
|
||||||
dataScopeSqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
|
dataScopeSqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, userId));
|
||||||
} else {
|
} else {
|
||||||
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
||||||
dataScopeSqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
|
dataScopeSqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, scope.getDeptId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conditions.add(dataScope);
|
conditions.add(dataScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(dataScopeSqlString.toString())) {
|
if (StringUtils.isNotBlank(dataScopeSqlString.toString())) {
|
||||||
Object params = joinPoint.getArgs()[0];
|
|
||||||
String v = " AND (" + dataScopeSqlString.substring(4) + ")";
|
String v = " AND (" + dataScopeSqlString.substring(4) + ")";
|
||||||
Map<String, Object> sqlParam;
|
Map<String, Object> sqlParam = getSqlParam(joinPoint);
|
||||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
if (null == sqlParam) return;
|
||||||
BaseEntity baseEntity = (BaseEntity) params;
|
|
||||||
sqlParam = baseEntity.getSqlParam();
|
|
||||||
} else if (StringUtils.isNotNull(params) && params instanceof CommonParam) {
|
|
||||||
CommonParam commonParam = (CommonParam) params;
|
|
||||||
sqlParam = commonParam.getSqlParam();
|
|
||||||
}else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sqlParam.put(DATA_SCOPE, v);
|
sqlParam.put(DATA_SCOPE, v);
|
||||||
sqlParam.put(ROLE_SCOPE, roleSqlString.toString());
|
sqlParam.put(ROLE_SCOPE, roleSqlString.toString());
|
||||||
}
|
}
|
||||||
|
|
@ -166,6 +156,13 @@ public class DataScopeAspect {
|
||||||
* 拼接权限sql前先清空params.dataScope参数防止注入
|
* 拼接权限sql前先清空params.dataScope参数防止注入
|
||||||
*/
|
*/
|
||||||
private void clearDataScope(final JoinPoint joinPoint) {
|
private void clearDataScope(final JoinPoint joinPoint) {
|
||||||
|
Map<String, Object> sqlParam = getSqlParam(joinPoint);
|
||||||
|
if (null == sqlParam) return;
|
||||||
|
sqlParam.put(DATA_SCOPE, "");
|
||||||
|
sqlParam.put(ROLE_SCOPE, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> getSqlParam(final JoinPoint joinPoint){
|
||||||
Object params = joinPoint.getArgs()[0];
|
Object params = joinPoint.getArgs()[0];
|
||||||
Map<String, Object> sqlParam;
|
Map<String, Object> sqlParam;
|
||||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
||||||
|
|
@ -175,9 +172,8 @@ public class DataScopeAspect {
|
||||||
CommonParam commonParam = (CommonParam) params;
|
CommonParam commonParam = (CommonParam) params;
|
||||||
sqlParam = commonParam.getSqlParam();
|
sqlParam = commonParam.getSqlParam();
|
||||||
}else {
|
}else {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
sqlParam.put(DATA_SCOPE, "");
|
return sqlParam;
|
||||||
sqlParam.put(ROLE_SCOPE, "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.chushang.datascope.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限临时表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class DataScopeEntity{
|
||||||
|
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private String scope;
|
||||||
|
|
||||||
|
private Set<String> permissions;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
|
|
@ -8,8 +8,11 @@
|
||||||
|
|
||||||
package com.chushang.common.log.aspect;
|
package com.chushang.common.log.aspect;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.URLUtil;
|
import cn.hutool.core.util.URLUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.chushang.common.core.constant.CommonConstants;
|
||||||
import com.chushang.common.core.exception.ResultException;
|
import com.chushang.common.core.exception.ResultException;
|
||||||
import com.chushang.common.core.jackson.JacksonUtils;
|
import com.chushang.common.core.jackson.JacksonUtils;
|
||||||
import com.chushang.common.core.util.IPUtils;
|
import com.chushang.common.core.util.IPUtils;
|
||||||
|
|
@ -32,12 +35,16 @@ import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -74,7 +81,7 @@ public class SysLogAspect {
|
||||||
//执行时长(毫秒)
|
//执行时长(毫秒)
|
||||||
long time = System.currentTimeMillis() - beginTime;
|
long time = System.currentTimeMillis() - beginTime;
|
||||||
//保存日志
|
//保存日志
|
||||||
saveSysLog(point, time, LogTypeEnum.NORMAL, null);
|
saveSysLog(point, LogTypeEnum.NORMAL, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -88,11 +95,10 @@ public class SysLogAspect {
|
||||||
long beginTime = System.currentTimeMillis();
|
long beginTime = System.currentTimeMillis();
|
||||||
//执行时长(毫秒)
|
//执行时长(毫秒)
|
||||||
long time = System.currentTimeMillis() - beginTime;
|
long time = System.currentTimeMillis() - beginTime;
|
||||||
|
saveSysLog(joinPoint,LogTypeEnum.ERROR, ex.getMessage());
|
||||||
saveSysLog(joinPoint, time, LogTypeEnum.ERROR, ex.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveSysLog(JoinPoint joinPoint, long time, LogTypeEnum type, String ex) {
|
private void saveSysLog(JoinPoint joinPoint,LogTypeEnum type, String ex) {
|
||||||
try {
|
try {
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
|
|
@ -115,7 +121,7 @@ public class SysLogAspect {
|
||||||
// 将导出的response 过滤掉
|
// 将导出的response 过滤掉
|
||||||
List<Object> argList =
|
List<Object> argList =
|
||||||
Arrays.stream(args)
|
Arrays.stream(args)
|
||||||
.filter(arg -> !(arg instanceof HttpServletResponse) && !(arg instanceof HttpServletRequest))
|
.filter(arg -> !(arg instanceof MultipartFile) && !(arg instanceof HttpServletResponse) && !(arg instanceof HttpServletRequest))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
sysLogEntity.setParams(JacksonUtils.toJSONString(argList));
|
sysLogEntity.setParams(JacksonUtils.toJSONString(argList));
|
||||||
}
|
}
|
||||||
|
|
@ -131,14 +137,20 @@ public class SysLogAspect {
|
||||||
//设置IP地址
|
//设置IP地址
|
||||||
sysLogEntity.setRemoteAddr(ipAddr);
|
sysLogEntity.setRemoteAddr(ipAddr);
|
||||||
// 请求uri
|
// 请求uri
|
||||||
sysLogEntity.setRequestUri(URLUtil.getPath(request.getRequestURI()));
|
String uri = URLUtil.getPath(request.getRequestURI());
|
||||||
|
sysLogEntity.setRequestUri(uri);
|
||||||
// 请求代理
|
// 请求代理
|
||||||
sysLogEntity.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
sysLogEntity.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
||||||
|
assert StrUtil.isNotEmpty(uri);
|
||||||
|
String[] split = uri.split("/");
|
||||||
|
if (split.length > 0 ){
|
||||||
|
sysLogEntity.setApplicationName(split[1]);
|
||||||
|
}
|
||||||
|
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
// 请求账号信息
|
// 请求账号信息
|
||||||
if (null != loginUser) {
|
if (null != loginUser) {
|
||||||
Integer userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
//用户名
|
//用户名
|
||||||
sysLogEntity.setUserId(userId);
|
sysLogEntity.setUserId(userId);
|
||||||
String username = loginUser.getUsername();
|
String username = loginUser.getUsername();
|
||||||
|
|
@ -148,14 +160,16 @@ public class SysLogAspect {
|
||||||
if (!ipAddr.equals("localhost") && !ipAddr.equals("127.0.0.1")) {
|
if (!ipAddr.equals("localhost") && !ipAddr.equals("127.0.0.1")) {
|
||||||
throw new ResultException("没有权限");
|
throw new ResultException("没有权限");
|
||||||
}
|
}
|
||||||
sysLogEntity.setUserId(1);
|
sysLogEntity.setUserId(1L);
|
||||||
sysLogEntity.setUsername("error");
|
sysLogEntity.setUsername("error");
|
||||||
}
|
}
|
||||||
|
String startTime = request.getHeader(CommonConstants.START_TIME);
|
||||||
// 执行时间
|
// 执行时间
|
||||||
sysLogEntity.setTime(time);
|
sysLogEntity.setTime(startTime != null ? System.currentTimeMillis() - Convert.toLong(startTime) : null);
|
||||||
// 日志类型
|
// 日志类型
|
||||||
sysLogEntity.setType(type);
|
sysLogEntity.setType(type);
|
||||||
sysLogEntity.setException(ex);
|
sysLogEntity.setException(ex);
|
||||||
|
assert syslog != null;
|
||||||
if (syslog.isDatabase()){
|
if (syslog.isDatabase()){
|
||||||
sysLogService.save(sysLogEntity);
|
sysLogService.save(sysLogEntity);
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -167,6 +181,4 @@ public class SysLogAspect {
|
||||||
log.error("uri : {}, save log error", URLUtil.getPath(request.getRequestURI()), e);
|
log.error("uri : {}, save log error", URLUtil.getPath(request.getRequestURI()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.chushang.common.log.constant;
|
||||||
|
|
||||||
|
public interface LogApplicationName {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统
|
||||||
|
*/
|
||||||
|
String SYSTEM = "system-service";
|
||||||
|
/**
|
||||||
|
* 文件
|
||||||
|
*/
|
||||||
|
String OSS = "oss-service";
|
||||||
|
/**
|
||||||
|
* 后台任务
|
||||||
|
*/
|
||||||
|
String TASK = "task-service";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ public class SysLogEntity {
|
||||||
* 操作用户id
|
* 操作用户id
|
||||||
*/
|
*/
|
||||||
@TableField(value = "user_id")
|
@TableField(value = "user_id")
|
||||||
private Integer userId;
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
* 操作用户账号
|
* 操作用户账号
|
||||||
*/
|
*/
|
||||||
|
|
@ -109,4 +109,13 @@ public class SysLogEntity {
|
||||||
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
|
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
|
||||||
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
|
@JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
/**
|
||||||
|
* 服务名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "application_name")
|
||||||
|
private String applicationName;
|
||||||
|
/**
|
||||||
|
* 部门id -- 根据部门划分不同的数据?
|
||||||
|
*/
|
||||||
|
private Integer deptId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* by zhaowenyuan create 2022/5/20 19:09
|
* by zhaowenyuan create 2022/5/20 19:09
|
||||||
*/
|
*/
|
||||||
|
|
@ -11,7 +13,13 @@ import lombok.EqualsAndHashCode;
|
||||||
@Data
|
@Data
|
||||||
public class ListLogDTO extends CommonParam {
|
public class ListLogDTO extends CommonParam {
|
||||||
|
|
||||||
private String title;
|
private String remoteAddr;
|
||||||
private String operType;
|
private String operation;
|
||||||
|
private String username;
|
||||||
|
private String businessType;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private LocalDateTime beginTime;
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
package com.chushang.common.log.mapper;
|
package com.chushang.common.log.entity.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.chushang.common.log.entity.SysLogEntity;
|
import com.chushang.common.log.entity.SysLogEntity;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
|
|
||||||
public interface SysLogMapper extends BaseMapper<SysLogEntity> {
|
public interface SysLogMapper extends BaseMapper<SysLogEntity> {
|
||||||
|
|
||||||
|
@Delete("TRUNCATE TABLE sys_log")
|
||||||
|
void cleanLog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +60,7 @@ public enum BusinessType
|
||||||
/**
|
/**
|
||||||
* 清空数据
|
* 清空数据
|
||||||
*/
|
*/
|
||||||
CLEAN(10,"清空数据"),
|
CLEAR(10,"清空数据"),
|
||||||
;
|
;
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
package com.chushang.common.log.service;
|
package com.chushang.common.log.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chushang.common.core.web.EnumUtils;
|
||||||
import com.chushang.common.log.entity.SysLogEntity;
|
import com.chushang.common.log.entity.SysLogEntity;
|
||||||
import com.chushang.common.log.entity.dto.ListLogDTO;
|
import com.chushang.common.log.entity.dto.ListLogDTO;
|
||||||
|
import com.chushang.common.log.enums.LogTypeEnum;
|
||||||
import com.chushang.common.mybatis.utils.PageResult;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
|
@ -16,17 +19,31 @@ import java.util.Arrays;
|
||||||
public interface SysLogService extends IService<SysLogEntity> {
|
public interface SysLogService extends IService<SysLogEntity> {
|
||||||
|
|
||||||
default PageResult queryPage(ListLogDTO params){
|
default PageResult queryPage(ListLogDTO params){
|
||||||
String key = params.getTitle();
|
String operation = params.getOperation();
|
||||||
|
LambdaQueryWrapper<SysLogEntity> lambdaQueryWrapper = new QueryWrapper<SysLogEntity>()
|
||||||
|
.orderBy(true, "asc".equals(params.getIsAsc()), params.getOrderBy())
|
||||||
|
.lambda()
|
||||||
|
.eq(null != params.getType(), SysLogEntity::getType, EnumUtils.getByCode(params.getType(), LogTypeEnum.class))
|
||||||
|
.like(StringUtils.isNotBlank(operation), SysLogEntity::getOperation, operation)
|
||||||
|
.like(StringUtils.isNotEmpty(params.getRemoteAddr()), SysLogEntity::getRemoteAddr, params.getRemoteAddr())
|
||||||
|
.like(StringUtils.isNotEmpty(params.getUsername()), SysLogEntity::getUsername, params.getUsername())
|
||||||
|
;
|
||||||
|
if (StringUtils.isNotEmpty(params.getBusinessType())){
|
||||||
|
lambdaQueryWrapper.in(SysLogEntity::getOperationType, Arrays.asList(params.getBusinessType().split(",")));
|
||||||
|
}
|
||||||
|
if (null != params.getBeginTime() && null != params.getEndTime()){
|
||||||
|
lambdaQueryWrapper.between(SysLogEntity::getCreateTime,params.getBeginTime(), params.getEndTime());
|
||||||
|
}else if (null != params.getBeginTime()){
|
||||||
|
lambdaQueryWrapper.ge(SysLogEntity::getCreateTime, params.getBeginTime());
|
||||||
|
}else if (null != params.getEndTime()){
|
||||||
|
lambdaQueryWrapper.le(SysLogEntity::getCreateTime, params.getEndTime());
|
||||||
|
}
|
||||||
|
|
||||||
IPage<SysLogEntity> page = this.page(
|
IPage<SysLogEntity> page = this.page(
|
||||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(params.getPage(), params.getLimit()),
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(params.getPage(), params.getLimit()),lambdaQueryWrapper
|
||||||
new QueryWrapper<SysLogEntity>()
|
|
||||||
.orderBy(true, "asc".equals(params.getIsAsc()), params.getOrderBy())
|
|
||||||
.lambda()
|
|
||||||
.like(StringUtils.isNotBlank(key),SysLogEntity::getUsername, key)
|
|
||||||
.or()
|
|
||||||
.like(StringUtils.isNotEmpty(key), SysLogEntity::getOperation, key)
|
|
||||||
.in(StringUtils.isNotEmpty(params.getOperType()), SysLogEntity::getOperationType, Arrays.asList(params.getOperType().split(",")))
|
|
||||||
);
|
);
|
||||||
return new PageResult(page);
|
return new PageResult(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cleanLog();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.chushang.common.log.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.chushang.common.log.entity.SysLogEntity;
|
import com.chushang.common.log.entity.SysLogEntity;
|
||||||
import com.chushang.common.log.mapper.SysLogMapper;
|
import com.chushang.common.log.entity.mapper.SysLogMapper;
|
||||||
import com.chushang.common.log.service.SysLogService;
|
import com.chushang.common.log.service.SysLogService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -13,4 +13,8 @@ import org.springframework.stereotype.Service;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLogEntity> implements SysLogService {
|
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLogEntity> implements SysLogService {
|
||||||
|
@Override
|
||||||
|
public void cleanLog() {
|
||||||
|
baseMapper.cleanLog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,23 @@
|
||||||
package com.chushang.common.mybatis;
|
package com.chushang.common.mybatis;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.DbType;
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
||||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
|
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||||
|
import com.chushang.common.core.constant.SecurityConstants;
|
||||||
|
import com.chushang.common.core.util.ServletUtils;
|
||||||
|
import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.mybatis.config.MybatisPlusMapperRefresh;
|
import com.chushang.common.mybatis.config.MybatisPlusMapperRefresh;
|
||||||
import com.chushang.common.mybatis.config.MybatisPlusMetaObjectHandler;
|
import com.chushang.common.mybatis.config.MybatisPlusMetaObjectHandler;
|
||||||
import com.chushang.common.mybatis.resolver.SqlFilterArgumentResolver;
|
import com.chushang.common.mybatis.resolver.SqlFilterArgumentResolver;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
|
import net.sf.jsqlparser.expression.LongValue;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -36,10 +45,8 @@ import org.springframework.core.io.Resource;
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lengleng
|
* @author lengleng
|
||||||
|
|
@ -47,6 +54,7 @@ import java.util.Set;
|
||||||
* <p>
|
* <p>
|
||||||
* mybatis plus 统一配置
|
* mybatis plus 统一配置
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@MapperScan({"com.chushang.**.mapper"})
|
@MapperScan({"com.chushang.**.mapper"})
|
||||||
public class MybatisAutoConfiguration implements WebMvcConfigurer {
|
public class MybatisAutoConfiguration implements WebMvcConfigurer {
|
||||||
|
|
@ -72,6 +80,27 @@ public class MybatisAutoConfiguration implements WebMvcConfigurer {
|
||||||
@Bean
|
@Bean
|
||||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
/**
|
||||||
|
* 新多租户插件配置,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存万一出现问题
|
||||||
|
*/
|
||||||
|
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new TenantLineHandler() {
|
||||||
|
@Override
|
||||||
|
public Expression getTenantId() {
|
||||||
|
String tenantId = ServletUtils.getRequest().getHeader(SecurityConstants.TENANT_ID);
|
||||||
|
// 租户id, 应当就是其
|
||||||
|
return new LongValue(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 这是 default 方法,默认返回 false 表示所有表都需要拼多租户条件
|
||||||
|
@Override
|
||||||
|
public boolean ignoreTable(String tableName) {
|
||||||
|
log.info("tableName {}", tableName);
|
||||||
|
String tenantId = ServletUtils.getRequest().getHeader(SecurityConstants.TENANT_ID);
|
||||||
|
// 租户id 为空不拼接租户, 否则拼接租户id
|
||||||
|
return StringUtils.isEmpty(tenantId);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
// 分页插件, 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
|
// 分页插件, 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
|
||||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
// 乐观锁
|
// 乐观锁
|
||||||
|
|
@ -88,6 +117,10 @@ public class MybatisAutoConfiguration implements WebMvcConfigurer {
|
||||||
return new MybatisPlusMetaObjectHandler();
|
return new MybatisPlusMetaObjectHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Bean
|
// @Bean
|
||||||
// public MybatisPlusMapperRefresh mybatisPlusMapperRefresh(ApplicationContext applicationContext, SqlSessionFactory sqlSessionFactory){
|
// public MybatisPlusMapperRefresh mybatisPlusMapperRefresh(ApplicationContext applicationContext, SqlSessionFactory sqlSessionFactory){
|
||||||
// Set<Resource> mapperLocations = new LinkedHashSet<>();
|
// Set<Resource> mapperLocations = new LinkedHashSet<>();
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,10 @@ public class InnerAuthAspect implements Ordered
|
||||||
|
|
||||||
String userid = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USER_ID);
|
String userid = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USER_ID);
|
||||||
String username = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USERNAME);
|
String username = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USERNAME);
|
||||||
|
// 设置租户id
|
||||||
|
String tenantId = ServletUtils.getRequest().getHeader(SecurityConstants.TENANT_ID);
|
||||||
// 用户信息验证
|
// 用户信息验证
|
||||||
if (innerAuth.isUser() && (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)))
|
if (innerAuth.isUser() && (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username) || StringUtils.isEmpty(tenantId)))
|
||||||
{
|
{
|
||||||
throw new InnerAuthException("没有设置用户信息,不允许访问 ");
|
throw new InnerAuthException("没有设置用户信息,不允许访问 ");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ public class SecurityContextHolder
|
||||||
THREAD_LOCAL.set(threadLocalMap);
|
THREAD_LOCAL.set(threadLocalMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getUserId()
|
public static Long getUserId()
|
||||||
{
|
{
|
||||||
return Convert.toInt(get(SecurityConstants.DETAILS_USER_ID), 0);
|
return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setUserId(String account)
|
public static void setUserId(String account)
|
||||||
|
|
@ -96,4 +96,11 @@ public class SecurityContextHolder
|
||||||
{
|
{
|
||||||
set(SecurityConstants.ROLE_PERMISSION, permissions);
|
set(SecurityConstants.ROLE_PERMISSION, permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setTenantId(String tenantId){
|
||||||
|
set(SecurityConstants.TENANT_ID, tenantId);
|
||||||
|
}
|
||||||
|
public static String getTenantId(){
|
||||||
|
return get(SecurityConstants.TENANT_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.chushang.security.entity.vo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -10,7 +11,7 @@ import java.util.Set;
|
||||||
* by zhaowenyuan create 2022/5/19 12:09
|
* by zhaowenyuan create 2022/5/19 12:09
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class LoginUser<T> implements Serializable
|
public class LoginUser<T, D> implements Serializable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
@ -22,7 +23,7 @@ public class LoginUser<T> implements Serializable
|
||||||
/**
|
/**
|
||||||
* 用户名id
|
* 用户名id
|
||||||
*/
|
*/
|
||||||
private Integer userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
|
|
@ -53,12 +54,18 @@ public class LoginUser<T> implements Serializable
|
||||||
* 角色对象
|
* 角色对象
|
||||||
*/
|
*/
|
||||||
private Set<String> roles;
|
private Set<String> roles;
|
||||||
|
/**
|
||||||
|
* 用户数据权限
|
||||||
|
*/
|
||||||
|
private List<D> scopes;
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*/
|
*/
|
||||||
private T sysUser;
|
private T sysUser;
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private Long tenantId;
|
||||||
/**
|
/**
|
||||||
* 当前用户对应的 数据权限
|
* 当前用户对应的 数据权限
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,11 @@ public class FeignRequestInterceptor implements RequestInterceptor
|
||||||
{
|
{
|
||||||
requestTemplate.header(SecurityConstants.AUTHORIZATION_HEADER, authentication);
|
requestTemplate.header(SecurityConstants.AUTHORIZATION_HEADER, authentication);
|
||||||
}
|
}
|
||||||
|
// 租户id
|
||||||
|
String tenantId = headers.get(SecurityConstants.TENANT_ID);
|
||||||
|
if (StringUtils.isNotEmpty(tenantId)){
|
||||||
|
requestTemplate.header(SecurityConstants.TENANT_ID, tenantId);
|
||||||
|
}
|
||||||
// 配置客户端IP
|
// 配置客户端IP
|
||||||
requestTemplate.header("X-Forwarded-For", IPUtils.clientIp(ServletUtils.getRequest()));
|
requestTemplate.header("X-Forwarded-For", IPUtils.clientIp(ServletUtils.getRequest()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public class HeaderInterceptor implements AsyncHandlerInterceptor
|
||||||
SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID));
|
SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID));
|
||||||
SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME));
|
SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME));
|
||||||
SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY));
|
SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY));
|
||||||
|
SecurityContextHolder.setTenantId(ServletUtils.getHeader(request, SecurityConstants.TENANT_ID));
|
||||||
|
|
||||||
String token = SecurityUtils.getToken();
|
String token = SecurityUtils.getToken();
|
||||||
if (StringUtils.isNotEmpty(token))
|
if (StringUtils.isNotEmpty(token))
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,9 @@ public class TokenService
|
||||||
public Map<String, Object> createToken(LoginUser loginUser)
|
public Map<String, Object> createToken(LoginUser loginUser)
|
||||||
{
|
{
|
||||||
String token = IdUtils.getId(31);
|
String token = IdUtils.getId(31);
|
||||||
Integer userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
String username = loginUser.getUsername();
|
String username = loginUser.getUsername();
|
||||||
|
Long tenantId = loginUser.getTenantId();
|
||||||
String tokenKey = token + "#" + userId;
|
String tokenKey = token + "#" + userId;
|
||||||
loginUser.setToken(tokenKey);
|
loginUser.setToken(tokenKey);
|
||||||
loginUser.setIpaddr(IPUtils.clientIp(ServletUtils.getRequest()));
|
loginUser.setIpaddr(IPUtils.clientIp(ServletUtils.getRequest()));
|
||||||
|
|
@ -55,6 +56,8 @@ public class TokenService
|
||||||
claimsMap.put(SecurityConstants.USER_KEY, tokenKey);
|
claimsMap.put(SecurityConstants.USER_KEY, tokenKey);
|
||||||
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
|
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
|
||||||
claimsMap.put(SecurityConstants.DETAILS_USERNAME, username);
|
claimsMap.put(SecurityConstants.DETAILS_USERNAME, username);
|
||||||
|
// 租户id
|
||||||
|
claimsMap.put(SecurityConstants.TENANT_ID, tenantId);
|
||||||
|
|
||||||
// 接口返回信息
|
// 接口返回信息
|
||||||
Map<String, Object> rspMap = new HashMap<>();
|
Map<String, Object> rspMap = new HashMap<>();
|
||||||
|
|
@ -186,7 +189,7 @@ public class TokenService
|
||||||
/**
|
/**
|
||||||
* 根据 用户ID 进行用户强退
|
* 根据 用户ID 进行用户强退
|
||||||
*/
|
*/
|
||||||
public void forcedRetreat(Integer userId){
|
public void forcedRetreat(Long userId){
|
||||||
RKeys rKeys = redissonClient.getKeys();
|
RKeys rKeys = redissonClient.getKeys();
|
||||||
long l = rKeys.deleteByPattern(CacheConstants.LOGIN_TOKEN_KEY + "*" + "#" + userId);
|
long l = rKeys.deleteByPattern(CacheConstants.LOGIN_TOKEN_KEY + "*" + "#" + userId);
|
||||||
if (log.isDebugEnabled()){
|
if (log.isDebugEnabled()){
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,15 @@ public class SecurityUtils<T>
|
||||||
/**
|
/**
|
||||||
* 获取用户ID
|
* 获取用户ID
|
||||||
*/
|
*/
|
||||||
public static Integer getUserId()
|
public static Long getUserId()
|
||||||
{
|
{
|
||||||
return SecurityContextHolder.getUserId();
|
return SecurityContextHolder.getUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAdmin(){
|
public static boolean isAdmin(){
|
||||||
Integer userId = SecurityContextHolder.getUserId();
|
Long userId = SecurityContextHolder.getUserId();
|
||||||
|
|
||||||
LoginUser<?> loginUser = getLoginUser();
|
LoginUser<?, ?> loginUser = getLoginUser();
|
||||||
Set<String> roles = loginUser.getRoles();
|
Set<String> roles = loginUser.getRoles();
|
||||||
// 包含 admin 的账号 或者 id == 1 的就是 admin -- 必须是 admin 的才是超管权限
|
// 包含 admin 的账号 或者 id == 1 的就是 admin -- 必须是 admin 的才是超管权限
|
||||||
boolean flag = roles.contains(AuthUtil.SUPER_ADMIN);
|
boolean flag = roles.contains(AuthUtil.SUPER_ADMIN);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<module>chushang-common-bom</module>
|
<module>chushang-common-bom</module>
|
||||||
<module>chushang-common-canal</module>
|
<module>chushang-common-canal</module>
|
||||||
<module>chushang-common-core</module>
|
<module>chushang-common-core</module>
|
||||||
|
<module>chushang-common-data-scope</module>
|
||||||
<module>chushang-common-easy-es</module>
|
<module>chushang-common-easy-es</module>
|
||||||
<module>chushang-common-excel</module>
|
<module>chushang-common-excel</module>
|
||||||
<module>chushang-common-feign</module>
|
<module>chushang-common-feign</module>
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@ import com.chushang.auth.service.UserService;
|
||||||
import com.chushang.common.core.util.JwtUtils;
|
import com.chushang.common.core.util.JwtUtils;
|
||||||
import com.chushang.common.core.util.StringUtils;
|
import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import com.chushang.security.auth.AuthUtil;
|
import com.chushang.security.auth.AuthUtil;
|
||||||
import com.chushang.security.service.TokenService;
|
import com.chushang.security.service.TokenService;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.entity.bo.LoginBody;
|
import com.chushang.system.entity.bo.LoginBody;
|
||||||
import com.chushang.security.entity.vo.LoginUser;
|
import com.chushang.security.entity.vo.LoginUser;
|
||||||
|
import com.chushang.system.entity.po.SysUser;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -33,7 +35,7 @@ public class UserController
|
||||||
public AjaxResult login(@RequestBody LoginBody form)
|
public AjaxResult login(@RequestBody LoginBody form)
|
||||||
{
|
{
|
||||||
// 用户登录
|
// 用户登录
|
||||||
LoginUser loginUser = userService.login(form.getUsername(), form.getPassword());
|
LoginUser<SysUser, DataScopeEntity> loginUser = userService.login(form.getUsername(), form.getPassword());
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
return AjaxResult.success(tokenService.createToken(loginUser));
|
return AjaxResult.success(tokenService.createToken(loginUser));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.chushang.common.core.exception.ResultException;
|
||||||
import com.chushang.common.core.util.IPUtils;
|
import com.chushang.common.core.util.IPUtils;
|
||||||
import com.chushang.common.core.util.ServletUtils;
|
import com.chushang.common.core.util.ServletUtils;
|
||||||
import com.chushang.common.core.web.Result;
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.entity.enums.LoginStatusEnum;
|
import com.chushang.system.entity.enums.LoginStatusEnum;
|
||||||
import com.chushang.system.entity.po.SysLoginInfo;
|
import com.chushang.system.entity.po.SysLoginInfo;
|
||||||
|
|
@ -33,11 +34,11 @@ public class UserService {
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*/
|
*/
|
||||||
public LoginUser<SysUser> login(String username, String password)
|
public LoginUser<SysUser, DataScopeEntity> login(String username, String password)
|
||||||
{
|
{
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
Result<LoginUser<SysUser>> rLoginUser = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
Result<LoginUser<SysUser, DataScopeEntity>> rLoginUser = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
log.info("time : {}",end - start);
|
log.info("time : {}",end - start);
|
||||||
if (Result.FAIL_CODE == rLoginUser.getCode()){
|
if (Result.FAIL_CODE == rLoginUser.getCode()){
|
||||||
|
|
@ -48,7 +49,7 @@ public class UserService {
|
||||||
recordLoginInfo(username, LoginStatusEnum.LOGIN_FAIL_STATUS, "登录用户不存在");
|
recordLoginInfo(username, LoginStatusEnum.LOGIN_FAIL_STATUS, "登录用户不存在");
|
||||||
throw new ResultException("登录用户:" + username + " 不存在");
|
throw new ResultException("登录用户:" + username + " 不存在");
|
||||||
}
|
}
|
||||||
LoginUser<SysUser> loginUser = rLoginUser.getData();
|
LoginUser<SysUser, DataScopeEntity> loginUser = rLoginUser.getData();
|
||||||
SysUser sysUser = loginUser.getSysUser();
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
Boolean status = sysUser.getStatus();
|
Boolean status = sysUser.getStatus();
|
||||||
if (!status)
|
if (!status)
|
||||||
|
|
@ -63,12 +64,16 @@ public class UserService {
|
||||||
throw new ResultException("用户不存在/密码错误");
|
throw new ResultException("用户不存在/密码错误");
|
||||||
}
|
}
|
||||||
recordLoginInfo(username, LoginStatusEnum.LOGIN_SUCCESS, "登录成功");
|
recordLoginInfo(username, LoginStatusEnum.LOGIN_SUCCESS, "登录成功");
|
||||||
sysUser.setPassword("");
|
|
||||||
sysUser.setSalt("");
|
|
||||||
loginUser.setSysUser(sysUser);
|
loginUser.setSysUser(sysUser);
|
||||||
|
loginUser.setTenantId(sysUser.getTenantId());
|
||||||
return loginUser;
|
return loginUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String s = SecurityUtils.encryptPassword("123456", "h2HheUVZmF");
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
|
||||||
public void logout(String username) {
|
public void logout(String username) {
|
||||||
recordLoginInfo(username, LoginStatusEnum.LOGOUT_SUCCESS, "退出成功");
|
recordLoginInfo(username, LoginStatusEnum.LOGOUT_SUCCESS, "退出成功");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ public class AuthFilter implements GlobalFilter, Ordered
|
||||||
}
|
}
|
||||||
String userid = JwtUtils.getUserId(claims);
|
String userid = JwtUtils.getUserId(claims);
|
||||||
String username = JwtUtils.getUserName(claims);
|
String username = JwtUtils.getUserName(claims);
|
||||||
|
String tenantId = JwtUtils.getTenantId(claims);
|
||||||
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username))
|
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username))
|
||||||
{
|
{
|
||||||
return unauthorizedResponse(exchange, "令牌验证失败");
|
return unauthorizedResponse(exchange, "令牌验证失败");
|
||||||
|
|
@ -93,6 +94,8 @@ public class AuthFilter implements GlobalFilter, Ordered
|
||||||
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
|
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
|
||||||
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
|
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
|
||||||
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
|
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
|
||||||
|
// 租户Id
|
||||||
|
addHeader(mutate, SecurityConstants.TENANT_ID, tenantId);
|
||||||
// 内部请求来源参数清除
|
// 内部请求来源参数清除
|
||||||
removeHeader(mutate);
|
removeHeader(mutate);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chushang.oss.entity;
|
package com.chushang.oss.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
@ -9,33 +10,68 @@ import java.time.LocalDateTime;
|
||||||
@Data
|
@Data
|
||||||
@TableName("tb_oss_source_info")
|
@TableName("tb_oss_source_info")
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class FileSourceInfo {
|
public class FileSourceInfo extends BaseEntity{
|
||||||
|
|
||||||
public FileSourceInfo(String fid) {
|
|
||||||
this.fid = fid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@TableId(value = "fid", type = IdType.INPUT)
|
@TableId(value = "fid", type = IdType.INPUT)
|
||||||
private String fid;
|
private String fid;
|
||||||
|
/**
|
||||||
|
* 文件原始名称
|
||||||
|
*/
|
||||||
@TableField("name")
|
@TableField("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
/**
|
||||||
|
* 文件类型
|
||||||
|
*/
|
||||||
@TableField("mime_type")
|
@TableField("mime_type")
|
||||||
private String mimeType;
|
private String mimeType;
|
||||||
|
/**
|
||||||
|
* 文件 所属类型
|
||||||
|
* 查看字典 sys_file_type
|
||||||
|
*/
|
||||||
|
@TableField("file_type")
|
||||||
|
private String fileType;
|
||||||
|
/**
|
||||||
|
* 文件大小
|
||||||
|
*/
|
||||||
@TableField("size")
|
@TableField("size")
|
||||||
private Long size;
|
private Long size;
|
||||||
|
/**
|
||||||
|
* 文件md5
|
||||||
|
*/
|
||||||
@TableField("md5")
|
@TableField("md5")
|
||||||
private String md5;
|
private String md5;
|
||||||
|
/**
|
||||||
|
* 文件存储路径
|
||||||
|
*/
|
||||||
@TableField("path")
|
@TableField("path")
|
||||||
private String path;
|
private String path;
|
||||||
|
/**
|
||||||
|
* 存储桶名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "bucket_name")
|
||||||
|
private String bucketName;
|
||||||
|
/**
|
||||||
|
* 真实路径 -- 携带http(s)
|
||||||
|
*/
|
||||||
@TableField("real_path")
|
@TableField("real_path")
|
||||||
private String realPath;
|
private String realPath;
|
||||||
|
/**
|
||||||
|
* 上传IP
|
||||||
|
*/
|
||||||
@TableField("upload_ip")
|
@TableField("upload_ip")
|
||||||
private String uploadIp;
|
private String uploadIp;
|
||||||
|
/**
|
||||||
|
* 文件存储域
|
||||||
|
*/
|
||||||
@TableField("storage_region")
|
@TableField("storage_region")
|
||||||
private String storageRegion;
|
private String storageRegion;
|
||||||
@TableField("if_del")
|
/**
|
||||||
private Integer ifDel;
|
* 创建人
|
||||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
*/
|
||||||
private LocalDateTime createTime;
|
@TableField(
|
||||||
|
value = "create_by",
|
||||||
|
updateStrategy = FieldStrategy.NEVER
|
||||||
|
)
|
||||||
|
protected String createBy;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.chushang.oss.entity.dto;
|
||||||
|
|
||||||
|
import com.chushang.oss.enums.OcrTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OcrDTO {
|
||||||
|
|
||||||
|
private String imgPath;
|
||||||
|
|
||||||
|
private OcrTypeEnum ocrType;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.chushang.oss.entity.vo;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FileSourceVo {
|
||||||
|
private String fid;
|
||||||
|
private String name;
|
||||||
|
private Long size;
|
||||||
|
private JSONObject ocr;
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String filePath;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.chushang.oss.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum OcrTypeEnum {
|
||||||
|
COMM("comm","文字识别"),
|
||||||
|
DRIVING("driving","行驶证"),
|
||||||
|
BANKCARD("bankcard","银行卡"),
|
||||||
|
BIZLICENSE("bizlicense","营业执照"),
|
||||||
|
DRIVINGLICENSE("drivinglicense","驾驶证"),
|
||||||
|
IDCARD("idcard","身份证"),
|
||||||
|
NONE("none","未知")
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static OcrTypeEnum findByCode(String code) {
|
||||||
|
for(OcrTypeEnum e:OcrTypeEnum.values()) {
|
||||||
|
if(e.getCode().equals(code)) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,10 @@
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
<artifactId>oss-feign</artifactId>
|
<artifactId>oss-feign</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.chushang.oss.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.oss.entity.dto.OcrDTO;
|
||||||
|
import com.chushang.oss.entity.vo.FileSourceVo;
|
||||||
|
import com.chushang.oss.enums.OcrTypeEnum;
|
||||||
|
import com.chushang.oss.service.FileSourceService;
|
||||||
|
import com.chushang.oss.service.OcrService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/file")
|
||||||
|
public class FileController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
FileSourceService fileSourceService;
|
||||||
|
@Resource
|
||||||
|
OcrService ocrService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* todo
|
||||||
|
*/
|
||||||
|
@SysLog(value = "文件上传", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping(value = "/upload")
|
||||||
|
public AjaxResult uploadFile(@RequestParam(value = "file") MultipartFile file,
|
||||||
|
@RequestParam(value = "ocrType", required = false) String ocrType) {
|
||||||
|
FileSourceVo vo = BeanUtil.copyProperties(fileSourceService.addFile(file, "ip"), FileSourceVo.class);
|
||||||
|
if (StrUtil.isNotEmpty(ocrType)) {
|
||||||
|
OcrDTO ocr = new OcrDTO();
|
||||||
|
OcrTypeEnum ocrTypeEnum = OcrTypeEnum.findByCode(ocrType);
|
||||||
|
if (ocrTypeEnum != OcrTypeEnum.NONE) {
|
||||||
|
ocr.setOcrType(ocrTypeEnum);
|
||||||
|
ocr.setImgPath(vo.getFilePath());
|
||||||
|
Result<JSONObject> ocrInfo = ocrService.ocr(ocr);
|
||||||
|
if (ocrInfo.isSuccess()) {
|
||||||
|
vo.setOcr(ocrInfo.getData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SysLog(value = "文件下载", businessType = BusinessType.OTHER)
|
||||||
|
@GetMapping(value = "/download/{fid}")
|
||||||
|
public AjaxResult downloadFile(@PathVariable String fid) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SysLog(value = "文件", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping(value = "/del/{fid}")
|
||||||
|
public AjaxResult delFile() {
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.chushang.oss.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chushang.oss.entity.FileSourceInfo;
|
||||||
|
import com.chushang.oss.mapper.FileSourceMapper;
|
||||||
|
import com.chushang.oss.service.OssService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @auther: zhao
|
||||||
|
* @date: 2024/4/29 10:25
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class FileSourceService
|
||||||
|
extends ServiceImpl<FileSourceMapper, FileSourceInfo>
|
||||||
|
implements IService<FileSourceInfo>
|
||||||
|
{
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OssService ossService;
|
||||||
|
|
||||||
|
|
||||||
|
public FileSourceInfo addFile(MultipartFile file, String ip) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.chushang.oss.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.oss.entity.dto.OcrDTO;
|
||||||
|
|
||||||
|
public interface OcrService {
|
||||||
|
Result<JSONObject> ocr(OcrDTO ocr);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.chushang.oss.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.oss.entity.dto.OcrDTO;
|
||||||
|
import com.chushang.oss.service.OcrService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("aliOcrService")
|
||||||
|
@ConditionalOnExpression("'${ocr.service}'.equals('ali')")
|
||||||
|
public class AliOcrServiceImpl implements OcrService {
|
||||||
|
@Override
|
||||||
|
public Result<JSONObject> ocr(OcrDTO ocr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,9 +6,12 @@ import com.aliyun.oss.OSSClientBuilder;
|
||||||
import com.aliyun.oss.model.DeleteObjectsRequest;
|
import com.aliyun.oss.model.DeleteObjectsRequest;
|
||||||
import com.aliyun.oss.model.DeleteObjectsResult;
|
import com.aliyun.oss.model.DeleteObjectsResult;
|
||||||
import com.aliyun.oss.model.Payer;
|
import com.aliyun.oss.model.Payer;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.chushang.common.core.exception.ResultException;
|
import com.chushang.common.core.exception.ResultException;
|
||||||
import com.chushang.common.core.util.StringUtils;
|
import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.oss.config.UploadConfig;
|
import com.chushang.oss.config.UploadConfig;
|
||||||
|
import com.chushang.oss.entity.FileSourceInfo;
|
||||||
|
import com.chushang.oss.mapper.FileSourceMapper;
|
||||||
import com.chushang.oss.service.OssService;
|
import com.chushang.oss.service.OssService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
|
|
@ -25,7 +28,7 @@ import java.util.List;
|
||||||
* 阿里云存储
|
* 阿里云存储
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service("aliOssService")
|
||||||
@ConditionalOnExpression("'${oss.storage}'.equals('ali')")
|
@ConditionalOnExpression("'${oss.storage}'.equals('ali')")
|
||||||
public class AliServiceImpl implements OssService {
|
public class AliServiceImpl implements OssService {
|
||||||
|
|
||||||
|
|
@ -33,7 +36,7 @@ public class AliServiceImpl implements OssService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UploadConfig config;
|
private UploadConfig config;
|
||||||
//
|
|
||||||
// public AliyunUploadStorageService(CloudProperties cloudProperties){
|
// public AliyunUploadStorageService(CloudProperties cloudProperties){
|
||||||
// this.config = (AliyunProperties) cloudProperties;
|
// this.config = (AliyunProperties) cloudProperties;
|
||||||
// //初始化
|
// //初始化
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package com.chushang.oss.service.impl;
|
|
||||||
|
|
||||||
import com.chushang.oss.service.OssService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @auther: zhao
|
|
||||||
* @date: 2024/4/29 10:25
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
public class FileSourceService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
OssService ossService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.chushang.oss.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.oss.entity.dto.OcrDTO;
|
||||||
|
import com.chushang.oss.service.OcrService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("wxOcrService")
|
||||||
|
@ConditionalOnExpression("'${ocr.service}'.equals('wx')")
|
||||||
|
public class WxOcrServiceImpl implements OcrService {
|
||||||
|
@Override
|
||||||
|
public Result<JSONObject> ocr(OcrDTO ocr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ server:
|
||||||
shutdown: graceful
|
shutdown: graceful
|
||||||
port: 8085
|
port: 8085
|
||||||
servlet:
|
servlet:
|
||||||
context-path: /cs/system
|
context-path: /oss
|
||||||
tomcat:
|
tomcat:
|
||||||
uri-encoding: UTF-8
|
uri-encoding: UTF-8
|
||||||
threads:
|
threads:
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,9 @@
|
||||||
<groupId>com.chushang</groupId>
|
<groupId>com.chushang</groupId>
|
||||||
<artifactId>chushang-common-excel</artifactId>
|
<artifactId>chushang-common-excel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chushang</groupId>
|
||||||
|
<artifactId>chushang-common-data-scope</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package com.chushang.system.entity.bo;
|
|
||||||
|
|
||||||
import com.chushang.system.entity.enums.AuthTypeEnum;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author by zhaowenyuan create 2022/8/24 10:27
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class DataAuth {
|
|
||||||
/**
|
|
||||||
* 用户Id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "user id is null")
|
|
||||||
private Integer userId;
|
|
||||||
/**
|
|
||||||
* 授权类型
|
|
||||||
*/
|
|
||||||
@NotNull(message = "auth type is null")
|
|
||||||
private AuthTypeEnum authType;
|
|
||||||
/**
|
|
||||||
* 授权数据
|
|
||||||
*/
|
|
||||||
private String authData;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -12,9 +12,9 @@ import javax.validation.constraints.NotNull;
|
||||||
public class RoleUser {
|
public class RoleUser {
|
||||||
|
|
||||||
@NotNull(message = "role id is null")
|
@NotNull(message = "role id is null")
|
||||||
private Integer roleId;
|
private Long roleId;
|
||||||
|
|
||||||
@NotNull(message = "user ids is null")
|
@NotNull(message = "user ids is null")
|
||||||
private Integer[] userIds;
|
private Long[] userIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ import lombok.EqualsAndHashCode;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ListDeptDTO extends CommonParam {
|
public class ListDeptDTO extends CommonParam {
|
||||||
|
|
||||||
private Integer deptId;
|
private Long deptId;
|
||||||
|
|
||||||
private Integer parentId;
|
private Long parentId;
|
||||||
|
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
package com.chushang.system.entity.enums;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
|
||||||
import com.chushang.common.core.web.EnumUtils;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author by zhaowenyuan create 2022/8/24 10:29
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum AuthTypeEnum implements EnumUtils.CodeEnum<String>, IEnum<Integer> {
|
|
||||||
APP(1, "appData","项目授权", " select id from sanyi_app "),
|
|
||||||
PLATFORM(2, "platformData","平台授权", " select id from sanyi_platform "),
|
|
||||||
/**
|
|
||||||
* 需要根据角色进行特殊处理的需求 --> 为false 代表不处理, true 时, 代表处理
|
|
||||||
*/
|
|
||||||
SPECIAL(3, "special", "特殊处理", "FALSE"),
|
|
||||||
;
|
|
||||||
|
|
||||||
@JsonValue
|
|
||||||
@EnumValue
|
|
||||||
private final Integer code;
|
|
||||||
private final String codeType;
|
|
||||||
private final String desc;
|
|
||||||
private final String sql;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMsg() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.io.Serial;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Setter
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
|
@ -31,7 +30,7 @@ public class SysConfig extends BaseEntity
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 参数主键 */
|
/** 参数主键 */
|
||||||
@TableId(value = "config_id", type = IdType.AUTO)
|
@TableId(value = "config_id", type = IdType.ASSIGN_ID)
|
||||||
@ExcelProperty(value = "参数主键", index = 0)
|
@ExcelProperty(value = "参数主键", index = 0)
|
||||||
private Long configId;
|
private Long configId;
|
||||||
|
|
||||||
|
|
@ -60,7 +59,7 @@ public class SysConfig extends BaseEntity
|
||||||
updateStrategy = FieldStrategy.NEVER
|
updateStrategy = FieldStrategy.NEVER
|
||||||
)
|
)
|
||||||
@ExcelProperty(value = "创建人", index = 5)
|
@ExcelProperty(value = "创建人", index = 5)
|
||||||
protected String createBy;
|
private String createBy;
|
||||||
/**
|
/**
|
||||||
* 修改人
|
* 修改人
|
||||||
*/
|
*/
|
||||||
|
|
@ -69,5 +68,11 @@ public class SysConfig extends BaseEntity
|
||||||
insertStrategy = FieldStrategy.NEVER
|
insertStrategy = FieldStrategy.NEVER
|
||||||
)
|
)
|
||||||
@ExcelProperty(value = "修改人", index = 6)
|
@ExcelProperty(value = "修改人", index = 6)
|
||||||
protected String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Id
|
||||||
|
*/
|
||||||
|
@TableField(value = "tenant_id")
|
||||||
|
private Long tenantId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@ public class SysDept extends BaseEntity
|
||||||
|
|
||||||
/** 部门ID */
|
/** 部门ID */
|
||||||
@TableId(value = "dept_id", type = IdType.AUTO)
|
@TableId(value = "dept_id", type = IdType.AUTO)
|
||||||
private Integer deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 父部门ID */
|
/** 父部门ID */
|
||||||
@TableField(value = "parent_dept_id")
|
@TableField(value = "parent_dept_id")
|
||||||
private Integer parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/** 祖级列表 */
|
/** 祖级列表 */
|
||||||
private String ancestors;
|
private String ancestors;
|
||||||
|
|
@ -63,7 +63,7 @@ public class SysDept extends BaseEntity
|
||||||
value = "create_by",
|
value = "create_by",
|
||||||
updateStrategy = FieldStrategy.NEVER
|
updateStrategy = FieldStrategy.NEVER
|
||||||
)
|
)
|
||||||
protected String createBy;
|
private String createBy;
|
||||||
/**
|
/**
|
||||||
* 修改人
|
* 修改人
|
||||||
*/
|
*/
|
||||||
|
|
@ -71,5 +71,11 @@ public class SysDept extends BaseEntity
|
||||||
value = "update_by",
|
value = "update_by",
|
||||||
insertStrategy = FieldStrategy.NEVER
|
insertStrategy = FieldStrategy.NEVER
|
||||||
)
|
)
|
||||||
protected String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Id
|
||||||
|
*/
|
||||||
|
@TableField(value = "tenant_id")
|
||||||
|
private Long tenantId;
|
||||||
}
|
}
|
||||||
|
|
@ -22,9 +22,9 @@ public class SysDictData extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 字典编码
|
* 字典编码
|
||||||
*/
|
*/
|
||||||
@TableId(value = "dict_code", type = IdType.AUTO)
|
@TableId(value = "dict_code", type = IdType.ASSIGN_ID)
|
||||||
@ExcelProperty(value = "字典编码", index = 0)
|
@ExcelProperty(value = "字典编码", index = 0)
|
||||||
private Integer dictCode;
|
private Long dictCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典排序
|
* 字典排序
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class SysDictType extends BaseEntity
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 字典主键 */
|
/** 字典主键 */
|
||||||
@TableId(value = "dict_id", type = IdType.AUTO)
|
@TableId(value = "dict_id", type = IdType.ASSIGN_ID)
|
||||||
@ExcelProperty(value = "字典主键", index = 0)
|
@ExcelProperty(value = "字典主键", index = 0)
|
||||||
private Long dictId;
|
private Long dictId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import java.time.LocalDateTime;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class SysLoginInfo extends BaseEntity {
|
public class SysLoginInfo extends BaseEntity {
|
||||||
|
|
||||||
@TableId(value = "info_id", type = IdType.AUTO)
|
@TableId(value = "info_id", type = IdType.ASSIGN_ID)
|
||||||
private Long infoId;
|
private Long infoId;
|
||||||
|
|
||||||
@TableField(value = "username")
|
@TableField(value = "username")
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ public class SysMenu extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 自增主键Id
|
* 自增主键Id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "menu_id", type = IdType.AUTO)
|
@TableId(value = "menu_id", type = IdType.ASSIGN_ID)
|
||||||
private Integer menuId;
|
private Long menuId;
|
||||||
/**
|
/**
|
||||||
* 菜单名称
|
* 菜单名称
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class SysPost extends BaseEntity
|
||||||
/** 岗位序号 */
|
/** 岗位序号 */
|
||||||
@TableId(value = "post_id", type = IdType.AUTO)
|
@TableId(value = "post_id", type = IdType.AUTO)
|
||||||
@ExcelProperty(value = "岗位序号", index = 0)
|
@ExcelProperty(value = "岗位序号", index = 0)
|
||||||
private Integer postId;
|
private Long postId;
|
||||||
|
|
||||||
/** 岗位编码 */
|
/** 岗位编码 */
|
||||||
@ExcelProperty(value = "岗位编码", index = 1)
|
@ExcelProperty(value = "岗位编码", index = 1)
|
||||||
|
|
@ -74,4 +74,9 @@ public class SysPost extends BaseEntity
|
||||||
/** 用户是否存在此岗位标识 默认不存在 */
|
/** 用户是否存在此岗位标识 默认不存在 */
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private boolean flag = false;
|
private boolean flag = false;
|
||||||
|
/**
|
||||||
|
* 不同 部门 岗位隔离
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态", index = 6)
|
||||||
|
private Long deptId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ public class SysRole extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 自增主键id
|
* 自增主键id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "role_id", type = IdType.AUTO)
|
@TableId(value = "role_id", type = IdType.ASSIGN_ID)
|
||||||
private Integer roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色名称
|
* 角色名称
|
||||||
|
|
@ -43,7 +43,7 @@ public class SysRole extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 默认的 所属部门 --> 为当前创建用户的部门id
|
* 默认的 所属部门 --> 为当前创建用户的部门id
|
||||||
*/
|
*/
|
||||||
private Integer deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
|
|
@ -78,12 +78,12 @@ public class SysRole extends BaseEntity {
|
||||||
|
|
||||||
/** 菜单组 */
|
/** 菜单组 */
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer[] menuIds;
|
private Long[] menuIds;
|
||||||
/**
|
/**
|
||||||
* 部门组
|
* 部门组
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer[] deptIds;
|
private Long[] deptIds;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Set<String> permissions;
|
private Set<String> permissions;
|
||||||
|
|
@ -111,13 +111,19 @@ public class SysRole extends BaseEntity {
|
||||||
return isAdmin(this.roleId);
|
return isAdmin(this.roleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAdmin(Integer roleId)
|
public static boolean isAdmin(Long roleId)
|
||||||
{
|
{
|
||||||
return roleId != null && 1 == roleId;
|
return roleId != null && 1 == roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SysRole(Integer roleId){
|
public SysRole(Long roleId){
|
||||||
this.roleId = roleId;
|
this.roleId = roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Id
|
||||||
|
*/
|
||||||
|
@TableField(value = "tenant_id")
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ public class SysRoleDept implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 角色Id
|
* 角色Id
|
||||||
*/
|
*/
|
||||||
private Integer roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门id
|
* 部门id
|
||||||
*/
|
*/
|
||||||
private Integer deptId;
|
private Long deptId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,12 @@ public class SysRoleMenu implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 角色Id
|
* 角色Id
|
||||||
*/
|
*/
|
||||||
private Integer roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单id
|
* 菜单id
|
||||||
*/
|
*/
|
||||||
private Integer menuId;
|
private Long menuId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.chushang.system.entity.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_tenant")
|
||||||
|
public class SysTenant extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
@TableId(value = "tenant_id", type = IdType.ASSIGN_ID)
|
||||||
|
private Long tenantId;
|
||||||
|
/**
|
||||||
|
* 租户名称
|
||||||
|
*/
|
||||||
|
private String tenantName;
|
||||||
|
/**
|
||||||
|
* 租户状态
|
||||||
|
*/
|
||||||
|
private Boolean status;
|
||||||
|
/**
|
||||||
|
* 租户套餐Id
|
||||||
|
*/
|
||||||
|
private Long packageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户排序
|
||||||
|
*/
|
||||||
|
private Integer orderNum;
|
||||||
|
/**
|
||||||
|
* 创建人角色
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
|
||||||
|
private String updateBy;
|
||||||
|
/**
|
||||||
|
* 租户套餐
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private SysTenantPackage tenantPackage;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.chushang.system.entity.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_tenant_package")
|
||||||
|
public class SysTenantPackage extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 套餐Id
|
||||||
|
*/
|
||||||
|
@TableId(value = "package_id", type = IdType.ASSIGN_ID)
|
||||||
|
private Long packageId;
|
||||||
|
/**
|
||||||
|
* 套餐名称
|
||||||
|
*/
|
||||||
|
private String packageName;
|
||||||
|
/**
|
||||||
|
* 备注信息
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 套餐开始时间
|
||||||
|
*/
|
||||||
|
private LocalDate startDate;
|
||||||
|
/**
|
||||||
|
* 套餐结束时间
|
||||||
|
*/
|
||||||
|
private LocalDate endDate;
|
||||||
|
/**
|
||||||
|
* 套餐排序
|
||||||
|
*/
|
||||||
|
private Integer orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人角色
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐状态
|
||||||
|
*/
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断租户是否在有效期
|
||||||
|
*/
|
||||||
|
public boolean isValid(){
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
return (this.startDate.isAfter(now) && this.endDate.isBefore(now) && status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package com.chushang.system.entity.po;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.chushang.common.mybatis.base.BaseEntity;
|
import com.chushang.common.mybatis.base.BaseEntity;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
|
@ -28,8 +29,8 @@ public class SysUser extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 自增主键id
|
* 自增主键id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "user_id", type = IdType.AUTO)
|
@TableId(value = "user_id", type = IdType.ASSIGN_ID)
|
||||||
private Integer userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户账号
|
* 用户账号
|
||||||
|
|
@ -56,7 +57,7 @@ public class SysUser extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 所属部门id
|
* 所属部门id
|
||||||
*/
|
*/
|
||||||
private Integer deptId;
|
private Long deptId;
|
||||||
/**
|
/**
|
||||||
* 头像
|
* 头像
|
||||||
*/
|
*/
|
||||||
|
|
@ -88,28 +89,34 @@ public class SysUser extends BaseEntity {
|
||||||
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
|
@TableField(updateStrategy = FieldStrategy.NOT_NULL)
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private SysDept dept;
|
private SysDept dept;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<SysRole> roles;
|
private List<SysRole> roles;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<DataScopeEntity> dataScopes;
|
||||||
/**
|
/**
|
||||||
* 角色组
|
* 角色组
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer[] roleIds;
|
private Long[] roleIds;
|
||||||
/**
|
/**
|
||||||
* 角色id
|
* 角色id
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer roleId;
|
private Long roleId;
|
||||||
|
|
||||||
public boolean isAdmin()
|
public boolean isAdmin()
|
||||||
{
|
{
|
||||||
return isAdmin(this.userId) || isAdmin(this.roles);
|
return isAdmin(this.userId) || isAdmin(this.roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAdmin(Integer userId)
|
public static boolean isAdmin(Long userId)
|
||||||
{
|
{
|
||||||
return userId != null && 1 == userId;
|
return userId != null && 1 == userId;
|
||||||
}
|
}
|
||||||
|
|
@ -122,11 +129,15 @@ public class SysUser extends BaseEntity {
|
||||||
}
|
}
|
||||||
return admin > 0;
|
return admin > 0;
|
||||||
}
|
}
|
||||||
public SysUser(Integer userId)
|
public SysUser(Long userId)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Id
|
||||||
|
*/
|
||||||
|
@TableField(value = "tenant_id")
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
package com.chushang.system.entity.po;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.chushang.system.entity.enums.AuthTypeEnum;
|
|
||||||
import lombok.*;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author by zhaowenyuan create 2022/8/24 10:20
|
|
||||||
* 用户数据授权
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Builder
|
|
||||||
@TableName(value = "sys_user_data")
|
|
||||||
public class SysUserData implements Serializable {
|
|
||||||
|
|
||||||
/** 用户ID */
|
|
||||||
@TableId(value = "user_id")
|
|
||||||
private Integer userId;
|
|
||||||
/**
|
|
||||||
* 数据类型
|
|
||||||
*/
|
|
||||||
@TableField(value = "data_type")
|
|
||||||
private AuthTypeEnum dataType;
|
|
||||||
/**
|
|
||||||
* 类型对应的值 id 或者其他的唯一标识符号
|
|
||||||
*/
|
|
||||||
@TableField(value = "data_value")
|
|
||||||
private String dataValue;
|
|
||||||
}
|
|
||||||
|
|
@ -30,12 +30,12 @@ public class SysUserRole implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 角色id
|
* 角色id
|
||||||
*/
|
*/
|
||||||
private Integer roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
private Integer userId;
|
private Long userId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ package com.chushang.system.entity.vo;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.chushang.system.entity.po.SysDept;
|
import com.chushang.system.entity.po.SysDept;
|
||||||
import com.chushang.system.entity.po.SysMenu;
|
import com.chushang.system.entity.po.SysMenu;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -13,12 +16,15 @@ import java.util.stream.Collectors;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
public class TreeSelect implements Serializable
|
public class TreeSelect implements Serializable
|
||||||
{
|
{
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 节点ID */
|
/** 节点ID */
|
||||||
private Integer id;
|
private Long id;
|
||||||
|
|
||||||
/** 节点名称 */
|
/** 节点名称 */
|
||||||
private String label;
|
private String label;
|
||||||
|
|
@ -46,33 +52,4 @@ public class TreeSelect implements Serializable
|
||||||
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel()
|
|
||||||
{
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label)
|
|
||||||
{
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TreeSelect> getChildren()
|
|
||||||
{
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChildren(List<TreeSelect> children)
|
|
||||||
{
|
|
||||||
this.children = children;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.chushang.system.feign;
|
||||||
|
|
||||||
|
import com.chushang.common.core.constant.SecurityConstants;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
|
import com.chushang.system.constants.SystemConstants;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于数据权限 判断远程调用
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteDataScopeService",
|
||||||
|
value = SystemConstants.SYSTEM_SERVICE,
|
||||||
|
path = SystemConstants.APPLICATION_NAME + "/data/scope"
|
||||||
|
)
|
||||||
|
public interface RemoteDataScopeService {
|
||||||
|
|
||||||
|
@GetMapping(value = "/dept/list")
|
||||||
|
public List<String> listDeptIds(@RequestParam(value = "dataScope") DataScopeEntity dataScope,
|
||||||
|
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.chushang.system.feign;
|
||||||
|
|
||||||
import com.chushang.common.core.constant.SecurityConstants;
|
import com.chushang.common.core.constant.SecurityConstants;
|
||||||
import com.chushang.common.core.web.Result;
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import com.chushang.security.entity.vo.LoginUser;
|
import com.chushang.security.entity.vo.LoginUser;
|
||||||
import com.chushang.system.constants.SystemConstants;
|
import com.chushang.system.constants.SystemConstants;
|
||||||
import com.chushang.system.entity.po.SysUser;
|
import com.chushang.system.entity.po.SysUser;
|
||||||
|
|
@ -27,6 +28,6 @@ public interface RemoteUserService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/info/{username}")
|
@GetMapping("/info/{username}")
|
||||||
Result<LoginUser<SysUser>> getUserInfo(@PathVariable(value = "username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
Result<LoginUser<SysUser, DataScopeEntity>> getUserInfo(@PathVariable(value = "username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,498 +0,0 @@
|
||||||
/*
|
|
||||||
Navicat Premium Data Transfer
|
|
||||||
|
|
||||||
Source Server : 192.168.116.115
|
|
||||||
Source Server Type : MySQL
|
|
||||||
Source Server Version : 80027
|
|
||||||
Source Host : 192.168.116.115:3306
|
|
||||||
Source Schema : tb_order_system
|
|
||||||
|
|
||||||
Target Server Type : MySQL
|
|
||||||
Target Server Version : 80027
|
|
||||||
File Encoding : 65001
|
|
||||||
|
|
||||||
Date: 17/05/2024 14:22:18
|
|
||||||
*/
|
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_config
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_config`;
|
|
||||||
CREATE TABLE `sys_config` (
|
|
||||||
`config_id` int NOT NULL AUTO_INCREMENT COMMENT '参数主键',
|
|
||||||
`config_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '参数名称',
|
|
||||||
`config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '参数键名',
|
|
||||||
`config_value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '参数键值',
|
|
||||||
`config_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT 'N' COMMENT '系统内置(Y是 N否)',
|
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
|
||||||
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
|
|
||||||
`version` int NULL DEFAULT 0,
|
|
||||||
`del_status` tinyint(1) NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`config_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '参数配置表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_config
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_config` VALUES (1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', '2024-05-09 14:42:10', '', NULL, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow', 0, 0);
|
|
||||||
INSERT INTO `sys_config` VALUES (2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', '2024-05-09 14:42:10', '', NULL, '初始化密码 123456', 0, 0);
|
|
||||||
INSERT INTO `sys_config` VALUES (3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', '2024-05-09 14:42:10', '', NULL, '深色主题theme-dark,浅色主题theme-light', 0, 0);
|
|
||||||
INSERT INTO `sys_config` VALUES (4, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', '2024-05-09 14:42:10', '', NULL, '是否开启注册用户功能(true开启,false关闭)', 0, 0);
|
|
||||||
INSERT INTO `sys_config` VALUES (5, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', '2024-05-09 14:42:10', '', NULL, '设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)', 0, 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_dept
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_dept`;
|
|
||||||
CREATE TABLE `sys_dept` (
|
|
||||||
`dept_id` int NOT NULL AUTO_INCREMENT COMMENT '部门id',
|
|
||||||
`parent_dept_id` int NULL DEFAULT 0 COMMENT '父部门id',
|
|
||||||
`ancestors` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '祖级列表',
|
|
||||||
`dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '部门名称',
|
|
||||||
`order_num` int NULL DEFAULT 0 COMMENT '显示顺序',
|
|
||||||
`status` tinyint(1) NULL DEFAULT 1 COMMENT '部门状态(0停用 1正常)',
|
|
||||||
`del_state` tinyint NULL DEFAULT 0 COMMENT '删除标志(0代表存在 2代表删除)',
|
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`version` bigint NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`dept_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 200 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '部门表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_dept
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_dept` VALUES (200, 0, '0', '楚商', 0, 1, 0, 'admin', '2022-08-25 16:45:59', 'admin', '2024-04-29 14:44:24', 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_dict_data
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_dict_data`;
|
|
||||||
CREATE TABLE `sys_dict_data` (
|
|
||||||
`dict_code` int NOT NULL AUTO_INCREMENT COMMENT '字典编码',
|
|
||||||
`dict_sort` int NULL DEFAULT 0 COMMENT '字典排序',
|
|
||||||
`dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '字典标签',
|
|
||||||
`dict_value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '字典键值',
|
|
||||||
`dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '字典类型',
|
|
||||||
`css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)',
|
|
||||||
`list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '表格回显样式',
|
|
||||||
`is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)',
|
|
||||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
|
||||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
`del_status` tinyint(1) NULL DEFAULT 0,
|
|
||||||
`version` int NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`dict_code`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 105 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '字典数据表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_dict_data
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (4, 1, '显示', '1', 'sys_show_hide', '', 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (5, 2, '隐藏', '0', 'sys_show_hide', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (6, 1, '正常', '1', 'sys_normal_disable', '', 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (7, 2, '停用', '0', 'sys_normal_disable', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (8, 1, '正常', '1', 'sys_job_status', '', 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (9, 2, '暂停', '0', 'sys_job_status', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (16, 1, '正常', '1', 'sys_notice_status', '', 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (17, 2, '关闭', '0', 'sys_notice_status', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (18, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (19, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (20, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (21, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (22, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (23, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (24, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (25, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (26, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (27, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (100, 1, '停用', '0', 'sys_menu_status', '', 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (101, 2, '启用', '1', 'sys_menu_status', '', 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (102, 0, '缓存', '1', 'sys_cache_nocache', NULL, 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (103, 1, '不缓存', '0', 'sys_cache_nocache', NULL, 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (104, 0, '内链', '1', 'sys_frame_no', NULL, 'primary', 'Y', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
INSERT INTO `sys_dict_data` VALUES (105, 1, '外链', '0', 'sys_frame_no', NULL, 'danger', 'N', '0', NULL, NULL, NULL, NULL, 0, 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_dict_type
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_dict_type`;
|
|
||||||
CREATE TABLE `sys_dict_type` (
|
|
||||||
`dict_id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典主键',
|
|
||||||
`dict_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '字典名称',
|
|
||||||
`dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '字典类型',
|
|
||||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
|
||||||
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
|
|
||||||
`version` int NULL DEFAULT 0,
|
|
||||||
`del_status` tinyint(1) NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`dict_id`) USING BTREE,
|
|
||||||
UNIQUE INDEX `dict_type`(`dict_type` ASC) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '字典类型表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_dict_type
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_log
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_log`;
|
|
||||||
CREATE TABLE `sys_log` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`type` smallint NULL DEFAULT NULL COMMENT '日志类型',
|
|
||||||
`remote_addr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '操作ip',
|
|
||||||
`user_agent` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户代理',
|
|
||||||
`request_uri` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '请求uri',
|
|
||||||
`method` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '请求方法',
|
|
||||||
`params` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '请求参数',
|
|
||||||
`time` bigint NULL DEFAULT NULL COMMENT '执行时间 毫秒',
|
|
||||||
`exception` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '异常信息',
|
|
||||||
`user_id` bigint NULL DEFAULT NULL COMMENT '操作用户id',
|
|
||||||
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
|
||||||
`operation` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户操作',
|
|
||||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
`del_state` tinyint(1) NULL DEFAULT 0,
|
|
||||||
`operation_type` tinyint NULL DEFAULT NULL COMMENT '操作类型',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '系统日志' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_log
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_login_info
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_login_info`;
|
|
||||||
CREATE TABLE `sys_login_info` (
|
|
||||||
`info_id` bigint NOT NULL AUTO_INCREMENT,
|
|
||||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
|
||||||
`status` smallint NULL DEFAULT NULL,
|
|
||||||
`ipaddr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
|
||||||
`msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
|
||||||
`access_time` datetime NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
`del_state` tinyint(1) NULL DEFAULT 0,
|
|
||||||
`version` bigint NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`info_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_login_info
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_login_info` VALUES (1, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-08 10:53:33', '2024-05-08 10:53:36', '2024-05-08 10:53:36', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (2, 'admin', 1, '127.0.0.1', '退出成功', '2024-05-08 10:53:33', '2024-05-08 10:53:36', '2024-05-08 10:53:36', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (3, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-08 10:58:12', '2024-05-08 10:58:15', '2024-05-08 10:58:15', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (4, 'admin', 1, '127.0.0.1', '退出成功', '2024-05-08 11:06:41', '2024-05-08 11:06:44', '2024-05-08 11:06:44', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (5, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-08 11:42:47', '2024-05-08 11:42:50', '2024-05-08 11:42:50', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (6, 'admin', 1, '127.0.0.1', '退出成功', '2024-05-09 09:41:40', '2024-05-09 09:41:43', '2024-05-09 09:41:43', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (7, 'admin', 3, '127.0.0.1', '用户密码错误', '2024-05-09 09:41:52', '2024-05-09 09:41:54', '2024-05-09 09:41:54', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (8, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-09 09:41:57', '2024-05-09 09:42:00', '2024-05-09 09:42:00', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (9, 'admin', 1, '127.0.0.1', '退出成功', '2024-05-09 10:54:49', '2024-05-09 10:54:52', '2024-05-09 10:54:52', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (10, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-09 10:54:54', '2024-05-09 10:54:57', '2024-05-09 10:54:57', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (11, 'admin', 1, '127.0.0.1', '退出成功', '2024-05-09 11:50:34', '2024-05-09 11:50:37', '2024-05-09 11:50:37', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (12, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-09 11:50:38', '2024-05-09 11:50:42', '2024-05-09 11:50:42', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (13, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-10 15:24:00', '2024-05-10 15:24:04', '2024-05-10 15:24:04', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (14, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-10 15:40:34', '2024-05-10 15:40:37', '2024-05-10 15:40:37', 0, NULL);
|
|
||||||
INSERT INTO `sys_login_info` VALUES (15, 'admin', 0, '127.0.0.1', '登录成功', '2024-05-10 15:43:01', '2024-05-10 15:43:05', '2024-05-10 15:43:05', 0, NULL);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_menu
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_menu`;
|
|
||||||
CREATE TABLE `sys_menu` (
|
|
||||||
`menu_id` int NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
|
|
||||||
`menu_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '菜单名称',
|
|
||||||
`parent_id` int NULL DEFAULT 0 COMMENT '父菜单ID',
|
|
||||||
`order_num` int NULL DEFAULT 0 COMMENT '显示顺序',
|
|
||||||
`path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '路由地址',
|
|
||||||
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '组件路径',
|
|
||||||
`query` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '路由参数',
|
|
||||||
`frame` tinyint(1) NULL DEFAULT 1 COMMENT '是否为外链(0是 1否)',
|
|
||||||
`cache` tinyint(1) NULL DEFAULT 0 COMMENT '是否缓存(0缓存 1不缓存)',
|
|
||||||
`menu_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)',
|
|
||||||
`visible` tinyint(1) NULL DEFAULT 0 COMMENT '菜单状态(0隐藏 1显示)0 false 1true',
|
|
||||||
`status` tinyint(1) NULL DEFAULT 1 COMMENT '菜单状态(1正常 0停用)1true 0false',
|
|
||||||
`perms` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '权限标识',
|
|
||||||
`icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '#' COMMENT '菜单图标',
|
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '备注',
|
|
||||||
`del_state` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态',
|
|
||||||
`version` bigint NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`menu_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1060 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '菜单权限表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_menu
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 1, 'system', NULL, '', 1, 0, 'M', 1, 1, '', 'system', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '系统管理目录', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 2, 'monitor', NULL, '', 1, 0, 'M', 1, 1, '', 'monitor', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '系统监控目录', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (3, '系统工具', 0, 3, 'tool', NULL, '', 1, 0, 'M', 1, 1, '', 'tool', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '系统工具目录', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (4, '若依官网', 0, 4, 'http://ruoyi.vip', NULL, '', 0, 0, 'M', 1, 1, '', 'guide', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:28', '若依官网地址', 1, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (100, '用户管理', 1, 1, 'user', 'system/user/index', '', 1, 0, 'C', 1, 1, 'system:user:list', 'user', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '用户管理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (101, '角色管理', 1, 2, 'role', 'system/role/index', '', 1, 0, 'C', 1, 1, 'system:role:list', 'peoples', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '角色管理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', '', 1, 0, 'C', 1, 1, 'system:menu:list', 'tree-table', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '菜单管理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (103, '部门管理', 1, 4, 'dept', 'system/dept/index', '', 1, 0, 'C', 1, 1, 'system:dept:list', 'tree', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '部门管理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', '', 1, 0, 'C', 1, 1, 'system:post:list', 'post', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '岗位管理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', '', 1, 0, 'C', 1, 1, 'system:dict:list', 'dict', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '字典管理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (106, '参数设置', 1, 7, 'config', 'system/config/index', '', 1, 0, 'C', 1, 1, 'system:config:list', 'edit', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '参数设置菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (107, '通知公告', 1, 8, 'notice', 'system/notice/index', '', 1, 0, 'C', 1, 1, 'system:notice:list', 'message', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '通知公告菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (108, '日志管理', 1, 9, 'log', '', '', 1, 0, 'M', 1, 1, '', 'log', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '日志管理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (109, '在线用户', 2, 1, 'online', 'monitor/online/index', '', 1, 0, 'C', 1, 1, 'monitor:online:list', 'online', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '在线用户菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (110, '定时任务', 2, 2, 'job', 'monitor/job/index', '', 1, 0, 'C', 1, 1, 'monitor:job:list', 'job', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '定时任务菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (111, 'Sentinel控制台', 2, 3, 'http://localhost:8718', '', '', 0, 0, 'C', 1, 1, 'monitor:sentinel:list', 'sentinel', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '流量控制菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (112, 'Nacos控制台', 2, 4, 'http://localhost:8848/nacos', '', '', 0, 0, 'C', 1, 1, 'monitor:nacos:list', 'nacos', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '服务治理菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (113, 'Admin控制台', 2, 5, 'http://localhost:9100/login', '', '', 0, 0, 'C', 1, 1, 'monitor:server:list', 'server', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '服务监控菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (114, '表单构建', 3, 1, 'build', 'tool/build/index', '', 1, 0, 'C', 1, 1, 'tool:build:list', 'build', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '表单构建菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (115, '代码生成', 3, 2, 'gen', 'tool/gen/index', '', 1, 0, 'C', 1, 1, 'tool:gen:list', 'code', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '代码生成菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (116, '系统接口', 3, 3, 'http://localhost:8080/swagger-ui/index.html', '', '', 0, 0, 'C', 1, 1, 'tool:swagger:list', 'swagger', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '系统接口菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 1, 'operlog', 'system/operlog/index', '', 1, 0, 'C', 1, 1, 'system:operlog:list', 'form', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '操作日志菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 2, 'logininfor', 'system/logininfor/index', '', 1, 0, 'C', 1, 1, 'system:logininfor:list', 'logininfor', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '登录日志菜单', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1000, '用户查询', 100, 1, '', '', '', 1, 0, 'F', 1, 1, 'system:user:query', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1001, '用户新增', 100, 2, '', '', '', 1, 0, 'F', 1, 1, 'system:user:add', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1002, '用户修改', 100, 3, '', '', '', 1, 0, 'F', 1, 1, 'system:user:edit', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1003, '用户删除', 100, 4, '', '', '', 1, 0, 'F', 1, 1, 'system:user:remove', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1004, '用户导出', 100, 5, '', '', '', 1, 0, 'F', 1, 1, 'system:user:export', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1005, '用户导入', 100, 6, '', '', '', 1, 0, 'F', 1, 1, 'system:user:import', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1006, '重置密码', 100, 7, '', '', '', 1, 0, 'F', 1, 1, 'system:user:resetPwd', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1007, '角色查询', 101, 1, '', '', '', 1, 0, 'F', 1, 1, 'system:role:query', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1008, '角色新增', 101, 2, '', '', '', 1, 0, 'F', 1, 1, 'system:role:add', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1009, '角色修改', 101, 3, '', '', '', 1, 0, 'F', 1, 1, 'system:role:edit', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1010, '角色删除', 101, 4, '', '', '', 1, 0, 'F', 1, 1, 'system:role:remove', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1011, '角色导出', 101, 5, '', '', '', 1, 0, 'F', 1, 1, 'system:role:export', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1012, '菜单查询', 102, 1, '', '', '', 1, 0, 'F', 1, 1, 'system:menu:query', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1013, '菜单新增', 102, 2, '', '', '', 1, 0, 'F', 1, 1, 'system:menu:add', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1014, '菜单修改', 102, 3, '', '', '', 1, 0, 'F', 1, 1, 'system:menu:edit', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1015, '菜单删除', 102, 4, '', '', '', 1, 0, 'F', 1, 1, 'system:menu:remove', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1016, '部门查询', 103, 1, '', '', '', 1, 0, 'F', 1, 1, 'system:dept:query', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1017, '部门新增', 103, 2, '', '', '', 1, 0, 'F', 1, 1, 'system:dept:add', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1018, '部门修改', 103, 3, '', '', '', 1, 0, 'F', 1, 1, 'system:dept:edit', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1019, '部门删除', 103, 4, '', '', '', 1, 0, 'F', 1, 1, 'system:dept:remove', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1020, '岗位查询', 104, 1, '', '', '', 1, 0, 'F', 1, 1, 'system:post:query', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1021, '岗位新增', 104, 2, '', '', '', 1, 0, 'F', 1, 1, 'system:post:add', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1022, '岗位修改', 104, 3, '', '', '', 1, 0, 'F', 1, 1, 'system:post:edit', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1023, '岗位删除', 104, 4, '', '', '', 1, 0, 'F', 1, 1, 'system:post:remove', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1024, '岗位导出', 104, 5, '', '', '', 1, 0, 'F', 1, 1, 'system:post:export', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1025, '字典查询', 105, 1, '#', '', '', 1, 0, 'F', 1, 1, 'system:dict:query', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1026, '字典新增', 105, 2, '#', '', '', 1, 0, 'F', 1, 1, 'system:dict:add', '#', 'admin', '2024-05-09 14:42:09', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1027, '字典修改', 105, 3, '#', '', '', 1, 0, 'F', 1, 1, 'system:dict:edit', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1028, '字典删除', 105, 4, '#', '', '', 1, 0, 'F', 1, 1, 'system:dict:remove', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1029, '字典导出', 105, 5, '#', '', '', 1, 0, 'F', 1, 1, 'system:dict:export', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1030, '参数查询', 106, 1, '#', '', '', 1, 0, 'F', 1, 1, 'system:config:query', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1031, '参数新增', 106, 2, '#', '', '', 1, 0, 'F', 1, 1, 'system:config:add', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1032, '参数修改', 106, 3, '#', '', '', 1, 0, 'F', 1, 1, 'system:config:edit', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1033, '参数删除', 106, 4, '#', '', '', 1, 0, 'F', 1, 1, 'system:config:remove', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1034, '参数导出', 106, 5, '#', '', '', 1, 0, 'F', 1, 1, 'system:config:export', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1035, '公告查询', 107, 1, '#', '', '', 1, 0, 'F', 1, 1, 'system:notice:query', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1036, '公告新增', 107, 2, '#', '', '', 1, 0, 'F', 1, 1, 'system:notice:add', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1037, '公告修改', 107, 3, '#', '', '', 1, 0, 'F', 1, 1, 'system:notice:edit', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1038, '公告删除', 107, 4, '#', '', '', 1, 0, 'F', 1, 1, 'system:notice:remove', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1039, '操作查询', 500, 1, '#', '', '', 1, 0, 'F', 1, 1, 'system:operlog:query', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1040, '操作删除', 500, 2, '#', '', '', 1, 0, 'F', 1, 1, 'system:operlog:remove', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1041, '日志导出', 500, 3, '#', '', '', 1, 0, 'F', 1, 1, 'system:operlog:export', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1042, '登录查询', 501, 1, '#', '', '', 1, 0, 'F', 1, 1, 'system:logininfor:query', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1043, '登录删除', 501, 2, '#', '', '', 1, 0, 'F', 1, 1, 'system:logininfor:remove', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1044, '日志导出', 501, 3, '#', '', '', 1, 0, 'F', 1, 1, 'system:logininfor:export', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1045, '账户解锁', 501, 4, '#', '', '', 1, 0, 'F', 1, 1, 'system:logininfor:unlock', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1046, '在线查询', 109, 1, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:online:query', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1047, '批量强退', 109, 2, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:online:batchLogout', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1048, '单条强退', 109, 3, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:online:forceLogout', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1049, '任务查询', 110, 1, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:job:query', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1050, '任务新增', 110, 2, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:job:add', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1051, '任务修改', 110, 3, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:job:edit', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1052, '任务删除', 110, 4, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:job:remove', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1053, '状态修改', 110, 5, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:job:changeStatus', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1054, '任务导出', 110, 6, '#', '', '', 1, 0, 'F', 1, 1, 'monitor:job:export', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1055, '生成查询', 115, 1, '#', '', '', 1, 0, 'F', 1, 1, 'tool:gen:query', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1056, '生成修改', 115, 2, '#', '', '', 1, 0, 'F', 1, 1, 'tool:gen:edit', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1057, '生成删除', 115, 3, '#', '', '', 1, 0, 'F', 1, 1, 'tool:gen:remove', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1058, '导入代码', 115, 2, '#', '', '', 1, 0, 'F', 1, 1, 'tool:gen:import', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1059, '预览代码', 115, 4, '#', '', '', 1, 0, 'F', 1, 1, 'tool:gen:preview', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
INSERT INTO `sys_menu` VALUES (1060, '生成代码', 115, 5, '#', '', '', 1, 0, 'F', 1, 1, 'tool:gen:code', '#', 'admin', '2024-05-09 14:42:10', '', '2024-05-09 16:10:01', '', 0, 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_post
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_post`;
|
|
||||||
CREATE TABLE `sys_post` (
|
|
||||||
`post_id` bigint NOT NULL AUTO_INCREMENT COMMENT '岗位ID',
|
|
||||||
`post_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '岗位编码',
|
|
||||||
`post_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '岗位名称',
|
|
||||||
`post_sort` int NOT NULL COMMENT '显示顺序',
|
|
||||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '状态(0正常 1停用)',
|
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
|
||||||
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
|
|
||||||
`version` int NULL DEFAULT 0,
|
|
||||||
`del_status` tinyint(1) NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`post_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '岗位信息表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_post
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_post` VALUES (1, 'ceo', '董事长', 1, '0', 'admin', '2024-05-09 14:42:09', '', NULL, '', 0, 0);
|
|
||||||
INSERT INTO `sys_post` VALUES (2, 'se', '项目经理', 2, '0', 'admin', '2024-05-09 14:42:09', '', NULL, '', 0, 0);
|
|
||||||
INSERT INTO `sys_post` VALUES (3, 'hr', '人力资源', 3, '0', 'admin', '2024-05-09 14:42:09', '', NULL, '', 0, 0);
|
|
||||||
INSERT INTO `sys_post` VALUES (4, 'user', '普通员工', 4, '0', 'admin', '2024-05-09 14:42:09', '', NULL, '', 0, 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_role
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_role`;
|
|
||||||
CREATE TABLE `sys_role` (
|
|
||||||
`role_id` int NOT NULL AUTO_INCREMENT COMMENT '角色ID',
|
|
||||||
`role_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '角色名称',
|
|
||||||
`role_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '角色权限字符串',
|
|
||||||
`order_num` int NOT NULL DEFAULT 0 COMMENT '显示顺序',
|
|
||||||
`data_scope` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '4' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)',
|
|
||||||
`menu_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '菜单树选择项是否关联显示',
|
|
||||||
`dept_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '部门树选择项是否关联显示',
|
|
||||||
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '角色状态(1正常 0停用)',
|
|
||||||
`del_state` tinyint(1) NULL DEFAULT 0 COMMENT '删除标志(0代表存在 2代表删除)',
|
|
||||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '备注',
|
|
||||||
`dept_id` int NULL DEFAULT NULL COMMENT '对应部门id',
|
|
||||||
`version` bigint NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`role_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '角色信息表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_role
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', 1, 1, 1, 0, 'admin', '2022-08-25 15:08:02', '', '2022-09-27 17:18:54', '超级管理员', 200, 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_role_dept
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_role_dept`;
|
|
||||||
CREATE TABLE `sys_role_dept` (
|
|
||||||
`role_id` int NOT NULL COMMENT '角色ID',
|
|
||||||
`dept_id` int NOT NULL COMMENT '部门ID',
|
|
||||||
PRIMARY KEY (`role_id`, `dept_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '角色和部门关联表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_role_dept
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_role_menu
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_role_menu`;
|
|
||||||
CREATE TABLE `sys_role_menu` (
|
|
||||||
`role_id` int NOT NULL COMMENT '角色ID',
|
|
||||||
`menu_id` int NOT NULL COMMENT '菜单ID',
|
|
||||||
PRIMARY KEY (`role_id`, `menu_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '角色和菜单关联表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_role_menu
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_user
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_user`;
|
|
||||||
CREATE TABLE `sys_user` (
|
|
||||||
`user_id` int NOT NULL AUTO_INCREMENT,
|
|
||||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '用户名',
|
|
||||||
`password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '密码',
|
|
||||||
`status` tinyint NULL DEFAULT 1 COMMENT '状态 0:禁用 1:正常',
|
|
||||||
`salt` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '盐',
|
|
||||||
`dept_id` int NULL DEFAULT NULL COMMENT '部门id',
|
|
||||||
`create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建人',
|
|
||||||
`update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '修改人',
|
|
||||||
`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
||||||
`del_state` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态',
|
|
||||||
`version` bigint NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`user_id`) USING BTREE,
|
|
||||||
INDEX `username`(`username` ASC) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '系统用户' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_user
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_user` VALUES (1, 'admin', '$2a$10$mT7Ismory0OeHYhmXMk2O.0Y/qaKt2VBn6bwQiKUvttQHW0/naveC', 1, 'h2HheUVZmF', 200, 'admin', 'admin', '2022-08-25 16:43:40', '2024-05-08 10:48:46', 0, 0);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_user_data
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_user_data`;
|
|
||||||
CREATE TABLE `sys_user_data` (
|
|
||||||
`user_id` int NOT NULL COMMENT '用户id',
|
|
||||||
`data_type` smallint NOT NULL COMMENT '数据类型 -- 应当是一个 枚举',
|
|
||||||
`data_value` json NULL COMMENT '数据对应id, 多个以数组形式存在',
|
|
||||||
PRIMARY KEY (`user_id`, `data_type`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_user_data
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_user_post
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_user_post`;
|
|
||||||
CREATE TABLE `sys_user_post` (
|
|
||||||
`user_id` bigint NOT NULL COMMENT '用户ID',
|
|
||||||
`post_id` bigint NOT NULL COMMENT '岗位ID',
|
|
||||||
PRIMARY KEY (`user_id`, `post_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户与岗位关联表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_user_post
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_user_post` VALUES (1, 1);
|
|
||||||
INSERT INTO `sys_user_post` VALUES (2, 2);
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for sys_user_role
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `sys_user_role`;
|
|
||||||
CREATE TABLE `sys_user_role` (
|
|
||||||
`user_id` int NOT NULL COMMENT '用户ID',
|
|
||||||
`role_id` int NOT NULL COMMENT '角色ID',
|
|
||||||
PRIMARY KEY (`user_id`, `role_id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户和角色关联表' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of sys_user_role
|
|
||||||
-- ----------------------------
|
|
||||||
INSERT INTO `sys_user_role` VALUES (1, 1);
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
||||||
|
|
@ -20,7 +20,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableOnnFeignClients
|
@EnableOnnFeignClients
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@SpringBootApplication
|
@SpringBootApplication(scanBasePackages = {"com.chushang.**"})
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
//启用服务调用的参数传递,包含链路追踪日志
|
//启用服务调用的参数传递,包含链路追踪日志
|
||||||
@EnableTransferFeign
|
@EnableTransferFeign
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class DeptController {
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:dept:query")
|
@RequiresPermissions("system:dept:query")
|
||||||
@GetMapping(value = "/{deptId}")
|
@GetMapping(value = "/{deptId}")
|
||||||
public AjaxResult getInfo(@PathVariable Integer deptId)
|
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||||
{
|
{
|
||||||
sysDeptService.checkDeptDataScope(deptId);
|
sysDeptService.checkDeptDataScope(deptId);
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class DeptController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/roleDept/tree/{roleId}")
|
@GetMapping(value = "/roleDept/tree/{roleId}")
|
||||||
@RequiresPermissions("system:role:query")
|
@RequiresPermissions("system:role:query")
|
||||||
public AjaxResult roleDeptTreeSelect(@PathVariable("roleId") Integer roleId)
|
public AjaxResult roleDeptTreeSelect(@PathVariable("roleId") Long roleId)
|
||||||
{
|
{
|
||||||
List<SysDept> deptList = sysDeptService.selectDeptList(new ListDeptDTO());
|
List<SysDept> deptList = sysDeptService.selectDeptList(new ListDeptDTO());
|
||||||
return AjaxResult.success()
|
return AjaxResult.success()
|
||||||
|
|
@ -113,7 +113,7 @@ public class DeptController {
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Valid @RequestBody SysDept dept)
|
public AjaxResult edit(@Valid @RequestBody SysDept dept)
|
||||||
{
|
{
|
||||||
Integer deptId = dept.getDeptId();
|
Long deptId = dept.getDeptId();
|
||||||
|
|
||||||
sysDeptService.checkDeptDataScope(deptId);
|
sysDeptService.checkDeptDataScope(deptId);
|
||||||
|
|
||||||
|
|
@ -142,7 +142,7 @@ public class DeptController {
|
||||||
@RequiresPermissions("system:dept:remove")
|
@RequiresPermissions("system:dept:remove")
|
||||||
@SysLog(value = "部门", businessType = BusinessType.DELETE)
|
@SysLog(value = "部门", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deptId}")
|
@DeleteMapping("/{deptId}")
|
||||||
public AjaxResult remove(@PathVariable Integer deptId)
|
public AjaxResult remove(@PathVariable Long deptId)
|
||||||
{
|
{
|
||||||
if (sysDeptService.hasChildByDeptId(deptId))
|
if (sysDeptService.hasChildByDeptId(deptId))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.chushang.common.core.exception.utils.AssertUtil;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
import com.chushang.common.excel.utils.ExcelUtils;
|
import com.chushang.common.excel.utils.ExcelUtils;
|
||||||
import com.chushang.common.log.annotation.SysLog;
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
|
import com.chushang.common.log.constant.LogApplicationName;
|
||||||
import com.chushang.common.log.enums.BusinessType;
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
import com.chushang.common.mybatis.page.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import com.chushang.common.mybatis.utils.PageResult;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
|
@ -11,8 +12,6 @@ import com.chushang.security.annotation.RequiresPermissions;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.entity.po.SysDictType;
|
import com.chushang.system.entity.po.SysDictType;
|
||||||
import com.chushang.system.service.ISysDictTypeService;
|
import com.chushang.system.service.ISysDictTypeService;
|
||||||
import lombok.extern.java.Log;
|
|
||||||
import org.aspectj.weaver.loadtime.Aj;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
@ -111,7 +110,7 @@ public class DictTypeController {
|
||||||
* TODO 刷新字典缓存
|
* TODO 刷新字典缓存
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:dict:refresh")
|
@RequiresPermissions("system:dict:refresh")
|
||||||
@SysLog(value = "字典类型", businessType = BusinessType.CLEAN)
|
@SysLog(value = "字典类型", businessType = BusinessType.CLEAR)
|
||||||
@DeleteMapping("/refreshCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public AjaxResult refreshCache()
|
public AjaxResult refreshCache()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
import com.chushang.common.log.annotation.SysLog;
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
import com.chushang.common.log.enums.BusinessType;
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import com.chushang.security.annotation.RequiresPermissions;
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.entity.dto.ListMenuDTO;
|
import com.chushang.system.entity.dto.ListMenuDTO;
|
||||||
|
|
@ -35,7 +36,7 @@ public class MenuController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(ListMenuDTO listMenu)
|
public AjaxResult list(ListMenuDTO listMenu)
|
||||||
{
|
{
|
||||||
Integer userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
List<SysMenu> menus = menuService.selectMenuList(listMenu, userId);
|
List<SysMenu> menus = menuService.selectMenuList(listMenu, userId);
|
||||||
return AjaxResult.success(menus);
|
return AjaxResult.success(menus);
|
||||||
}
|
}
|
||||||
|
|
@ -45,7 +46,7 @@ public class MenuController {
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:menu:query")
|
@RequiresPermissions("system:menu:query")
|
||||||
@GetMapping(value = "/{menuId}")
|
@GetMapping(value = "/{menuId}")
|
||||||
public AjaxResult getInfo(@PathVariable Integer menuId)
|
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(menuService.selectMenuById(menuId));
|
return AjaxResult.success(menuService.selectMenuById(menuId));
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +57,7 @@ public class MenuController {
|
||||||
@GetMapping("/tree/select")
|
@GetMapping("/tree/select")
|
||||||
public AjaxResult treeSelect()
|
public AjaxResult treeSelect()
|
||||||
{
|
{
|
||||||
Integer userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
List<SysMenu> menus = menuService.selectMenuList(new ListMenuDTO(), userId);
|
List<SysMenu> menus = menuService.selectMenuList(new ListMenuDTO(), userId);
|
||||||
|
|
||||||
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
||||||
|
|
@ -66,9 +67,9 @@ public class MenuController {
|
||||||
* 加载对应角色菜单列表树
|
* 加载对应角色菜单列表树
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/roleMenu/tree/select/{roleId}")
|
@GetMapping(value = "/roleMenu/tree/select/{roleId}")
|
||||||
public AjaxResult roleMenuTreeSelect(@PathVariable("roleId") Integer roleId)
|
public AjaxResult roleMenuTreeSelect(@PathVariable("roleId") Long roleId)
|
||||||
{
|
{
|
||||||
Integer userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
List<SysMenu> menus = menuService.selectMenuList(userId);
|
List<SysMenu> menus = menuService.selectMenuList(userId);
|
||||||
return AjaxResult.success()
|
return AjaxResult.success()
|
||||||
.add("checkedKeys", menuService.selectMenuListByRoleId(roleId))
|
.add("checkedKeys", menuService.selectMenuListByRoleId(roleId))
|
||||||
|
|
@ -131,9 +132,9 @@ public class MenuController {
|
||||||
* 删除菜单
|
* 删除菜单
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:menu:remove")
|
@RequiresPermissions("system:menu:remove")
|
||||||
@SysLog("删除菜单")
|
@SysLog(value = "菜单", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{menuId}")
|
@DeleteMapping("/{menuId}")
|
||||||
public AjaxResult remove(@PathVariable("menuId") Integer menuId)
|
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||||
{
|
{
|
||||||
if (menuService.hasChildByMenuId(menuId))
|
if (menuService.hasChildByMenuId(menuId))
|
||||||
{
|
{
|
||||||
|
|
@ -156,7 +157,7 @@ public class MenuController {
|
||||||
@GetMapping("/getRouters")
|
@GetMapping("/getRouters")
|
||||||
public AjaxResult getRouters()
|
public AjaxResult getRouters()
|
||||||
{
|
{
|
||||||
LoginUser<SysUser> loginUser = SecurityUtils.getLoginUser();
|
LoginUser<SysUser, DataScopeEntity> loginUser = SecurityUtils.getLoginUser();
|
||||||
SysUser sysUser = loginUser.getSysUser();
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(sysUser);
|
List<SysMenu> menus = menuService.selectMenuTreeByUserId(sysUser);
|
||||||
return AjaxResult.success(menuService.buildMenus(menus));
|
return AjaxResult.success(menuService.buildMenus(menus));
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,12 @@ import com.chushang.common.log.annotation.SysLog;
|
||||||
import com.chushang.common.log.enums.BusinessType;
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
import com.chushang.common.mybatis.page.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import com.chushang.common.mybatis.utils.PageResult;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import com.chushang.security.annotation.RequiresPermissions;
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
import com.chushang.security.entity.vo.LoginUser;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
import com.chushang.system.entity.po.SysPost;
|
import com.chushang.system.entity.po.SysPost;
|
||||||
|
import com.chushang.system.entity.po.SysUser;
|
||||||
import com.chushang.system.service.ISysPostService;
|
import com.chushang.system.service.ISysPostService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -78,6 +81,12 @@ public class PostController {
|
||||||
postName.setPostName(null);
|
postName.setPostName(null);
|
||||||
AssertUtil.invalidate(postService.checkPostUnique(postName), "新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
AssertUtil.invalidate(postService.checkPostUnique(postName), "新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
post.setCreateBy(SecurityUtils.getUsername());
|
post.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
||||||
|
LoginUser<SysUser, DataScopeEntity> loginUser = SecurityUtils.getLoginUser();
|
||||||
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
|
Long deptId = sysUser.getDeptId();
|
||||||
|
|
||||||
|
post.setDeptId(deptId);
|
||||||
postService.saveOrUpdate(post);
|
postService.saveOrUpdate(post);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class RoleController {
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:query")
|
@RequiresPermissions("system:role:query")
|
||||||
@GetMapping(value = "/{roleId}")
|
@GetMapping(value = "/{roleId}")
|
||||||
public AjaxResult getInfo(@PathVariable Integer roleId)
|
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||||
{
|
{
|
||||||
roleService.checkRoleDataScope(new SysRole(roleId));
|
roleService.checkRoleDataScope(new SysRole(roleId));
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class RoleController {
|
||||||
* 新增角色
|
* 新增角色
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:add")
|
@RequiresPermissions("system:role:add")
|
||||||
@SysLog(value = "新增角色",businessType = BusinessType.INSERT)
|
@SysLog(value = "角色",businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +77,7 @@ public class RoleController {
|
||||||
* 修改保存角色
|
* 修改保存角色
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@SysLog(value = "修改角色",businessType = BusinessType.UPDATE)
|
@SysLog(value = "角色",businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||||
{
|
{
|
||||||
|
|
@ -106,7 +106,7 @@ public class RoleController {
|
||||||
* 修改保存数据权限
|
* 修改保存数据权限
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@SysLog(value = "修改角色权限",businessType = BusinessType.GRANT)
|
@SysLog(value = "角色权限",businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/dataScope")
|
@PutMapping("/dataScope")
|
||||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||||
{
|
{
|
||||||
|
|
@ -122,7 +122,7 @@ public class RoleController {
|
||||||
* 状态修改
|
* 状态修改
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:edit")
|
@RequiresPermissions("system:role:edit")
|
||||||
@SysLog(value = "修改角色状态",businessType = BusinessType.UPDATE)
|
@SysLog(value = "角色状态",businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||||
{
|
{
|
||||||
|
|
@ -140,9 +140,9 @@ public class RoleController {
|
||||||
* 删除角色
|
* 删除角色
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:role:remove")
|
@RequiresPermissions("system:role:remove")
|
||||||
@SysLog(value = "删除角色",businessType = BusinessType.DELETE)
|
@SysLog(value = "角色",businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{roleIds}")
|
@DeleteMapping("/{roleIds}")
|
||||||
public AjaxResult remove(@PathVariable Integer[] roleIds)
|
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||||
{
|
{
|
||||||
roleService.deleteRoleByIds(roleIds);
|
roleService.deleteRoleByIds(roleIds);
|
||||||
|
|
||||||
|
|
@ -200,8 +200,8 @@ public class RoleController {
|
||||||
@PutMapping("/authUser")
|
@PutMapping("/authUser")
|
||||||
public AjaxResult selectAuthUserAll(@RequestBody @Valid RoleUser roleUser)
|
public AjaxResult selectAuthUserAll(@RequestBody @Valid RoleUser roleUser)
|
||||||
{
|
{
|
||||||
Integer roleId = roleUser.getRoleId();
|
Long roleId = roleUser.getRoleId();
|
||||||
Integer[] userIds = roleUser.getUserIds();
|
Long[] userIds = roleUser.getUserIds();
|
||||||
// 判断当切登录用户有没有 此角色的权限
|
// 判断当切登录用户有没有 此角色的权限
|
||||||
roleService.checkRoleDataScope(new SysRole(roleId));
|
roleService.checkRoleDataScope(new SysRole(roleId));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,17 @@
|
||||||
* 版权所有,侵权必究!
|
* 版权所有,侵权必究!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.chushang.common.log.controller;
|
package com.chushang.system.controller;
|
||||||
|
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
import com.chushang.common.log.entity.dto.ListLogDTO;
|
import com.chushang.common.log.entity.dto.ListLogDTO;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
import com.chushang.common.log.service.SysLogService;
|
import com.chushang.common.log.service.SysLogService;
|
||||||
import com.chushang.common.mybatis.utils.PageResult;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
import com.chushang.security.annotation.RequiresPermissions;
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,7 +24,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
*
|
*
|
||||||
* @author Mark sunlightcs@gmail.com
|
* @author Mark sunlightcs@gmail.com
|
||||||
*/
|
*/
|
||||||
@Controller
|
@RestController
|
||||||
@RequestMapping("/v1/log")
|
@RequestMapping("/v1/log")
|
||||||
public class SysLogController {
|
public class SysLogController {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -34,7 +33,6 @@ public class SysLogController {
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@RequiresPermissions("system:log:list")
|
@RequiresPermissions("system:log:list")
|
||||||
public AjaxResult list(ListLogDTO params){
|
public AjaxResult list(ListLogDTO params){
|
||||||
|
|
@ -42,4 +40,20 @@ public class SysLogController {
|
||||||
return AjaxResult.success(page);
|
return AjaxResult.success(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/clean")
|
||||||
|
@SysLog(value = "日志",businessType = BusinessType.CLEAR)
|
||||||
|
@RequiresPermissions(value = "system:log:delete")
|
||||||
|
public AjaxResult cleanLog(){
|
||||||
|
sysLogService.cleanLog();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/{logId}")
|
||||||
|
@SysLog(value = "日志",businessType = BusinessType.DELETE)
|
||||||
|
@RequiresPermissions(value = "system:log:delete")
|
||||||
|
public AjaxResult delLog(@PathVariable Long logId){
|
||||||
|
sysLogService.removeById(logId);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -20,18 +20,11 @@ import java.util.Arrays;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/log/login/info")
|
@RequestMapping(value = "/log/login/info")
|
||||||
public class SysLoginInfoController implements RemoteLoginInfoService {
|
public class SysLoginInfoController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysLoginInfoService sysLoginInfoService;
|
private SysLoginInfoService sysLoginInfoService;
|
||||||
|
|
||||||
@Override
|
|
||||||
@InnerAuth
|
|
||||||
@PostMapping
|
|
||||||
public Result<Boolean> saveLoginInfo(@RequestBody SysLoginInfo sysLogininfo, String source) {
|
|
||||||
return Result.ok(sysLoginInfoService.saveLoginInfo(sysLogininfo).isSuccess());
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
@RequiresPermissions("system:log:list")
|
@RequiresPermissions("system:log:list")
|
||||||
public AjaxResult listLoginInfo(SysLoginInfo loginInfo){
|
public AjaxResult listLoginInfo(SysLoginInfo loginInfo){
|
||||||
|
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
package com.chushang.system.controller;
|
|
||||||
|
|
||||||
import com.chushang.common.core.exception.ResultException;
|
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
|
||||||
import com.chushang.common.core.web.EnumUtils;
|
|
||||||
import com.chushang.common.log.annotation.SysLog;
|
|
||||||
import com.chushang.security.annotation.Logical;
|
|
||||||
import com.chushang.security.annotation.RequiresPermissions;
|
|
||||||
import com.chushang.system.entity.bo.DataAuth;
|
|
||||||
import com.chushang.system.entity.enums.AuthTypeEnum;
|
|
||||||
import com.chushang.system.service.ISysUserDataService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author by zhaowenyuan create 2022/8/24 10:26
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping(value = "/data")
|
|
||||||
public class SysUserDataController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
ISysUserDataService userDataService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* todo 针对用户进行授权
|
|
||||||
* 数据权限授权
|
|
||||||
*/
|
|
||||||
@SysLog(value = "用户数据授权")
|
|
||||||
@PostMapping(value = "/{userId}/{dataType}")
|
|
||||||
@RequiresPermissions(value = {"system:app:auth","system:platform:auth"}, logical = Logical.OR)
|
|
||||||
public AjaxResult authData(@RequestBody Map<String, String> authDataMap,
|
|
||||||
@PathVariable Integer dataType,
|
|
||||||
@PathVariable Integer userId)
|
|
||||||
{
|
|
||||||
|
|
||||||
String authData = authDataMap.get("authData");
|
|
||||||
AuthTypeEnum authType = EnumUtils.getByCode(dataType, AuthTypeEnum.class);
|
|
||||||
if (null == authType){
|
|
||||||
throw new ResultException("授权类型不正确");
|
|
||||||
}
|
|
||||||
DataAuth dataAuth = new DataAuth();
|
|
||||||
// 格式为 用, 隔开的id
|
|
||||||
dataAuth.setAuthData(authData);
|
|
||||||
dataAuth.setUserId(userId);
|
|
||||||
dataAuth.setAuthType(authType);
|
|
||||||
|
|
||||||
userDataService.authData(dataAuth);
|
|
||||||
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* todo 数据权限授权查看
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/{userId}/{authType}")
|
|
||||||
@RequiresPermissions(value = {"system:app:auth","system:platform:auth"}, logical = Logical.OR)
|
|
||||||
public AjaxResult getAuthData(@PathVariable Integer userId,
|
|
||||||
@PathVariable Integer authType)
|
|
||||||
{
|
|
||||||
return AjaxResult.success( userDataService.getUserAuthData(userId, authType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
package com.chushang.system.controller;
|
package com.chushang.system.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.chushang.common.core.exception.ResultException;
|
import com.chushang.common.core.exception.ResultException;
|
||||||
import com.chushang.common.core.util.StringUtils;
|
import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.core.web.AjaxResult;
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
import com.chushang.common.core.web.Result;
|
|
||||||
import com.chushang.common.log.annotation.SysLog;
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
import com.chushang.common.mybatis.page.CommonParam;
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
import com.chushang.security.annotation.InnerAuth;
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
import com.chushang.security.annotation.RequiresPermissions;
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
import com.chushang.security.service.TokenService;
|
import com.chushang.security.service.TokenService;
|
||||||
import com.chushang.security.utils.SecurityUtils;
|
import com.chushang.security.utils.SecurityUtils;
|
||||||
|
|
@ -17,15 +14,13 @@ import com.chushang.system.entity.dto.ListUserDTO;
|
||||||
import com.chushang.system.entity.po.SysPost;
|
import com.chushang.system.entity.po.SysPost;
|
||||||
import com.chushang.system.entity.po.SysRole;
|
import com.chushang.system.entity.po.SysRole;
|
||||||
import com.chushang.system.entity.po.SysUser;
|
import com.chushang.system.entity.po.SysUser;
|
||||||
import com.chushang.system.entity.po.SysUserData;
|
|
||||||
import com.chushang.security.entity.vo.LoginUser;
|
import com.chushang.security.entity.vo.LoginUser;
|
||||||
import com.chushang.system.feign.RemoteUserService;
|
|
||||||
import com.chushang.system.service.*;
|
import com.chushang.system.service.*;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -35,19 +30,17 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/user")
|
@RequestMapping(value = "/user")
|
||||||
public class UserController implements RemoteUserService {
|
public class UserController {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
ISysUserService sysUserService;
|
ISysUserService sysUserService;
|
||||||
@Autowired
|
@Resource
|
||||||
ISysRoleService sysRoleService;
|
ISysRoleService sysRoleService;
|
||||||
@Autowired
|
@Resource
|
||||||
ISysPostService sysPostService;
|
ISysPostService sysPostService;
|
||||||
@Autowired
|
@Resource
|
||||||
ISysPermissionService permissionService;
|
ISysPermissionService permissionService;
|
||||||
@Autowired
|
@Resource
|
||||||
ISysUserDataService userDataService;
|
|
||||||
@Autowired
|
|
||||||
TokenService tokenService;
|
TokenService tokenService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,7 +60,7 @@ public class UserController implements RemoteUserService {
|
||||||
*/
|
*/
|
||||||
@GetMapping("info")
|
@GetMapping("info")
|
||||||
public AjaxResult getInfo() {
|
public AjaxResult getInfo() {
|
||||||
Integer userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||||
// 角色集合
|
// 角色集合
|
||||||
Set<String> roles = permissionService.getRolePermission(sysUser);
|
Set<String> roles = permissionService.getRolePermission(sysUser);
|
||||||
|
|
@ -89,26 +82,31 @@ public class UserController implements RemoteUserService {
|
||||||
{
|
{
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
SysUser user = sysUserService.selectUserByUserName(username);
|
SysUser user = sysUserService.selectUserByUserName(username);
|
||||||
|
user.setPassword(null);
|
||||||
|
user.setSalt(null);
|
||||||
return AjaxResult.success(user)
|
return AjaxResult.success(user)
|
||||||
.add("roleGroup", sysUserService.selectUserRoleGroup(username));
|
.add("roleGroup", sysUserService.selectUserRoleGroup(username))
|
||||||
|
.add("postGroup", sysUserService.selectUserPostGroup(username));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@SysLog("修改信息登录名称")
|
@SysLog(value = "信息登录名称", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/profile")
|
@PutMapping("/profile")
|
||||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||||
{
|
{
|
||||||
LoginUser<SysUser> loginUser = SecurityUtils.getLoginUser();
|
LoginUser<SysUser, DataScopeEntity> loginUser = SecurityUtils.getLoginUser();
|
||||||
String username = user.getUsername();
|
String username = user.getUsername();
|
||||||
if (!sysUserService.checkUsername(username)){
|
if (!sysUserService.checkUsername(username)){
|
||||||
SysUser sysUser = loginUser.getSysUser();
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
user.setUserId(sysUser.getUserId());
|
user.setUserId(sysUser.getUserId());
|
||||||
user.setUsername(username);
|
user.setUsername(username);
|
||||||
|
user.setEmail(user.getEmail());
|
||||||
|
user.setPhone(user.getPhone());
|
||||||
|
user.setGender(user.getGender());
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
user.setDeptId(null);
|
user.setDeptId(null);
|
||||||
|
|
||||||
if (sysUserService.updateUserProfile(user))
|
if (sysUserService.updateUserProfile(user))
|
||||||
{
|
{
|
||||||
// 更新缓存用户信息
|
// 更新缓存用户信息
|
||||||
|
|
@ -124,7 +122,7 @@ public class UserController implements RemoteUserService {
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:query")
|
@RequiresPermissions("system:user:query")
|
||||||
@GetMapping(value = {"/", "/{userId}"})
|
@GetMapping(value = {"/", "/{userId}"})
|
||||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Integer userId) {
|
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
|
||||||
sysUserService.checkUserDataScope(new SysUser(userId));
|
sysUserService.checkUserDataScope(new SysUser(userId));
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
List<SysRole> roles = sysRoleService.selectRoleAll(new SysRole());
|
List<SysRole> roles = sysRoleService.selectRoleAll(new SysRole());
|
||||||
|
|
@ -146,7 +144,7 @@ public class UserController implements RemoteUserService {
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SysLog("保存用户")
|
@SysLog(value = "用户", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@RequiresPermissions(value = "system:user:save")
|
@RequiresPermissions(value = "system:user:save")
|
||||||
public AjaxResult save(@RequestBody SysUser user) {
|
public AjaxResult save(@RequestBody SysUser user) {
|
||||||
|
|
@ -162,7 +160,7 @@ public class UserController implements RemoteUserService {
|
||||||
/**
|
/**
|
||||||
* 修改用户
|
* 修改用户
|
||||||
*/
|
*/
|
||||||
@SysLog("修改用户")
|
@SysLog(value = "用户", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@RequiresPermissions("system:user:update")
|
@RequiresPermissions("system:user:update")
|
||||||
public AjaxResult update(@RequestBody SysUser user) {
|
public AjaxResult update(@RequestBody SysUser user) {
|
||||||
|
|
@ -179,10 +177,10 @@ public class UserController implements RemoteUserService {
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
*/
|
*/
|
||||||
@SysLog("删除用户")
|
@SysLog(value = "用户", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{userIds}")
|
@DeleteMapping("/{userIds}")
|
||||||
@RequiresPermissions("system:user:delete")
|
@RequiresPermissions("system:user:delete")
|
||||||
public AjaxResult delete(@PathVariable Integer[] userIds) {
|
public AjaxResult delete(@PathVariable Long[] userIds) {
|
||||||
if (ArrayUtils.contains(userIds, 1)) {
|
if (ArrayUtils.contains(userIds, 1)) {
|
||||||
return AjaxResult.error("系统管理员不能删除");
|
return AjaxResult.error("系统管理员不能删除");
|
||||||
}
|
}
|
||||||
|
|
@ -200,13 +198,13 @@ public class UserController implements RemoteUserService {
|
||||||
* 修改自己的
|
* 修改自己的
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:updatePwd")
|
@RequiresPermissions("system:user:updatePwd")
|
||||||
@SysLog("修改密码")
|
@SysLog(value = "密码", businessType = BusinessType.DELETE)
|
||||||
@PutMapping("/updatePwd")
|
@PutMapping("/updatePwd")
|
||||||
public AjaxResult updatePwd(@RequestBody @Valid PasswordForm form)
|
public AjaxResult updatePwd(@RequestBody @Valid PasswordForm form)
|
||||||
{
|
{
|
||||||
LoginUser<SysUser> loginUser = SecurityUtils.getLoginUser();
|
// 这里没有密码
|
||||||
|
LoginUser<SysUser, DataScopeEntity> loginUser = SecurityUtils.getLoginUser();
|
||||||
SysUser sysUser = loginUser.getSysUser();
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
|
|
||||||
if (!SecurityUtils.matchesPassword(form.getOldPassword(), sysUser.getSalt(), sysUser.getPassword())){
|
if (!SecurityUtils.matchesPassword(form.getOldPassword(), sysUser.getSalt(), sysUser.getPassword())){
|
||||||
throw new ResultException("原密码不正确");
|
throw new ResultException("原密码不正确");
|
||||||
}
|
}
|
||||||
|
|
@ -228,10 +226,10 @@ public class UserController implements RemoteUserService {
|
||||||
* 重置密码 别人的
|
* 重置密码 别人的
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:resetPwd")
|
@RequiresPermissions("system:user:resetPwd")
|
||||||
@SysLog("重置密码")
|
@SysLog(value = "重置密码", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/resetPwd/{userId}")
|
@PutMapping("/resetPwd/{userId}")
|
||||||
public AjaxResult resetPwd(@RequestBody @Valid PasswordForm form,
|
public AjaxResult resetPwd(@RequestBody @Valid PasswordForm form,
|
||||||
@PathVariable Integer userId)
|
@PathVariable Long userId)
|
||||||
{
|
{
|
||||||
// 不允许操作超级管理账号
|
// 不允许操作超级管理账号
|
||||||
sysUserService.checkUserAllowed(new SysUser(userId));
|
sysUserService.checkUserAllowed(new SysUser(userId));
|
||||||
|
|
@ -243,11 +241,23 @@ public class UserController implements RemoteUserService {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@SysLog(value = "头像", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping(value = "/avatar")
|
||||||
|
public AjaxResult updateAvatar(@RequestBody SysUser user){
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
sysUserService.update(new SysUser()
|
||||||
|
.setUserId(userId)
|
||||||
|
.setAvatar(user.getAvatar())
|
||||||
|
);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态修改
|
* 状态修改
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:changeStatus")
|
@RequiresPermissions("system:user:changeStatus")
|
||||||
@SysLog("修改用户状态")
|
@SysLog(value = "用户状态", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public AjaxResult changeStatus(@RequestBody SysUser user)
|
public AjaxResult changeStatus(@RequestBody SysUser user)
|
||||||
{
|
{
|
||||||
|
|
@ -263,7 +273,7 @@ public class UserController implements RemoteUserService {
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:query")
|
@RequiresPermissions("system:user:query")
|
||||||
@GetMapping("/authRole/{userId}")
|
@GetMapping("/authRole/{userId}")
|
||||||
public AjaxResult authRole(@PathVariable Integer userId)
|
public AjaxResult authRole(@PathVariable Long userId)
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
SysUser user = sysUserService.selectUserById(userId);
|
SysUser user = sysUserService.selectUserById(userId);
|
||||||
|
|
@ -280,50 +290,15 @@ public class UserController implements RemoteUserService {
|
||||||
* 用户授权角色
|
* 用户授权角色
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:auth")
|
@RequiresPermissions("system:user:auth")
|
||||||
@SysLog("用户授权")
|
@SysLog(value = "用户", businessType = BusinessType.GRANT)
|
||||||
@PutMapping("/authRole")
|
@PutMapping("/authRole")
|
||||||
public AjaxResult insertAuthRole(Integer userId, Integer[] roleIds)
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||||
{
|
{
|
||||||
sysUserService.checkUserDataScope(new SysUser(userId));
|
sysUserService.checkUserDataScope(new SysUser(userId));
|
||||||
sysUserService.insertUserAuth(userId, roleIds);
|
sysUserService.insertUserAuth(userId, roleIds);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/info/{username}")
|
|
||||||
public Result<LoginUser<SysUser>> getUserInfo(@PathVariable("username") String username, String source)
|
|
||||||
{
|
|
||||||
SysUser sysUser = sysUserService.selectUserByUserName(username);
|
|
||||||
if (StringUtils.isNull(sysUser)) {
|
|
||||||
return Result.failed("用户名或密码错误");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 角色集合
|
|
||||||
Set<String> roles = permissionService.getRolePermission(sysUser);
|
|
||||||
// 权限集合
|
|
||||||
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
|
||||||
|
|
||||||
LoginUser<SysUser> sysUserVo = new LoginUser<>();
|
|
||||||
sysUserVo.setUserId(sysUser.getUserId());
|
|
||||||
sysUserVo.setUsername(sysUser.getUsername());
|
|
||||||
sysUserVo.setSysUser(sysUser);
|
|
||||||
sysUserVo.setRoles(roles);
|
|
||||||
sysUserVo.setPermissions(permissions);
|
|
||||||
// todo 用户拥有的数据权限
|
|
||||||
List<SysUserData> userDataList = userDataService.listUserData(sysUser);
|
|
||||||
// 默认传递一个空Map --> 拥有管理员
|
|
||||||
sysUserVo.setAuthDataMap(new HashMap<>());
|
|
||||||
// if (CollectionUtil.isNotEmpty(userDataList)){
|
|
||||||
// Map<String, Set<String>> authDataMap = new HashMap<>();
|
|
||||||
// // 对应的数据权限
|
|
||||||
// for (SysUserData sysUserData : userDataList) {
|
|
||||||
// authDataMap.put(sysUserData.getDataType().getCodeType(),
|
|
||||||
// new HashSet<>(JSONUtil.toList(sysUserData.getDataValue(), String.class)));
|
|
||||||
// }
|
|
||||||
// sysUserVo.setAuthDataMap(authDataMap);
|
|
||||||
// }
|
|
||||||
return Result.ok(sysUserVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* todo 导入用户
|
* todo 导入用户
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||||
|
|
||||||
List<SysDept> selectDeptList(ListDeptDTO listDept);
|
List<SysDept> selectDeptList(ListDeptDTO listDept);
|
||||||
|
|
||||||
List<Integer> selectDeptListByRoleId(@Param("roleId") Integer roleId,
|
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId,
|
||||||
@Param("deptCheckStrictly") boolean deptCheckStrictly);
|
@Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||||
|
|
||||||
void updateDeptChildren(@Param("depts") List<SysDept> depts);
|
void updateDeptChildren(@Param("depts") List<SysDept> depts);
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,19 @@ import java.util.Set;
|
||||||
* @since 2022-08-18
|
* @since 2022-08-18
|
||||||
*/
|
*/
|
||||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||||
Set<String> selectMenuPermsByUserId(Integer userId);
|
Set<String> selectMenuPermsByUserId(Long userId);
|
||||||
|
|
||||||
List<SysMenu> selectMenuList(ListMenuDTO menu);
|
List<SysMenu> selectMenuList(ListMenuDTO menu);
|
||||||
|
|
||||||
List<SysMenu> selectMenuListByUserId(ListMenuDTO menu);
|
List<SysMenu> selectMenuListByUserId(ListMenuDTO menu);
|
||||||
|
|
||||||
List<Integer> selectMenuListByRoleId(@Param("roleId") Integer roleId,
|
List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId,
|
||||||
@Param("menuCheckStrictly") boolean menuCheckStrictly);
|
@Param("menuCheckStrictly") boolean menuCheckStrictly);
|
||||||
|
|
||||||
List<SysMenu> selectMenuTreeAll();
|
List<SysMenu> selectMenuTreeAll();
|
||||||
|
|
||||||
|
|
||||||
List<SysMenu> selectMenuTreeByUserId(Integer userId);
|
List<SysMenu> selectMenuTreeByUserId(Long userId);
|
||||||
|
|
||||||
Set<String> selectMenuPermsByRoleId(@Param("roleId") Integer roleId);
|
Set<String> selectMenuPermsByRoleId(@Param("roleId") Long roleId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,9 @@ import java.util.List;
|
||||||
public interface SysPostMapper extends BaseMapper<SysPost> {
|
public interface SysPostMapper extends BaseMapper<SysPost> {
|
||||||
@Select("select p.post_id from sys_post p left join sys_user_post up on up.post_id = p.post_id " +
|
@Select("select p.post_id from sys_post p left join sys_user_post up on up.post_id = p.post_id " +
|
||||||
"left join sys_user u on u.user_id = up.user_id where u.user_id = #{userId}")
|
"left join sys_user u on u.user_id = up.user_id where u.user_id = #{userId}")
|
||||||
List<Long> selectPostListByUserId(@Param("userId") Integer userId);
|
List<Long> selectPostListByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
@Select("select p.post_id, p.post_name, p.post_code from sys_post p left join sys_user_post up on up.post_id = p.post_id " +
|
||||||
|
"left join sys_user u on u.user_id = up.user_id where u.username = #{username}")
|
||||||
|
List<SysPost> selectPostsByUserName(String username);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||||
List<SysRole> listRole(@Param("listRole") ListRoleDTO listRole,
|
List<SysRole> listRole(@Param("listRole") ListRoleDTO listRole,
|
||||||
Page<SysRole> page);
|
Page<SysRole> page);
|
||||||
|
|
||||||
SysRole selectRoleById(Integer roleId);
|
SysRole selectRoleById(Long roleId);
|
||||||
|
|
||||||
Set<SysRole> selectRoleByUsername(String username);
|
Set<SysRole> selectRoleByUsername(String username);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chushang.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.chushang.system.entity.po.SysTenant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户
|
||||||
|
*/
|
||||||
|
public interface SysTenantMapper extends BaseMapper<SysTenant> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chushang.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.chushang.system.entity.po.SysTenantPackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户套餐
|
||||||
|
*/
|
||||||
|
public interface SysTenantPackageMapper extends BaseMapper<SysTenantPackage> {
|
||||||
|
}
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
package com.chushang.system.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.chushang.system.entity.po.SysUserData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author by zhaowenyuan create 2022/9/14 10:24
|
|
||||||
*/
|
|
||||||
public interface SysUserDataMapper extends BaseMapper<SysUserData> {
|
|
||||||
}
|
|
||||||
|
|
@ -20,7 +20,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
|
|
||||||
SysUser selectUserByUserName(String username);
|
SysUser selectUserByUserName(String username);
|
||||||
|
|
||||||
SysUser selectUserById(Integer userId);
|
SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
|
||||||
List<SysUser> selectUserList(SysUser user);
|
List<SysUser> selectUserList(SysUser user);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.chushang.system.remote;
|
||||||
|
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
|
import com.chushang.system.feign.RemoteDataScopeService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/data/scope")
|
||||||
|
public class RemoteDataScopeController implements RemoteDataScopeService {
|
||||||
|
/**
|
||||||
|
* 获取对应的部门数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@GetMapping(value ="/dept/list")
|
||||||
|
public List<String> listDeptIds(@RequestParam(value = "dataScope") DataScopeEntity dataScope, String source)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.chushang.system.remote;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.chushang.common.core.web.AjaxResult;
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.common.log.annotation.SysLog;
|
||||||
|
import com.chushang.common.log.enums.BusinessType;
|
||||||
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
|
import com.chushang.security.annotation.InnerAuth;
|
||||||
|
import com.chushang.security.annotation.RequiresPermissions;
|
||||||
|
import com.chushang.system.entity.po.SysLoginInfo;
|
||||||
|
import com.chushang.system.feign.RemoteLoginInfoService;
|
||||||
|
import com.chushang.system.service.SysLoginInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/log/login/info")
|
||||||
|
public class RemoteLoginInfoController implements RemoteLoginInfoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysLoginInfoService sysLoginInfoService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@InnerAuth
|
||||||
|
@PostMapping
|
||||||
|
public Result<Boolean> saveLoginInfo(@RequestBody SysLoginInfo sysLogininfo, String source) {
|
||||||
|
return Result.ok(sysLoginInfoService.saveLoginInfo(sysLogininfo).isSuccess());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.chushang.system.remote;
|
||||||
|
|
||||||
|
import com.chushang.common.core.util.StringUtils;
|
||||||
|
import com.chushang.common.core.web.Result;
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
|
import com.chushang.security.annotation.InnerAuth;
|
||||||
|
import com.chushang.security.entity.vo.LoginUser;
|
||||||
|
import com.chushang.system.entity.po.SysUser;
|
||||||
|
import com.chushang.system.feign.RemoteUserService;
|
||||||
|
import com.chushang.system.service.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/user")
|
||||||
|
public class RemoteUserController implements RemoteUserService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
ISysRoleService sysRoleService;
|
||||||
|
@Autowired
|
||||||
|
ISysPostService sysPostService;
|
||||||
|
@Autowired
|
||||||
|
ISysPermissionService permissionService;
|
||||||
|
|
||||||
|
@InnerAuth
|
||||||
|
@GetMapping("/info/{username}")
|
||||||
|
public Result<LoginUser<SysUser, DataScopeEntity>> getUserInfo(@PathVariable("username") String username, String source)
|
||||||
|
{
|
||||||
|
SysUser sysUser = sysUserService.selectUserByUserName(username);
|
||||||
|
if (StringUtils.isNull(sysUser)) {
|
||||||
|
return Result.failed("用户名或密码错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 角色集合
|
||||||
|
Set<String> roles = permissionService.getRolePermission(sysUser);
|
||||||
|
// 权限集合
|
||||||
|
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
||||||
|
// 数据权限集合
|
||||||
|
List<DataScopeEntity> dataScopes = permissionService.getDataScopes(sysUser);
|
||||||
|
|
||||||
|
LoginUser<SysUser, DataScopeEntity> sysUserVo = new LoginUser<>();
|
||||||
|
sysUserVo.setUserId(sysUser.getUserId());
|
||||||
|
sysUserVo.setUsername(sysUser.getUsername());
|
||||||
|
sysUserVo.setSysUser(sysUser);
|
||||||
|
sysUserVo.setRoles(roles);
|
||||||
|
sysUserVo.setScopes(dataScopes);
|
||||||
|
sysUserVo.setPermissions(permissions);
|
||||||
|
// todo 用户拥有的数据权限
|
||||||
|
// List<SysUserData> userDataList = userDataService.listUserData(sysUser);
|
||||||
|
// 默认传递一个空Map --> 拥有管理员
|
||||||
|
sysUserVo.setAuthDataMap(new HashMap<>());
|
||||||
|
// if (CollectionUtil.isNotEmpty(userDataList)){
|
||||||
|
// Map<String, Set<String>> authDataMap = new HashMap<>();
|
||||||
|
// // 对应的数据权限
|
||||||
|
// for (SysUserData sysUserData : userDataList) {
|
||||||
|
// authDataMap.put(sysUserData.getDataType().getCodeType(),
|
||||||
|
// new HashSet<>(JSONUtil.toList(sysUserData.getDataValue(), String.class)));
|
||||||
|
// }
|
||||||
|
// sysUserVo.setAuthDataMap(authDataMap);
|
||||||
|
// }
|
||||||
|
return Result.ok(sysUserVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -24,16 +24,16 @@ public interface ISysDeptService extends IService<SysDept> {
|
||||||
|
|
||||||
List<SysDept> selectDeptList(ListDeptDTO listDept);
|
List<SysDept> selectDeptList(ListDeptDTO listDept);
|
||||||
|
|
||||||
void checkDeptDataScope(Integer deptId);
|
void checkDeptDataScope(Long deptId);
|
||||||
|
|
||||||
List<TreeSelect> buildDeptTreeSelect(List<SysDept> deptList);
|
List<TreeSelect> buildDeptTreeSelect(List<SysDept> deptList);
|
||||||
|
|
||||||
List<SysDept> buildDeptTree(List<SysDept> deptList);
|
List<SysDept> buildDeptTree(List<SysDept> deptList);
|
||||||
|
|
||||||
List<Integer> selectDeptListByRoleId(Integer roleId);
|
List<Long> selectDeptListByRoleId(Long roleId);
|
||||||
|
|
||||||
default boolean checkDeptNameUnique(SysDept dept){
|
default boolean checkDeptNameUnique(SysDept dept){
|
||||||
int deptId = StringUtils.isNull(dept.getDeptId()) ? -1 : dept.getDeptId();
|
long deptId = StringUtils.isNull(dept.getDeptId()) ? -1 : dept.getDeptId();
|
||||||
SysDept info = getOne(new LambdaQueryWrapper<SysDept>()
|
SysDept info = getOne(new LambdaQueryWrapper<SysDept>()
|
||||||
.eq(SysDept::getDeptName, dept.getDeptName())
|
.eq(SysDept::getDeptName, dept.getDeptName())
|
||||||
.eq(SysDept::getParentId, dept.getParentId())
|
.eq(SysDept::getParentId, dept.getParentId())
|
||||||
|
|
@ -41,19 +41,19 @@ public interface ISysDeptService extends IService<SysDept> {
|
||||||
return StringUtils.isNotNull(info) && info.getDeptId() != deptId;
|
return StringUtils.isNotNull(info) && info.getDeptId() != deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
default long selectNormalChildrenDeptById(Integer deptId){
|
default long selectNormalChildrenDeptById(Long deptId){
|
||||||
return count(new LambdaQueryWrapper<SysDept>()
|
return count(new LambdaQueryWrapper<SysDept>()
|
||||||
.eq(SysDept::getStatus, Boolean.FALSE)
|
.eq(SysDept::getStatus, Boolean.FALSE)
|
||||||
.apply("find_in_set({0}, ancestors)", deptId));
|
.apply("find_in_set({0}, ancestors)", deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean hasChildByDeptId(Integer deptId){
|
default boolean hasChildByDeptId(Long deptId){
|
||||||
return count(new LambdaQueryWrapper<SysDept>()
|
return count(new LambdaQueryWrapper<SysDept>()
|
||||||
.eq(SysDept::getParentId, deptId)
|
.eq(SysDept::getParentId, deptId)
|
||||||
) > 0;
|
) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean checkDeptExistUser(Integer deptId);
|
boolean checkDeptExistUser(Long deptId);
|
||||||
|
|
||||||
default void add(SysDept dept){
|
default void add(SysDept dept){
|
||||||
SysDept info = getById(dept.getParentId());
|
SysDept info = getById(dept.getParentId());
|
||||||
|
|
@ -101,19 +101,19 @@ public interface ISysDeptService extends IService<SysDept> {
|
||||||
.in(SysDept::getDeptId, List.of(deptIds)));
|
.in(SysDept::getDeptId, List.of(deptIds)));
|
||||||
}
|
}
|
||||||
|
|
||||||
default void updateDeptChildren(Integer deptId, String newAncestors, String oldAncestors){
|
default void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors){
|
||||||
List<SysDept> children = selectChildrenDeptById(deptId);
|
List<SysDept> children = selectChildrenDeptById(deptId);
|
||||||
for (SysDept child : children)
|
for (SysDept child : children)
|
||||||
{
|
{
|
||||||
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
|
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
|
||||||
}
|
}
|
||||||
if (children.size() > 0)
|
if (!children.isEmpty())
|
||||||
{
|
{
|
||||||
updateDeptChildren(children);
|
updateDeptChildren(children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<SysDept> selectChildrenDeptById(Integer deptId){
|
default List<SysDept> selectChildrenDeptById(Long deptId){
|
||||||
return list(new LambdaQueryWrapper<SysDept>()
|
return list(new LambdaQueryWrapper<SysDept>()
|
||||||
.apply(" find_in_set({0}, ancestors)", deptId));
|
.apply(" find_in_set({0}, ancestors)", deptId));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,24 +23,24 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public interface ISysMenuService extends IService<SysMenu> {
|
public interface ISysMenuService extends IService<SysMenu> {
|
||||||
|
|
||||||
Set<String> selectMenuPermsByUserId(Integer userId);
|
Set<String> selectMenuPermsByUserId(Long userId);
|
||||||
|
|
||||||
List<SysMenu> selectMenuList(ListMenuDTO menu, Integer userId);
|
List<SysMenu> selectMenuList(ListMenuDTO menu, Long userId);
|
||||||
|
|
||||||
default List<SysMenu> selectMenuList(Integer userId){
|
default List<SysMenu> selectMenuList(Long userId){
|
||||||
return selectMenuList(new ListMenuDTO(), userId);
|
return selectMenuList(new ListMenuDTO(), userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
default SysMenu selectMenuById(Integer menuId){
|
default SysMenu selectMenuById(Long menuId){
|
||||||
return getById(menuId);
|
return getById(menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus);
|
List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus);
|
||||||
|
|
||||||
List<Integer> selectMenuListByRoleId(Integer roleId);
|
List<Long> selectMenuListByRoleId(Long roleId);
|
||||||
|
|
||||||
default boolean checkMenuNameUnique(SysMenu menu){
|
default boolean checkMenuNameUnique(SysMenu menu){
|
||||||
int menuId = StringUtils.isNull(menu.getMenuId()) ? -1 : menu.getMenuId();
|
long menuId = StringUtils.isNull(menu.getMenuId()) ? -1 : menu.getMenuId();
|
||||||
SysMenu info = getOne(new LambdaQueryWrapper<SysMenu>()
|
SysMenu info = getOne(new LambdaQueryWrapper<SysMenu>()
|
||||||
.eq(SysMenu::getMenuName, menu.getMenuName())
|
.eq(SysMenu::getMenuName, menu.getMenuName())
|
||||||
.eq(SysMenu::getParentId, menu.getParentId())
|
.eq(SysMenu::getParentId, menu.getParentId())
|
||||||
|
|
@ -48,16 +48,16 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||||
return StringUtils.isNotNull(info) && info.getMenuId() != menuId;
|
return StringUtils.isNotNull(info) && info.getMenuId() != menuId;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean hasChildByMenuId(Integer menuId){
|
default boolean hasChildByMenuId(Long menuId){
|
||||||
return count(new LambdaQueryWrapper<SysMenu>()
|
return count(new LambdaQueryWrapper<SysMenu>()
|
||||||
.eq(SysMenu::getParentId, menuId)) > 0;
|
.eq(SysMenu::getParentId, menuId)) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean checkMenuExistRole(Integer menuId);
|
boolean checkMenuExistRole(Long menuId);
|
||||||
|
|
||||||
List<SysMenu> selectMenuTreeByUserId(SysUser sysUser);
|
List<SysMenu> selectMenuTreeByUserId(SysUser sysUser);
|
||||||
|
|
||||||
List<RouterVo> buildMenus(List<SysMenu> menus);
|
List<RouterVo> buildMenus(List<SysMenu> menus);
|
||||||
|
|
||||||
Set<String> selectMenuPermsByRoleId(Integer roleId);
|
Set<String> selectMenuPermsByRoleId(Long roleId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
package com.chushang.system.service;
|
package com.chushang.system.service;
|
||||||
|
|
||||||
|
import com.chushang.datascope.entity.DataScopeEntity;
|
||||||
|
import com.chushang.system.entity.po.SysRole;
|
||||||
import com.chushang.system.entity.po.SysUser;
|
import com.chushang.system.entity.po.SysUser;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author by zhaowenyuan create 2022/8/19 09:43
|
* @author by zhaowenyuan create 2022/8/19 09:43
|
||||||
|
|
@ -11,4 +16,22 @@ public interface ISysPermissionService {
|
||||||
Set<String> getRolePermission(SysUser sysUser);
|
Set<String> getRolePermission(SysUser sysUser);
|
||||||
|
|
||||||
Set<String> getMenuPermission(SysUser sysUser);
|
Set<String> getMenuPermission(SysUser sysUser);
|
||||||
|
|
||||||
|
default List<DataScopeEntity> getDataScopes(SysUser sysUser){
|
||||||
|
List<SysRole> roles = sysUser.getRoles();
|
||||||
|
return roles.stream().map(role -> {
|
||||||
|
String dataScope = role.getDataScope();
|
||||||
|
Long roleId = role.getRoleId();
|
||||||
|
Long deptId = sysUser.getDeptId();
|
||||||
|
Long userId = sysUser.getUserId();
|
||||||
|
Set<String> permissions = role.getPermissions();
|
||||||
|
return DataScopeEntity.builder()
|
||||||
|
.scope(dataScope)
|
||||||
|
.roleId(roleId)
|
||||||
|
.userId(userId)
|
||||||
|
.deptId(deptId)
|
||||||
|
.permissions(permissions)
|
||||||
|
.build();
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,17 @@ import com.chushang.common.core.util.StringUtils;
|
||||||
import com.chushang.common.mybatis.enums.Operator;
|
import com.chushang.common.mybatis.enums.Operator;
|
||||||
import com.chushang.common.mybatis.page.CommonParam;
|
import com.chushang.common.mybatis.page.CommonParam;
|
||||||
import com.chushang.common.mybatis.utils.PageResult;
|
import com.chushang.common.mybatis.utils.PageResult;
|
||||||
|
import com.chushang.datascope.annotation.DataScope;
|
||||||
import com.chushang.system.entity.po.SysPost;
|
import com.chushang.system.entity.po.SysPost;
|
||||||
import com.chushang.system.entity.po.SysRole;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.sf.jsqlparser.util.validation.metadata.NamedObject.role;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
* @date: 2024/5/9 15:53
|
* @date: 2024/5/9 15:53
|
||||||
*/
|
*/
|
||||||
public interface ISysPostService extends IService<SysPost> {
|
public interface ISysPostService extends IService<SysPost> {
|
||||||
|
@DataScope(deptAlias = "d")
|
||||||
default PageResult pagePostList(SysPost sysPost, CommonParam commonParam){
|
default PageResult pagePostList(SysPost sysPost, CommonParam commonParam){
|
||||||
IPage<SysPost> page = this.page(
|
IPage<SysPost> page = this.page(
|
||||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||||
|
|
@ -41,7 +40,7 @@ public interface ISysPostService extends IService<SysPost> {
|
||||||
|
|
||||||
|
|
||||||
default boolean checkPostUnique(SysPost post){
|
default boolean checkPostUnique(SysPost post){
|
||||||
int postId = ObjectUtil.isNull(post.getPostId()) ? -1 : post.getPostId();
|
long postId = ObjectUtil.isNull(post.getPostId()) ? -1 : post.getPostId();
|
||||||
SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
|
SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
|
||||||
.eq(StringUtils.isNotEmpty(post.getPostName()),SysPost::getPostName, post.getPostName())
|
.eq(StringUtils.isNotEmpty(post.getPostName()),SysPost::getPostName, post.getPostName())
|
||||||
.eq(StringUtils.isNotEmpty(post.getPostCode()),SysPost::getPostCode, post.getPostCode())
|
.eq(StringUtils.isNotEmpty(post.getPostCode()),SysPost::getPostCode, post.getPostCode())
|
||||||
|
|
@ -49,5 +48,7 @@ public interface ISysPostService extends IService<SysPost> {
|
||||||
return ObjectUtil.isNotNull(info) && info.getPostId() != postId;
|
return ObjectUtil.isNotNull(info) && info.getPostId() != postId;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> selectPostListByUserId(Integer userId);
|
List<Long> selectPostListByUserId(Long userId);
|
||||||
|
|
||||||
|
String selectUserPostGroup(String username);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ISysRoleDeptService extends IService<SysRoleDept> {
|
public interface ISysRoleDeptService extends IService<SysRoleDept> {
|
||||||
@Transactional
|
@Transactional
|
||||||
default void saveBatch(Integer roleId, Integer[] deptIds){
|
default void saveBatch(Long roleId, Long[] deptIds){
|
||||||
|
|
||||||
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
||||||
|
|
||||||
// 新增角色与部门(数据权限)管理
|
// 新增角色与部门(数据权限)管理
|
||||||
List<SysRoleDept> list = new ArrayList<>();
|
List<SysRoleDept> list = new ArrayList<>();
|
||||||
for (Integer deptId : deptIds)
|
for (Long deptId : deptIds)
|
||||||
{
|
{
|
||||||
SysRoleDept rd = new SysRoleDept();
|
SysRoleDept rd = new SysRoleDept();
|
||||||
rd.setRoleId(roleId);
|
rd.setRoleId(roleId);
|
||||||
|
|
@ -38,13 +38,13 @@ public interface ISysRoleDeptService extends IService<SysRoleDept> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
default void deleteRoleDept(List<Integer> roleIds){
|
default void deleteRoleDept(List<Long> roleIds){
|
||||||
if (CollectionUtil.isNotEmpty(roleIds)){
|
if (CollectionUtil.isNotEmpty(roleIds)){
|
||||||
roleIds.forEach(this::removeByRoleId);
|
roleIds.forEach(this::removeByRoleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
default void removeByRoleId(Integer roleId){
|
default void removeByRoleId(Long roleId){
|
||||||
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
remove(new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ISysRoleMenuService extends IService<SysRoleMenu> {
|
public interface ISysRoleMenuService extends IService<SysRoleMenu> {
|
||||||
@Transactional
|
@Transactional
|
||||||
default void saveBatch(Integer roleId, Integer[] menuIds){
|
default void saveBatch(Long roleId, Long[] menuIds){
|
||||||
// 先删除 对应的角色菜单
|
// 先删除 对应的角色菜单
|
||||||
remove(new LambdaQueryWrapper<SysRoleMenu>()
|
remove(new LambdaQueryWrapper<SysRoleMenu>()
|
||||||
.eq(SysRoleMenu::getRoleId, roleId));
|
.eq(SysRoleMenu::getRoleId, roleId));
|
||||||
if (null != menuIds && menuIds.length > 0){
|
if (null != menuIds && menuIds.length > 0){
|
||||||
List<SysRoleMenu> list = new ArrayList<>();
|
List<SysRoleMenu> list = new ArrayList<>();
|
||||||
for (Integer menuId : menuIds) {
|
for (Long menuId : menuIds) {
|
||||||
SysRoleMenu rm = new SysRoleMenu();
|
SysRoleMenu rm = new SysRoleMenu();
|
||||||
rm.setRoleId(roleId);
|
rm.setRoleId(roleId);
|
||||||
rm.setMenuId(menuId);
|
rm.setMenuId(menuId);
|
||||||
|
|
@ -36,17 +36,17 @@ public interface ISysRoleMenuService extends IService<SysRoleMenu> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
default void deleteRoleMenu(Collection<Integer> roleIds){
|
default void deleteRoleMenu(Collection<Long> roleIds){
|
||||||
if (CollectionUtil.isNotEmpty(roleIds)){
|
if (CollectionUtil.isNotEmpty(roleIds)){
|
||||||
roleIds.forEach(this::removeByRoleId);
|
roleIds.forEach(this::removeByRoleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
default void removeByRoleId(Integer roleId){
|
default void removeByRoleId(Long roleId){
|
||||||
remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean checkMenuExistRole(Integer menuId){
|
default boolean checkMenuExistRole(Long menuId){
|
||||||
return count(new LambdaQueryWrapper<SysRoleMenu>()
|
return count(new LambdaQueryWrapper<SysRoleMenu>()
|
||||||
.eq(SysRoleMenu::getMenuId, menuId)) > 0;
|
.eq(SysRoleMenu::getMenuId, menuId)) > 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||||
|
|
||||||
void checkRoleDataScope(SysRole role);
|
void checkRoleDataScope(SysRole role);
|
||||||
|
|
||||||
SysRole selectRoleById(Integer roleId);
|
SysRole selectRoleById(Long roleId);
|
||||||
|
|
||||||
default boolean checkRoleNameUnique(SysRole role){
|
default boolean checkRoleNameUnique(SysRole role){
|
||||||
int roleId = ObjectUtil.isNull(role.getRoleId()) ? -1 : role.getRoleId();
|
long roleId = ObjectUtil.isNull(role.getRoleId()) ? -1 : role.getRoleId();
|
||||||
SysRole info = getOne(new LambdaQueryWrapper<SysRole>()
|
SysRole info = getOne(new LambdaQueryWrapper<SysRole>()
|
||||||
.eq(SysRole::getRoleName, role.getRoleName())
|
.eq(SysRole::getRoleName, role.getRoleName())
|
||||||
.last(Operator.LIMIT_ONE.getCharacter()));
|
.last(Operator.LIMIT_ONE.getCharacter()));
|
||||||
|
|
@ -43,7 +43,7 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean checkRoleKeyUnique(SysRole role){
|
default boolean checkRoleKeyUnique(SysRole role){
|
||||||
int roleId = ObjectUtil.isNull(role.getRoleId()) ? -1 : role.getRoleId();
|
long roleId = ObjectUtil.isNull(role.getRoleId()) ? -1 : role.getRoleId();
|
||||||
SysRole info = getOne(new LambdaQueryWrapper<SysRole>()
|
SysRole info = getOne(new LambdaQueryWrapper<SysRole>()
|
||||||
.eq(SysRole::getRoleKey, role.getRoleKey())
|
.eq(SysRole::getRoleKey, role.getRoleKey())
|
||||||
.last(Operator.LIMIT_ONE.getCharacter()));
|
.last(Operator.LIMIT_ONE.getCharacter()));
|
||||||
|
|
@ -53,7 +53,7 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||||
void saveRole(SysRole role);
|
void saveRole(SysRole role);
|
||||||
|
|
||||||
default void checkRoleAllowed(SysRole role){
|
default void checkRoleAllowed(SysRole role){
|
||||||
Integer roleId = role.getRoleId();
|
Long roleId = role.getRoleId();
|
||||||
if (StringUtils.isNotNull(roleId) && role.isAdmin())
|
if (StringUtils.isNotNull(roleId) && role.isAdmin())
|
||||||
{
|
{
|
||||||
throw new ResultException("不允许操作超级管理员角色");
|
throw new ResultException("不允许操作超级管理员角色");
|
||||||
|
|
@ -68,11 +68,11 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||||
updateById(role);
|
updateById(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteRoleByIds(Integer[] roleIds);
|
void deleteRoleByIds(Long[] roleIds);
|
||||||
|
|
||||||
void deleteAuthUser(CancelUserRole cancelUserRole);
|
void deleteAuthUser(CancelUserRole cancelUserRole);
|
||||||
|
|
||||||
void insertAuthUsers(Integer roleId, Integer[] userIds);
|
void insertAuthUsers(Long roleId, Long[] userIds);
|
||||||
|
|
||||||
String selectRolesByUserName(String username);
|
String selectRolesByUserName(String username);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
package com.chushang.system.service;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.chushang.system.entity.bo.DataAuth;
|
|
||||||
import com.chushang.system.entity.enums.AuthTypeEnum;
|
|
||||||
import com.chushang.system.entity.po.SysUser;
|
|
||||||
import com.chushang.system.entity.po.SysUserData;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author by zhaowenyuan create 2022/9/14 10:24
|
|
||||||
*/
|
|
||||||
public interface ISysUserDataService extends IService<SysUserData> {
|
|
||||||
|
|
||||||
default List<SysUserData> listUserData(SysUser sysUser){
|
|
||||||
return list(new LambdaQueryWrapper<SysUserData>()
|
|
||||||
.eq(SysUserData::getUserId, sysUser.getUserId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
default void authData(DataAuth dataAuth){
|
|
||||||
LambdaQueryWrapper<SysUserData> queryWrapper = new LambdaQueryWrapper<SysUserData>()
|
|
||||||
.eq(SysUserData::getUserId, dataAuth.getUserId())
|
|
||||||
.eq(SysUserData::getDataType, dataAuth.getAuthType());
|
|
||||||
long count = count(queryWrapper);
|
|
||||||
// 不存在就进行新增
|
|
||||||
if (count <= 0 ){
|
|
||||||
save(SysUserData.builder()
|
|
||||||
.userId(dataAuth.getUserId())
|
|
||||||
.dataType(dataAuth.getAuthType())
|
|
||||||
.dataValue(dataAuth.getAuthData())
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
// 存在就进行更新
|
|
||||||
else {
|
|
||||||
update(SysUserData.builder()
|
|
||||||
.dataValue(dataAuth.getAuthData())
|
|
||||||
.build(), queryWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
default List<Integer> getUserAuthData(Integer userId, Integer authType){
|
|
||||||
SysUserData userData = getOne(new LambdaQueryWrapper<SysUserData>()
|
|
||||||
.eq(SysUserData::getUserId, userId)
|
|
||||||
.eq(SysUserData::getDataType, authType));
|
|
||||||
if (ObjectUtil.isNotEmpty(userData)){
|
|
||||||
return JSONUtil.toList(userData.getDataValue(), Integer.class);
|
|
||||||
}
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
default void authData(List<DataAuth> dataAuthList){
|
|
||||||
dataAuthList.forEach(this::authData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void authData(Integer userId, Integer appId, AuthTypeEnum authType);
|
|
||||||
}
|
|
||||||
|
|
@ -20,7 +20,7 @@ import java.util.stream.Collectors;
|
||||||
public interface ISysUserRoleService extends IService<SysUserRole> {
|
public interface ISysUserRoleService extends IService<SysUserRole> {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
default void saveOrUpdate(Integer userId, Integer[] roleIdList){
|
default void saveOrUpdate(Long userId, Long[] roleIdList){
|
||||||
//先删除用户与角色关系
|
//先删除用户与角色关系
|
||||||
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getUserId, userId));
|
.eq(SysUserRole::getUserId, userId));
|
||||||
|
|
@ -35,7 +35,7 @@ public interface ISysUserRoleService extends IService<SysUserRole> {
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
default void saveOrUpdate(Integer[] userIdList, Integer roleId){
|
default void saveOrUpdate(Long[] userIdList, Long roleId){
|
||||||
//先删除用户与角色关系
|
//先删除用户与角色关系
|
||||||
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
this.remove(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getRoleId, roleId));
|
.eq(SysUserRole::getRoleId, roleId));
|
||||||
|
|
@ -55,7 +55,7 @@ public interface ISysUserRoleService extends IService<SysUserRole> {
|
||||||
.eq(SysUserRole::getUserId, userId));
|
.eq(SysUserRole::getUserId, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default long countUserRoleByRoleId(Integer roleId){
|
default long countUserRoleByRoleId(Long roleId){
|
||||||
return count(new LambdaQueryWrapper<SysUserRole>()
|
return count(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getRoleId, roleId));
|
.eq(SysUserRole::getRoleId, roleId));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||||
|
|
||||||
SysUser selectUserByUserName(String username);
|
SysUser selectUserByUserName(String username);
|
||||||
|
|
||||||
SysUser selectUserById(Integer userId);
|
SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
void checkUserDataScope(SysUser user);
|
void checkUserDataScope(SysUser user);
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||||
|
|
||||||
void update(SysUser user);
|
void update(SysUser user);
|
||||||
|
|
||||||
void deleteBatch(Integer[] userIds);
|
void deleteBatch(Long[] userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否为超级管理员 账号
|
* 判断是否为超级管理员 账号
|
||||||
|
|
@ -43,7 +43,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean updatePassword(Integer userId, String oldPassword, String newPassword){
|
default boolean updatePassword(Long userId, String oldPassword, String newPassword){
|
||||||
return this.update(SysUser.builder()
|
return this.update(SysUser.builder()
|
||||||
.password(newPassword)
|
.password(newPassword)
|
||||||
.updateBy(SecurityUtils.getUsername())
|
.updateBy(SecurityUtils.getUsername())
|
||||||
|
|
@ -62,7 +62,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||||
.eq(SysUser::getUserId, user.getUserId()));
|
.eq(SysUser::getUserId, user.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertUserAuth(Integer userId, Integer[] roleIds);
|
void insertUserAuth(Long userId, Long[] roleIds);
|
||||||
|
|
||||||
AjaxResult selectAllocatedList(ListUserDTO listUser);
|
AjaxResult selectAllocatedList(ListUserDTO listUser);
|
||||||
|
|
||||||
|
|
@ -79,12 +79,14 @@ public interface ISysUserService extends IService<SysUser> {
|
||||||
|
|
||||||
String selectUserRoleGroup(String username);
|
String selectUserRoleGroup(String username);
|
||||||
|
|
||||||
default boolean checkDeptExistUser(Integer deptId){
|
String selectUserPostGroup(String username);
|
||||||
|
|
||||||
|
default boolean checkDeptExistUser(Long deptId){
|
||||||
return count(new LambdaQueryWrapper<SysUser>()
|
return count(new LambdaQueryWrapper<SysUser>()
|
||||||
.eq(SysUser::getDeptId, deptId)) > 0;
|
.eq(SysUser::getDeptId, deptId)) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetPwd(Integer userId, String newPassword);
|
void resetPwd(Long userId, String newPassword);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.chushang.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chushang.system.entity.po.SysTenantPackage;
|
||||||
|
|
||||||
|
public interface SysTenantPackageService extends IService<SysTenantPackage> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.chushang.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chushang.system.entity.po.SysTenant;
|
||||||
|
|
||||||
|
public interface SysTenantService extends IService<SysTenant> {
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue