sync -- 同步 RuoYi-Vue-Plus(v4.3.0) 更新
This commit is contained in:
@@ -37,7 +37,7 @@ public interface ISysConfigService {
|
||||
*
|
||||
* @return true开启,false关闭
|
||||
*/
|
||||
boolean selectCaptchaOnOff();
|
||||
boolean selectCaptchaEnabled();
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
@@ -53,7 +53,7 @@ public interface ISysConfigService {
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertConfig(SysConfig config);
|
||||
String insertConfig(SysConfig config);
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
@@ -61,7 +61,7 @@ public interface ISysConfigService {
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateConfig(SysConfig config);
|
||||
String updateConfig(SysConfig config);
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
@@ -93,6 +93,4 @@ public interface ISysConfigService {
|
||||
*/
|
||||
String checkConfigKeyUnique(SysConfig config);
|
||||
|
||||
SysConfig getOne(SysConfig config);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,14 @@ public interface ISysDeptService {
|
||||
*/
|
||||
List<SysDept> selectDeptList(SysDept dept);
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
List<Tree<Long>> selectDeptTreeList(SysDept dept);
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface ISysDictDataService {
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDictData(SysDictData dictData);
|
||||
List<SysDictData> insertDictData(SysDictData dictData);
|
||||
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
@@ -62,5 +62,5 @@ public interface ISysDictDataService {
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDictData(SysDictData dictData);
|
||||
List<SysDictData> updateDictData(SysDictData dictData);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface ISysDictTypeService {
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDictType(SysDictType dictType);
|
||||
List<SysDictData> insertDictType(SysDictType dictType);
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
@@ -92,7 +92,7 @@ public interface ISysDictTypeService {
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDictType(SysDictType dictType);
|
||||
List<SysDictData> updateDictType(SysDictType dictType);
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
|
||||
@@ -39,6 +39,14 @@ public interface ISysMenuService {
|
||||
*/
|
||||
Set<String> selectMenuPermsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
Set<String> selectMenuPermsByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单树信息
|
||||
*
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface ISysOssService {
|
||||
|
||||
List<SysOssVo> listByIds(Collection<Long> ossIds);
|
||||
|
||||
SysOss getById(Long ossId);
|
||||
SysOssVo getById(Long ossId);
|
||||
|
||||
SysOss upload(MultipartFile file);
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.dto.RoleDTO;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
@@ -13,9 +15,7 @@ import com.ruoyi.common.core.service.LogininforService;
|
||||
import com.ruoyi.common.enums.DeviceType;
|
||||
import com.ruoyi.common.enums.LoginType;
|
||||
import com.ruoyi.common.enums.UserStatus;
|
||||
import com.ruoyi.common.exception.user.CaptchaException;
|
||||
import com.ruoyi.common.exception.user.CaptchaExpireException;
|
||||
import com.ruoyi.common.exception.user.UserException;
|
||||
import com.ruoyi.common.exception.user.*;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
@@ -24,6 +24,7 @@ import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -46,6 +47,12 @@ public class SysLoginService {
|
||||
private final LogininforService asyncService;
|
||||
private final SysPermissionService permissionService;
|
||||
|
||||
@Value("${user.password.maxRetryCount}")
|
||||
private Integer maxRetryCount;
|
||||
|
||||
@Value("${user.password.lockTime}")
|
||||
private Integer lockTime;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
@@ -57,9 +64,9 @@ public class SysLoginService {
|
||||
*/
|
||||
public String login(String username, String password, String code, String uuid) {
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
boolean captchaOnOff = configService.selectCaptchaOnOff();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
// 验证码开关
|
||||
if (captchaOnOff) {
|
||||
if (captchaEnabled) {
|
||||
validateCaptcha(username, code, uuid, request);
|
||||
}
|
||||
SysUser user = loadUserByUsername(username);
|
||||
@@ -113,16 +120,23 @@ public class SysLoginService {
|
||||
return StpUtil.getTokenValue();
|
||||
}
|
||||
|
||||
|
||||
public void logout(String loginName) {
|
||||
asyncService.recordLogininfor(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"), ServletUtils.getRequest());
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
public void logout() {
|
||||
try {
|
||||
String username = LoginHelper.getUsername();
|
||||
StpUtil.logout();
|
||||
asyncService.recordLogininfor(username, Constants.LOGOUT, MessageUtils.message("user.logout.success"), ServletUtils.getRequest());
|
||||
} catch (NotLoginException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验短信验证码
|
||||
*/
|
||||
private boolean validateSmsCode(String phonenumber, String smsCode, HttpServletRequest request) {
|
||||
String code = RedisUtils.getCacheObject(Constants.CAPTCHA_CODE_KEY + phonenumber);
|
||||
String code = RedisUtils.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + phonenumber);
|
||||
if (StringUtils.isBlank(code)) {
|
||||
asyncService.recordLogininfor(phonenumber, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"), request);
|
||||
throw new CaptchaExpireException();
|
||||
@@ -138,7 +152,7 @@ public class SysLoginService {
|
||||
* @param uuid 唯一标识
|
||||
*/
|
||||
public void validateCaptcha(String username, String code, String uuid, HttpServletRequest request) {
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
|
||||
String captcha = RedisUtils.getCacheObject(verifyKey);
|
||||
RedisUtils.deleteObject(verifyKey);
|
||||
if (captcha == null) {
|
||||
@@ -235,27 +249,25 @@ public class SysLoginService {
|
||||
*/
|
||||
private void checkLogin(LoginType loginType, String username, Supplier<Boolean> supplier) {
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
String errorKey = Constants.LOGIN_ERROR + username;
|
||||
Integer errorLimitTime = Constants.LOGIN_ERROR_LIMIT_TIME;
|
||||
Integer setErrorNumber = Constants.LOGIN_ERROR_NUMBER;
|
||||
String errorKey = CacheConstants.PWD_ERR_CNT_KEY + username;
|
||||
String loginFail = Constants.LOGIN_FAIL;
|
||||
|
||||
// 获取用户登录错误次数(可自定义限制策略 例如: key + username + ip)
|
||||
Integer errorNumber = RedisUtils.getCacheObject(errorKey);
|
||||
// 锁定时间内登录 则踢出
|
||||
if (ObjectUtil.isNotNull(errorNumber) && errorNumber.equals(setErrorNumber)) {
|
||||
asyncService.recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), errorLimitTime), request);
|
||||
throw new UserException(loginType.getRetryLimitExceed(), errorLimitTime);
|
||||
if (ObjectUtil.isNotNull(errorNumber) && errorNumber.equals(maxRetryCount)) {
|
||||
asyncService.recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), maxRetryCount, lockTime), request);
|
||||
throw new UserException(loginType.getRetryLimitExceed(), maxRetryCount, lockTime);
|
||||
}
|
||||
|
||||
if (supplier.get()) {
|
||||
// 是否第一次
|
||||
errorNumber = ObjectUtil.isNull(errorNumber) ? 1 : errorNumber + 1;
|
||||
// 达到规定错误次数 则锁定登录
|
||||
if (errorNumber.equals(setErrorNumber)) {
|
||||
RedisUtils.setCacheObject(errorKey, errorNumber, Duration.ofMinutes(errorLimitTime));
|
||||
asyncService.recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), errorLimitTime), request);
|
||||
throw new UserException(loginType.getRetryLimitExceed(), errorLimitTime);
|
||||
if (errorNumber.equals(maxRetryCount)) {
|
||||
RedisUtils.setCacheObject(errorKey, errorNumber, Duration.ofMinutes(lockTime));
|
||||
asyncService.recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitExceed(), maxRetryCount, lockTime), request);
|
||||
throw new UserException(loginType.getRetryLimitExceed(), maxRetryCount, lockTime);
|
||||
} else {
|
||||
// 未达到规定错误次数 则递增
|
||||
RedisUtils.setCacheObject(errorKey, errorNumber);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -48,7 +50,17 @@ public class SysPermissionService {
|
||||
if (user.isAdmin()) {
|
||||
perms.add("*:*:*");
|
||||
} else {
|
||||
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
|
||||
List<SysRole> roles = user.getRoles();
|
||||
if (!roles.isEmpty() && roles.size() > 1) {
|
||||
// 多角色设置permissions属性,以便数据权限匹配权限
|
||||
for (SysRole role : roles) {
|
||||
Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
||||
role.setPermissions(rolePerms);
|
||||
perms.addAll(rolePerms);
|
||||
}
|
||||
} else {
|
||||
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
|
||||
}
|
||||
}
|
||||
return perms;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
@@ -42,9 +43,9 @@ public class SysRegisterService {
|
||||
// 校验用户类型是否存在
|
||||
String userType = UserType.getUserType(registerBody.getUserType()).getUserType();
|
||||
|
||||
boolean captchaOnOff = configService.selectCaptchaOnOff();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
// 验证码开关
|
||||
if (captchaOnOff) {
|
||||
if (captchaEnabled) {
|
||||
validateCaptcha(username, registerBody.getCode(), registerBody.getUuid(), request);
|
||||
}
|
||||
|
||||
@@ -72,7 +73,7 @@ public class SysRegisterService {
|
||||
* @return 结果
|
||||
*/
|
||||
public void validateCaptcha(String username, String code, String uuid, HttpServletRequest request) {
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
|
||||
String captcha = RedisUtils.getCacheObject(verifyKey);
|
||||
RedisUtils.deleteObject(verifyKey);
|
||||
if (captcha == null) {
|
||||
|
||||
@@ -5,22 +5,23 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.CacheNames;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.service.ConfigService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.common.utils.redis.CacheUtils;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.mapper.SysConfigMapper;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -66,16 +67,12 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
* @param configKey 参数key
|
||||
* @return 参数键值
|
||||
*/
|
||||
@Cacheable(cacheNames = CacheNames.SYS_CONFIG, key = "#configKey")
|
||||
@Override
|
||||
public String selectConfigByKey(String configKey) {
|
||||
String configValue = RedisUtils.getCacheObject(getCacheKey(configKey));
|
||||
if (StringUtils.isNotEmpty(configValue)) {
|
||||
return configValue;
|
||||
}
|
||||
SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>()
|
||||
.eq(SysConfig::getConfigKey, configKey));
|
||||
if (ObjectUtil.isNotNull(retConfig)) {
|
||||
RedisUtils.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue());
|
||||
return retConfig.getConfigValue();
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
@@ -87,12 +84,12 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
* @return true开启,false关闭
|
||||
*/
|
||||
@Override
|
||||
public boolean selectCaptchaOnOff() {
|
||||
String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff");
|
||||
if (StringUtils.isEmpty(captchaOnOff)) {
|
||||
public boolean selectCaptchaEnabled() {
|
||||
String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled");
|
||||
if (StringUtils.isEmpty(captchaEnabled)) {
|
||||
return true;
|
||||
}
|
||||
return Convert.toBool(captchaOnOff);
|
||||
return Convert.toBool(captchaEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,13 +116,14 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#config.configKey")
|
||||
@Override
|
||||
public int insertConfig(SysConfig config) {
|
||||
public String insertConfig(SysConfig config) {
|
||||
int row = baseMapper.insert(config);
|
||||
if (row > 0) {
|
||||
RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||
return config.getConfigValue();
|
||||
}
|
||||
return row;
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,8 +132,9 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#config.configKey")
|
||||
@Override
|
||||
public int updateConfig(SysConfig config) {
|
||||
public String updateConfig(SysConfig config) {
|
||||
int row = 0;
|
||||
if (config.getConfigId() != null) {
|
||||
row = baseMapper.updateById(config);
|
||||
@@ -144,9 +143,9 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
.eq(SysConfig::getConfigKey, config.getConfigKey()));
|
||||
}
|
||||
if (row > 0) {
|
||||
RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||
return config.getConfigValue();
|
||||
}
|
||||
return row;
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +160,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
if (StringUtils.equals(UserConstants.YES, config.getConfigType())) {
|
||||
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
||||
}
|
||||
RedisUtils.deleteObject(getCacheKey(config.getConfigKey()));
|
||||
CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey());
|
||||
}
|
||||
baseMapper.deleteBatchIds(Arrays.asList(configIds));
|
||||
}
|
||||
@@ -172,9 +171,8 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
@Override
|
||||
public void loadingConfigCache() {
|
||||
List<SysConfig> configsList = selectConfigList(new SysConfig());
|
||||
for (SysConfig config : configsList) {
|
||||
RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||
}
|
||||
configsList.forEach(config ->
|
||||
CacheUtils.put(CacheNames.SYS_CONFIG, config.getConfigKey(), config.getConfigValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,8 +180,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
*/
|
||||
@Override
|
||||
public void clearConfigCache() {
|
||||
Collection<String> keys = RedisUtils.keys(Constants.SYS_CONFIG_KEY + "*");
|
||||
RedisUtils.deleteObject(keys);
|
||||
CacheUtils.clear(CacheNames.SYS_CONFIG);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,11 +208,6 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysConfig getOne(SysConfig config) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<>(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数 key 获取参数值
|
||||
*
|
||||
@@ -227,13 +219,4 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
return selectConfigByKey(configKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
private String getCacheKey(String configKey) {
|
||||
return Constants.SYS_CONFIG_KEY + configKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.helper.DataBaseHelper;
|
||||
import com.ruoyi.common.utils.StreamUtils;
|
||||
import com.ruoyi.system.domain.SysRoleDept;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleDeptMapper;
|
||||
@@ -13,7 +14,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据权限 实现
|
||||
@@ -37,7 +37,7 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
||||
.select(SysRoleDept::getDeptId)
|
||||
.eq(SysRoleDept::getRoleId, roleId));
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return list.stream().map(rd -> Convert.toStr(rd.getDeptId())).collect(Collectors.joining(","));
|
||||
return StreamUtils.join(list, rd -> Convert.toStr(rd.getDeptId()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -47,13 +47,13 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptId)
|
||||
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
||||
List<Long> ids = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||
ids.add(deptId);
|
||||
List<SysDept> list = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptId)
|
||||
.in(SysDept::getDeptId, ids));
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return list.stream().map(d -> Convert.toStr(d.getDeptId())).collect(Collectors.joining(","));
|
||||
return StreamUtils.join(list, d -> Convert.toStr(d.getDeptId()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,18 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
return baseMapper.selectDeptList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<Tree<Long>> selectDeptTreeList(SysDept dept) {
|
||||
List<SysDept> depts = this.selectDeptList(dept);
|
||||
return buildDeptTreeSelect(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
@@ -96,7 +108,11 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
*/
|
||||
@Override
|
||||
public SysDept selectDeptById(Long deptId) {
|
||||
return baseMapper.selectById(deptId);
|
||||
SysDept dept = baseMapper.selectById(deptId);
|
||||
SysDept parentDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
||||
dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null);
|
||||
return dept;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,15 +2,17 @@ package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.CacheNames;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.common.utils.redis.CacheUtils;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -89,8 +91,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
for (Long dictCode : dictCodes) {
|
||||
SysDictData data = selectDictDataById(dictCode);
|
||||
baseMapper.deleteById(dictCode);
|
||||
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
||||
RedisUtils.setCacheObject(getCacheKey(data.getDictType()), dictDatas);
|
||||
CacheUtils.evict(CacheNames.SYS_DICT, data.getDictType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,14 +101,14 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
* @param data 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#data.dictType")
|
||||
@Override
|
||||
public int insertDictData(SysDictData data) {
|
||||
public List<SysDictData> insertDictData(SysDictData data) {
|
||||
int row = baseMapper.insert(data);
|
||||
if (row > 0) {
|
||||
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
||||
RedisUtils.setCacheObject(getCacheKey(data.getDictType()), dictDatas);
|
||||
return baseMapper.selectDictDataByType(data.getDictType());
|
||||
}
|
||||
return row;
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,23 +117,14 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
* @param data 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#data.dictType")
|
||||
@Override
|
||||
public int updateDictData(SysDictData data) {
|
||||
public List<SysDictData> updateDictData(SysDictData data) {
|
||||
int row = baseMapper.updateById(data);
|
||||
if (row > 0) {
|
||||
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
||||
RedisUtils.setCacheObject(getCacheKey(data.getDictType()), dictDatas);
|
||||
return baseMapper.selectDictDataByType(data.getDictType());
|
||||
}
|
||||
return row;
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
String getCacheKey(String configKey) {
|
||||
return Constants.SYS_DICT_KEY + configKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.CacheNames;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
@@ -13,17 +13,19 @@ import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.service.DictService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StreamUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.common.utils.redis.CacheUtils;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import com.ruoyi.system.mapper.SysDictTypeMapper;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典 业务层处理
|
||||
@@ -83,17 +85,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||
@Override
|
||||
public List<SysDictData> selectDictDataByType(String dictType) {
|
||||
List<SysDictData> dictDatas = RedisUtils.getCacheObject(getCacheKey(dictType));
|
||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
if (CollUtil.isNotEmpty(dictDatas)) {
|
||||
return dictDatas;
|
||||
}
|
||||
dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
if (CollUtil.isNotEmpty(dictDatas)) {
|
||||
RedisUtils.setCacheObject(getCacheKey(dictType), dictDatas);
|
||||
return dictDatas;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -114,6 +112,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||
@Override
|
||||
public SysDictType selectDictTypeByType(String dictType) {
|
||||
return baseMapper.selectById(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType));
|
||||
@@ -132,7 +131,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
.eq(SysDictData::getDictType, dictType.getDictType()))) {
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
||||
}
|
||||
RedisUtils.deleteObject(getCacheKey(dictType.getDictType()));
|
||||
CacheUtils.evict(CacheNames.SYS_DICT, dictType.getDictType());
|
||||
}
|
||||
baseMapper.deleteBatchIds(Arrays.asList(dictIds));
|
||||
}
|
||||
@@ -144,13 +143,10 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
public void loadingDictCache() {
|
||||
List<SysDictData> dictDataList = dictDataMapper.selectList(
|
||||
new LambdaQueryWrapper<SysDictData>().eq(SysDictData::getStatus, UserConstants.DICT_NORMAL));
|
||||
Map<String, List<SysDictData>> dictDataMap = dictDataList.stream().collect(Collectors.groupingBy(SysDictData::getDictType));
|
||||
Map<String, List<SysDictData>> dictDataMap = StreamUtils.groupByKey(dictDataList, SysDictData::getDictType);
|
||||
dictDataMap.forEach((k,v) -> {
|
||||
String dictKey = getCacheKey(k);
|
||||
List<SysDictData> dictList = v.stream()
|
||||
.sorted(Comparator.comparing(SysDictData::getDictSort))
|
||||
.collect(Collectors.toList());
|
||||
RedisUtils.setCacheObject(dictKey, dictList);
|
||||
List<SysDictData> dictList = StreamUtils.sorted(v, Comparator.comparing(SysDictData::getDictSort));
|
||||
CacheUtils.put(CacheNames.SYS_DICT, k, dictList);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -159,8 +155,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
*/
|
||||
@Override
|
||||
public void clearDictCache() {
|
||||
Collection<String> keys = RedisUtils.keys(Constants.SYS_DICT_KEY + "*");
|
||||
RedisUtils.deleteObject(keys);
|
||||
CacheUtils.clear(CacheNames.SYS_DICT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,13 +173,14 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#dict.dictType")
|
||||
@Override
|
||||
public int insertDictType(SysDictType dict) {
|
||||
public List<SysDictData> insertDictType(SysDictType dict) {
|
||||
int row = baseMapper.insert(dict);
|
||||
if (row > 0) {
|
||||
RedisUtils.setCacheObject(getCacheKey(dict.getDictType()), null);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return row;
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,19 +189,20 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#dict.dictType")
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateDictType(SysDictType dict) {
|
||||
public List<SysDictData> updateDictType(SysDictType dict) {
|
||||
SysDictType oldDict = baseMapper.selectById(dict.getDictId());
|
||||
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
||||
.set(SysDictData::getDictType, dict.getDictType())
|
||||
.eq(SysDictData::getDictType, oldDict.getDictType()));
|
||||
int row = baseMapper.updateById(dict);
|
||||
if (row > 0) {
|
||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
|
||||
RedisUtils.setCacheObject(getCacheKey(dict.getDictType()), dictDatas);
|
||||
CacheUtils.evict(CacheNames.SYS_DICT, oldDict.getDictType());
|
||||
return dictDataMapper.selectDictDataByType(dict.getDictType());
|
||||
}
|
||||
return row;
|
||||
throw new ServiceException("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,13 +286,4 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
String getCacheKey(String configKey) {
|
||||
return Constants.SYS_DICT_KEY + configKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,24 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@Override
|
||||
public Set<String> selectMenuPermsByRoleId(Long roleId) {
|
||||
List<String> perms = baseMapper.selectMenuPermsByRoleId(roleId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms) {
|
||||
if (StringUtils.isNotEmpty(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
@@ -429,7 +447,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
* @return
|
||||
*/
|
||||
public String innerLinkReplaceEach(String path) {
|
||||
return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS},
|
||||
return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, "." },
|
||||
new String[]{"", ""});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.ruoyi.common.constant.CacheNames;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.JsonUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.CacheUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.oss.constant.OssConstant;
|
||||
import com.ruoyi.oss.factory.OssFactory;
|
||||
@@ -54,7 +55,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
||||
for (SysOssConfig config : list) {
|
||||
String configKey = config.getConfigKey();
|
||||
if ("0".equals(config.getStatus())) {
|
||||
RedisUtils.setCacheObject(OssConstant.CACHE_CONFIG_KEY, configKey);
|
||||
RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, configKey);
|
||||
}
|
||||
setConfigCache(true, config);
|
||||
}
|
||||
@@ -120,16 +121,15 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
||||
throw new ServiceException("系统内置, 不可删除!");
|
||||
}
|
||||
}
|
||||
List<SysOssConfig> list = Lists.newArrayList();
|
||||
List<SysOssConfig> list = CollUtil.newArrayList();
|
||||
for (Long configId : ids) {
|
||||
SysOssConfig config = baseMapper.selectById(configId);
|
||||
list.add(config);
|
||||
}
|
||||
boolean flag = baseMapper.deleteBatchIds(ids) > 0;
|
||||
if (flag) {
|
||||
list.stream().forEach(sysOssConfig -> {
|
||||
RedisUtils.deleteObject(getCacheKey(sysOssConfig.getConfigKey()));
|
||||
});
|
||||
list.forEach(sysOssConfig ->
|
||||
CacheUtils.evict(CacheNames.SYS_OSS_CONFIG, sysOssConfig.getConfigKey()));
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@@ -159,21 +159,11 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
||||
.set(SysOssConfig::getStatus, "1"));
|
||||
row += baseMapper.updateById(sysOssConfig);
|
||||
if (row > 0) {
|
||||
RedisUtils.setCacheObject(OssConstant.CACHE_CONFIG_KEY, sysOssConfig.getConfigKey());
|
||||
RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, sysOssConfig.getConfigKey());
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
private String getCacheKey(String configKey) {
|
||||
return OssConstant.SYS_OSS_KEY + configKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果操作成功 则更新缓存
|
||||
*
|
||||
@@ -183,10 +173,8 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
||||
*/
|
||||
private boolean setConfigCache(boolean flag, SysOssConfig config) {
|
||||
if (flag) {
|
||||
RedisUtils.setCacheObject(
|
||||
getCacheKey(config.getConfigKey()),
|
||||
JsonUtils.toJsonString(config));
|
||||
RedisUtils.publish(OssConstant.CACHE_CONFIG_KEY, config.getConfigKey(), msg -> {
|
||||
CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
|
||||
RedisUtils.publish(OssConstant.DEFAULT_CONFIG_KEY, config.getConfigKey(), msg -> {
|
||||
log.info("发布刷新OSS配置 => " + msg);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.constant.CacheNames;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.oss.constant.OssConstant;
|
||||
import com.ruoyi.oss.core.OssClient;
|
||||
import com.ruoyi.oss.entity.UploadResult;
|
||||
import com.ruoyi.oss.factory.OssFactory;
|
||||
@@ -19,11 +18,11 @@ import com.ruoyi.system.domain.vo.SysOssVo;
|
||||
import com.ruoyi.system.mapper.SysOssMapper;
|
||||
import com.ruoyi.system.service.ISysOssService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -51,13 +50,10 @@ public class SysOssServiceImpl implements ISysOssService {
|
||||
public List<SysOssVo> listByIds(Collection<Long> ossIds) {
|
||||
List<SysOssVo> list = new ArrayList<>();
|
||||
for (Long id : ossIds) {
|
||||
String key = OssConstant.SYS_OSS_KEY + id;
|
||||
SysOssVo vo = RedisUtils.getCacheObject(key);
|
||||
if (ObjectUtil.isNull(vo)) {
|
||||
vo = baseMapper.selectVoById(id);
|
||||
RedisUtils.setCacheObject(key, vo, Duration.ofDays(30));
|
||||
SysOssVo vo = getById(id);
|
||||
if (ObjectUtil.isNotNull(vo)) {
|
||||
list.add(vo);
|
||||
}
|
||||
list.add(vo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -76,9 +72,10 @@ public class SysOssServiceImpl implements ISysOssService {
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Cacheable(cacheNames = CacheNames.SYS_OSS, key = "#ossId")
|
||||
@Override
|
||||
public SysOss getById(Long ossId) {
|
||||
return baseMapper.selectById(ossId);
|
||||
public SysOssVo getById(Long ossId) {
|
||||
return baseMapper.selectVoById(ossId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.DataBaseHelper;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StreamUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
@@ -33,7 +34,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户 业务层处理
|
||||
@@ -83,7 +83,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptId)
|
||||
.apply(DataBaseHelper.findInSet(user.getDeptId(), "ancestors")));
|
||||
List<Long> ids = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||
ids.add(user.getDeptId());
|
||||
w.in("u.dept_id", ids);
|
||||
});
|
||||
@@ -172,7 +172,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
|
||||
return StreamUtils.join(list, SysRole::getRoleName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
|
||||
return StreamUtils.join(list, SysPost::getPostName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user