mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-18 19:16:37 +08:00
commit:微服务uaa版本
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?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>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>upms</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>upms-service</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>upms-service</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<!-- 业务组件依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>upms-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>common-log</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>common-redis</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>common-sequence</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.orangeforms.upmsservice;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* Upms服务启动类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients(basePackages = "com.orangeforms")
|
||||
@ComponentScan("com.orangeforms")
|
||||
public class UpmsApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(UpmsApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orangeforms.upmsservice.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 应用程序自定义的程序属性配置文件。
|
||||
* NOTE: 和multiDataSource相关的配置没有包含进来,因为涉及到条件属性,所以由其相关的配置对象自己处理。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@RefreshScope
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "application")
|
||||
public class ApplicationConfig {
|
||||
/**
|
||||
* 用户密码被重置之后的缺省密码
|
||||
*/
|
||||
private String defaultUserPassword;
|
||||
/**
|
||||
* 上传文件的基础目录
|
||||
*/
|
||||
private String uploadFileBaseDir;
|
||||
/**
|
||||
* 每个微服务的url目录上下文,如(/admin/upms),通常和网关的路由目录一致。
|
||||
*/
|
||||
private String serviceContextPath;
|
||||
/**
|
||||
* 是否忽略远程调用中出现的任何错误,包括逻辑异常和系统异常。
|
||||
* 通常在调试和测试阶段设置为false,以便及时发现问题。
|
||||
*/
|
||||
private Boolean ignoreRpcError;
|
||||
/**
|
||||
* Session的数据权限缓存时长(单位:秒)。
|
||||
*/
|
||||
private Integer dataPermExpiredSeconds;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.orangeforms.upmsservice.config;
|
||||
|
||||
import com.orangeforms.common.core.constant.ApplicationConstant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 表示数据源类型的常量对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public final class DataSourceType {
|
||||
|
||||
public static final int MAIN = 0;
|
||||
/**
|
||||
* 对于多数据源服务,操作日志的数据源类型是固定值。如果有冲突,可以直接修改
|
||||
* ApplicationConstant.OPERATION_LOG_DATASOURCE_TYPE的值。
|
||||
* 如果保存SysOperationLog操作日志的数据和其他业务位于同库,为了便于今后的
|
||||
* 迁移,这里也尽量要给其配置单独的数据源类型,今后数据库拆分时,可以直接修改
|
||||
* 该值对应的配置项即可。
|
||||
*/
|
||||
public static final int OPERATION_LOG = ApplicationConstant.OPERATION_LOG_DATASOURCE_TYPE;
|
||||
|
||||
private static final Map<String, Integer> TYPE_MAP = new HashMap<>(2);
|
||||
static {
|
||||
TYPE_MAP.put("main", MAIN);
|
||||
TYPE_MAP.put("operation-log", OPERATION_LOG);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称获取字典类型。
|
||||
*
|
||||
* @param name 数据源在配置中的名称。
|
||||
* @return 返回可用于多数据源切换的数据源类型。
|
||||
*/
|
||||
public static Integer getDataSourceTypeByName(String name) {
|
||||
return TYPE_MAP.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private DataSourceType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.orangeforms.upmsservice.config;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||
import com.orangeforms.common.core.config.DynamicDataSource;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 多数据源配置对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan(value = {"com.orangeforms.*.dao", "com.orangeforms.common.*.dao"})
|
||||
public class MultiDataSourceConfig {
|
||||
|
||||
@Bean(initMethod = "init", destroyMethod = "close")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.druid.main")
|
||||
public DataSource mainDataSource() {
|
||||
return DruidDataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的用于保存操作日志的数据源,可根据需求修改。
|
||||
* 这里我们还是非常推荐给操作日志使用独立的数据源,这样便于今后的数据迁移。
|
||||
*/
|
||||
@Bean(initMethod = "init", destroyMethod = "close")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.druid.operation-log")
|
||||
public DataSource operationLogDataSource() {
|
||||
return DruidDataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public DynamicDataSource dataSource() {
|
||||
Map<Object, Object> targetDataSources = new HashMap<>(1);
|
||||
targetDataSources.put(DataSourceType.MAIN, mainDataSource());
|
||||
targetDataSources.put(DataSourceType.OPERATION_LOG, operationLogDataSource());
|
||||
// 如果当前工程支持在线表单,这里请务必保证upms数据表所在数据库为缺省数据源。
|
||||
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
||||
dynamicDataSource.setTargetDataSources(targetDataSources);
|
||||
dynamicDataSource.setDefaultTargetDataSource(mainDataSource());
|
||||
return dynamicDataSource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.orangeforms.upmsservice.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* UAA授权应用服务的配置文件。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "application.uaa")
|
||||
public class UaaConfig {
|
||||
/**
|
||||
* uaa的授权服务的主机名。
|
||||
*/
|
||||
private String uaaBaseUri;
|
||||
/**
|
||||
* uaa登录成功后的回调地址,需要和UAA授权服务器中注册的完全匹配。
|
||||
*/
|
||||
private String loginUaaRedirectUri;
|
||||
/**
|
||||
* uaa登出成功后的回调地址。
|
||||
*/
|
||||
private String logoutUaaRedirectUri;
|
||||
/**
|
||||
* 应用Id。需要和UAA授权服务器中注册的完全匹配。
|
||||
*/
|
||||
private String clientId;
|
||||
/**
|
||||
* 应用密码。需要和UAA授权服务器中注册的完全匹配。
|
||||
*/
|
||||
private String clientSecret;
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.constant.ApplicationConstant;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.*;
|
||||
import com.orangeforms.common.redis.cache.SessionCacheHelper;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsapi.constant.SysUserStatus;
|
||||
import com.orangeforms.upmsapi.constant.SysUserType;
|
||||
import com.orangeforms.upmsservice.config.UaaConfig;
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.upmsservice.service.*;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 登录接口控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiSupport(order = 1)
|
||||
@Api(tags = "登录接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/login")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysPermCodeService sysPermCodeService;
|
||||
@Autowired
|
||||
private SysPermService sysPermService;
|
||||
@Autowired
|
||||
private SysMenuService sysMenuService;
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private SysDataPermService sysDataPermService;
|
||||
@Autowired
|
||||
private SysPermWhitelistService sysPermWhitelistService;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
@Autowired
|
||||
private SessionCacheHelper cacheHelper;
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private UaaConfig uaaConfig;
|
||||
|
||||
/**
|
||||
* 获取UAA登录验证URL。
|
||||
* @return UAA登录验证URL。
|
||||
*/
|
||||
@GetMapping("/getUaaLoginUrl")
|
||||
public ResponseResult<String> getUaaLoginUrl() {
|
||||
String uaaLoginUrl = normalizeUaaBaseUrl() + "oauth/authorize?response_type=code&client_id="
|
||||
+ uaaConfig.getClientId() + "&redirect_uri=" + uaaConfig.getLoginUaaRedirectUri();
|
||||
return ResponseResult.success(uaaLoginUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取UAA登录验证URL。
|
||||
* @return UAA登录验证URL。
|
||||
*/
|
||||
@GetMapping("/getUaaLogoutUrl")
|
||||
public ResponseResult<String> getUaaLogoutUrl() {
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
String uaaLogoutUrl = normalizeUaaBaseUrl() + "oauth/remove/token?redirect_uri="
|
||||
+ uaaConfig.getLogoutUaaRedirectUri() + "&access_token=" + tokenData.getUaaAccessToken();
|
||||
return ResponseResult.success(uaaLogoutUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* UAA登录接口。
|
||||
*
|
||||
* @param authCode uaa授权码。
|
||||
* @return 应答结果对象,其中包括JWT的Token数据,以及菜单列表和权限字集合等数据。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.LOGIN, saveResponse = false)
|
||||
@PostMapping("/doLoginByUaa")
|
||||
public ResponseResult<JSONObject> doLoginByUaa(@MyRequestBody String authCode) throws Exception {
|
||||
if (MyCommonUtil.existBlankArgument(authCode)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
ResponseEntity<String> responseEntity = this.getAccessTokenByAuthCode(authCode);
|
||||
if (responseEntity.getStatusCode() != HttpStatus.OK) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_ACCESS_TOKEN);
|
||||
}
|
||||
JSONObject accessTokenData = JSONObject.parseObject(responseEntity.getBody());
|
||||
String accessToken = (String) accessTokenData.get("access_token");
|
||||
String username = (String) accessTokenData.get("username");
|
||||
SysUser user = sysUserService.getSysUserByLoginName(username);
|
||||
if (user == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_USERNAME_PASSWORD);
|
||||
}
|
||||
String errorMessage;
|
||||
if (user.getUserStatus() == SysUserStatus.STATUS_LOCKED) {
|
||||
errorMessage = "登录失败,用户账号被锁定!";
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_USER_STATUS, errorMessage);
|
||||
}
|
||||
String patternKey = RedisKeyUtil.getSessionIdPrefix(user.getLoginName(), MyCommonUtil.getDeviceType()) + "*";
|
||||
redissonClient.getKeys().deleteByPatternAsync(patternKey);
|
||||
JSONObject jsonData = this.buildLoginData(user, accessToken);
|
||||
return ResponseResult.success(jsonData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地登录接口,仍然使用OAuth2的password模式进行用户身份验证。
|
||||
*
|
||||
* @param loginName 登录名。
|
||||
* @param password 密码。
|
||||
* @return 应答结果对象,其中包括JWT的Token数据,以及菜单列表。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.LOGIN, saveResponse = false)
|
||||
@PostMapping("/doLogin")
|
||||
public ResponseResult<JSONObject> doLogin(
|
||||
@MyRequestBody String loginName, @MyRequestBody String password) throws Exception {
|
||||
if (MyCommonUtil.existBlankArgument(loginName, password)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
ResponseEntity<String> responseEntity = this.getAccessTokenByUsernameAndPassword(loginName, password);
|
||||
if (responseEntity.getStatusCode() != HttpStatus.OK) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_USERNAME_PASSWORD);
|
||||
}
|
||||
JSONObject accessTokenData = JSONObject.parseObject(responseEntity.getBody());
|
||||
String accessToken = (String) accessTokenData.get("access_token");
|
||||
SysUser user = sysUserService.getSysUserByLoginName(loginName);
|
||||
if (user == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_USERNAME_PASSWORD);
|
||||
}
|
||||
String errorMessage;
|
||||
if (user.getUserStatus() == SysUserStatus.STATUS_LOCKED) {
|
||||
errorMessage = "登录失败,用户账号被锁定!";
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_USER_STATUS, errorMessage);
|
||||
}
|
||||
String patternKey = RedisKeyUtil.getSessionIdPrefix(user.getLoginName(), MyCommonUtil.getDeviceType()) + "*";
|
||||
redissonClient.getKeys().deleteByPatternAsync(patternKey);
|
||||
JSONObject jsonData = this.buildLoginData(user, accessToken);
|
||||
return ResponseResult.success(jsonData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登出操作。同时将Session相关的信息从缓存中删除。
|
||||
*
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.LOGOUT)
|
||||
@PostMapping("/doLogout")
|
||||
public ResponseResult<Void> doLogout() {
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
sysDataPermService.removeDataPermCache(tokenData.getSessionId());
|
||||
cacheHelper.removeAllSessionCache(tokenData.getSessionId());
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在登录之后,通过token再次获取登录信息。
|
||||
* 用于在当前浏览器登录系统后,在新tab页中可以免密登录。
|
||||
*
|
||||
* @return 应答结果对象,其中包括JWT的Token数据,以及菜单列表。
|
||||
*/
|
||||
@GetMapping("/getLoginInfo")
|
||||
public ResponseResult<JSONObject> getLoginInfo() {
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
// 这里解释一下为什么没有缓存menuList和permCodeList。
|
||||
// 1. 该操作和权限验证不同,属于低频操作。
|
||||
// 2. 第一次登录和再次获取登录信息之间,如果修改了用户的权限,那么本次获取的是最新权限。
|
||||
// 3. 上一个问题无法避免,因为即便缓存也是有过期时间的,过期之后还是要从数据库获取的。
|
||||
JSONObject jsonData = new JSONObject();
|
||||
jsonData.put("showName", tokenData.getShowName());
|
||||
jsonData.put("isAdmin", tokenData.getIsAdmin());
|
||||
Collection<SysMenu> menuList;
|
||||
Collection<String> permCodeList;
|
||||
if (tokenData.getIsAdmin()) {
|
||||
menuList = sysMenuService.getAllMenuList();
|
||||
permCodeList = sysPermCodeService.getAllPermCodeList();
|
||||
} else {
|
||||
menuList = sysMenuService.getMenuListByUserId(tokenData.getUserId());
|
||||
permCodeList = sysPermCodeService.getPermCodeListByUserId(tokenData.getUserId());
|
||||
}
|
||||
jsonData.put("menuList", menuList);
|
||||
jsonData.put("permCodeList", permCodeList);
|
||||
return ResponseResult.success(jsonData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过UAA修改用户密码。
|
||||
*
|
||||
* @param oldPass 原有密码。
|
||||
* @param newPass 新密码。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/changePasswordByUaa")
|
||||
public ResponseResult<Void> changePasswordByUaa(
|
||||
@MyRequestBody String oldPass, @MyRequestBody String newPass) throws Exception {
|
||||
if (MyCommonUtil.existBlankArgument(newPass, oldPass)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
SysUser user = sysUserService.getById(tokenData.getUserId());
|
||||
if (user == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_USERNAME_PASSWORD);
|
||||
}
|
||||
oldPass = URLDecoder.decode(oldPass, StandardCharsets.UTF_8.name());
|
||||
// NOTE: 第一次使用时,请务必阅读ApplicationConstant.PRIVATE_KEY的代码注释。
|
||||
// 执行RsaUtil工具类中的main函数,可以生成新的公钥和私钥。
|
||||
oldPass = RsaUtil.decrypt(oldPass, ApplicationConstant.PRIVATE_KEY);
|
||||
newPass = URLDecoder.decode(newPass, StandardCharsets.UTF_8.name());
|
||||
newPass = RsaUtil.decrypt(newPass, ApplicationConstant.PRIVATE_KEY);
|
||||
String url = normalizeUaaBaseUrl() + "uaaauth/sysUaaUser/changePassword?"
|
||||
+ "access_token=" + tokenData.getUaaAccessToken()
|
||||
+ "&username=" + user.getLoginName()
|
||||
+ "&oldPass=" + oldPass
|
||||
+ "&newPass=" + newPass;
|
||||
@SuppressWarnings("all")
|
||||
ResponseEntity<ResponseResult> responseEntity = restTemplate.getForEntity(url, ResponseResult.class);
|
||||
if (responseEntity.getStatusCode() != HttpStatus.OK) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_ACCESS_TOKEN);
|
||||
}
|
||||
ResponseResult<?> result = responseEntity.getBody();
|
||||
return result.isSuccess() ? ResponseResult.success() : ResponseResult.errorFrom(result);
|
||||
}
|
||||
|
||||
private JSONObject buildLoginData(SysUser user, String accessToken) {
|
||||
int deviceType = MyCommonUtil.getDeviceType();
|
||||
boolean isAdmin = user.getUserType() == SysUserType.TYPE_ADMIN;
|
||||
TokenData tokenData = new TokenData();
|
||||
String sessionId = user.getLoginName() + "_" + deviceType + "_" + MyCommonUtil.generateUuid();
|
||||
tokenData.setUserId(user.getUserId());
|
||||
tokenData.setDeptId(user.getDeptId());
|
||||
tokenData.setIsAdmin(isAdmin);
|
||||
tokenData.setLoginName(user.getLoginName());
|
||||
tokenData.setShowName(user.getShowName());
|
||||
tokenData.setSessionId(sessionId);
|
||||
tokenData.setLoginIp(IpUtil.getRemoteIpAddress(ContextUtil.getHttpRequest()));
|
||||
tokenData.setLoginTime(new Date());
|
||||
tokenData.setDeviceType(deviceType);
|
||||
List<SysUserRole> userRoleList = sysRoleService.getSysUserRoleListByUserId(user.getUserId());
|
||||
if (CollectionUtils.isNotEmpty(userRoleList)) {
|
||||
Set<Long> userRoleIdSet = userRoleList.stream().map(SysUserRole::getRoleId).collect(Collectors.toSet());
|
||||
tokenData.setRoleIds(StringUtils.join(userRoleIdSet, ","));
|
||||
}
|
||||
if (StringUtils.isNotBlank(accessToken)) {
|
||||
tokenData.setUaaAccessToken(accessToken);
|
||||
}
|
||||
// 这里手动将TokenData存入request,便于OperationLogAspect统一处理操作日志。
|
||||
TokenData.addToRequest(tokenData);
|
||||
JSONObject jsonData = new JSONObject();
|
||||
jsonData.put(TokenData.REQUEST_ATTRIBUTE_NAME, tokenData);
|
||||
jsonData.put("showName", user.getShowName());
|
||||
jsonData.put("isAdmin", isAdmin);
|
||||
Collection<SysMenu> menuList;
|
||||
Collection<String> permCodeList;
|
||||
if (isAdmin) {
|
||||
menuList = sysMenuService.getAllMenuList();
|
||||
permCodeList = sysPermCodeService.getAllPermCodeList();
|
||||
} else {
|
||||
menuList = sysMenuService.getMenuListByUserId(tokenData.getUserId());
|
||||
permCodeList = sysPermCodeService.getPermCodeListByUserId(user.getUserId());
|
||||
// 将白名单url列表合并到当前用户的权限资源列表中,便于网关一并处理。
|
||||
Collection<String> permList = sysPermService.getPermListByUserId(user.getUserId());
|
||||
permList.addAll(sysPermWhitelistService.getWhitelistPermList());
|
||||
jsonData.put("permSet", permList);
|
||||
}
|
||||
jsonData.put("menuList", menuList);
|
||||
jsonData.put("permCodeList", permCodeList);
|
||||
if (user.getUserType() != SysUserType.TYPE_ADMIN) {
|
||||
sysDataPermService.putDataPermCache(sessionId, user.getUserId(), user.getDeptId());
|
||||
}
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
private ResponseEntity<String> getAccessTokenByUsernameAndPassword(
|
||||
String username, String password) throws UnsupportedEncodingException {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
byte[] authorization = (uaaConfig.getClientId() + ":"
|
||||
+ uaaConfig.getClientSecret()).getBytes(StandardCharsets.UTF_8);
|
||||
String base64Auth = Base64.encodeBase64String(authorization);
|
||||
headers.add("Authorization", "Basic " + base64Auth);
|
||||
MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
|
||||
param.add("username", username);
|
||||
param.add("password", password);
|
||||
param.add("grant_type", "password");
|
||||
param.add("scope", "all");
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(param, headers);
|
||||
return restTemplate.postForEntity(normalizeUaaBaseUrl() + "oauth/token", request, String.class);
|
||||
}
|
||||
|
||||
private ResponseEntity<String> getAccessTokenByAuthCode(String authCode) throws UnsupportedEncodingException {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
byte[] authorization = (uaaConfig.getClientId() + ":"
|
||||
+ uaaConfig.getClientSecret()).getBytes(StandardCharsets.UTF_8);
|
||||
String base64Auth = Base64.encodeBase64String(authorization);
|
||||
headers.add("Authorization", "Basic " + base64Auth);
|
||||
MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
|
||||
param.add("code", authCode);
|
||||
param.add("grant_type", "authorization_code");
|
||||
param.add("redirect_uri", uaaConfig.getLoginUaaRedirectUri());
|
||||
param.add("scope", "all");
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(param, headers);
|
||||
return restTemplate.postForEntity(normalizeUaaBaseUrl() + "oauth/token", request, String.class);
|
||||
}
|
||||
|
||||
private String normalizeUaaBaseUrl() {
|
||||
String baseUrl = uaaConfig.getUaaBaseUri();
|
||||
String suffixChar = "/";
|
||||
if (!baseUrl.endsWith(suffixChar)) {
|
||||
baseUrl = baseUrl + suffixChar;
|
||||
}
|
||||
return baseUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.RedisKeyUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RBucket;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 在线用户控制器对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "在线用户接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/loginUser")
|
||||
public class LoginUserController {
|
||||
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
/**
|
||||
* 显示在线用户列表。
|
||||
*
|
||||
* @param loginName 登录名过滤。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 登录用户信息列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<LoginUserInfo>> list(
|
||||
@MyRequestBody String loginName, @MyRequestBody MyPageParam pageParam) {
|
||||
int queryCount = pageParam.getPageNum() * pageParam.getPageSize();
|
||||
int skipCount = (pageParam.getPageNum() - 1) * pageParam.getPageSize();
|
||||
String patternKey;
|
||||
if (StrUtil.isBlank(loginName)) {
|
||||
patternKey = RedisKeyUtil.getSessionIdPrefix() + "*";
|
||||
} else {
|
||||
patternKey = RedisKeyUtil.getSessionIdPrefix(loginName) + "*";
|
||||
}
|
||||
List<LoginUserInfo> loginUserInfoList = new LinkedList<>();
|
||||
Iterable<String> keys = redissonClient.getKeys().getKeysByPattern(patternKey);
|
||||
for (String key : keys) {
|
||||
loginUserInfoList.add(this.buildTokenDataByRedisKey(key));
|
||||
}
|
||||
loginUserInfoList.sort((o1, o2) -> (int) (o2.getLoginTime().getTime() - o1.getLoginTime().getTime()));
|
||||
int toIndex = Math.min(skipCount + pageParam.getPageSize(), loginUserInfoList.size());
|
||||
List<LoginUserInfo> resultList = loginUserInfoList.subList(skipCount, toIndex);
|
||||
return ResponseResult.success(new MyPageData<>(resultList, (long) loginUserInfoList.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制下线指定登录会话。
|
||||
*
|
||||
* @param sessionId 待强制下线的SessionId。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody String sessionId) {
|
||||
// 为了保证被剔除用户正在进行的操作不被干扰,这里只是删除sessionIdKey即可,这样可以使强制下线操作更加平滑。
|
||||
// 比如,如果删除操作权限或数据权限的redis session key,那么正在请求数据的操作就会报错。
|
||||
redissonClient.getBucket(RedisKeyUtil.makeSessionIdKey(sessionId)).delete();
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
private LoginUserInfo buildTokenDataByRedisKey(String key) {
|
||||
RBucket<String> sessionData = redissonClient.getBucket(key);
|
||||
TokenData tokenData = JSON.parseObject(sessionData.get(), TokenData.class);
|
||||
return BeanUtil.copyProperties(tokenData, LoginUserInfo.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsapi.dto.SysDataPermDto;
|
||||
import com.orangeforms.upmsapi.dto.SysUserDto;
|
||||
import com.orangeforms.upmsapi.vo.SysDataPermVo;
|
||||
import com.orangeforms.upmsapi.vo.SysUserVo;
|
||||
import com.orangeforms.upmsservice.model.SysDataPerm;
|
||||
import com.orangeforms.upmsservice.model.SysUser;
|
||||
import com.orangeforms.upmsservice.service.SysDataPermService;
|
||||
import com.orangeforms.upmsservice.service.SysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据权限接口控制器对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "数据权限管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysDataPerm")
|
||||
public class SysDataPermController {
|
||||
|
||||
@Autowired
|
||||
private SysDataPermService sysDataPermService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 添加新数据权限。
|
||||
*
|
||||
* @param sysDataPermDto 新增对象。
|
||||
* @param deptIdListString 数据权限关联的部门Id列表,多个之间逗号分隔。
|
||||
* @return 应答结果对象。包含新增数据权限对象的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"sysDataPermDto.dataPermId",
|
||||
"sysDataPermDto.createTimeStart",
|
||||
"sysDataPermDto.createTimeEnd",
|
||||
"sysDataPermDto.searchString"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysDataPermDto sysDataPermDto, @MyRequestBody String deptIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDataPermDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysDataPerm sysDataPerm = MyModelUtil.copyTo(sysDataPermDto, SysDataPerm.class);
|
||||
CallResult result = sysDataPermService.verifyRelatedData(sysDataPerm, deptIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> deptIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
deptIdSet = result.getData().getObject("deptIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
sysDataPermService.saveNew(sysDataPerm, deptIdSet);
|
||||
return ResponseResult.success(sysDataPerm.getDataPermId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据权限。
|
||||
*
|
||||
* @param sysDataPermDto 更新的数据权限对象。
|
||||
* @param deptIdListString 数据权限关联的部门Id列表,多个之间逗号分隔。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"sysDataPermDto.createTimeStart",
|
||||
"sysDataPermDto.createTimeEnd",
|
||||
"sysDataPermDto.searchString"})
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(
|
||||
@MyRequestBody SysDataPermDto sysDataPermDto, @MyRequestBody String deptIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDataPermDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysDataPerm originalSysDataPerm = sysDataPermService.getById(sysDataPermDto.getDataPermId());
|
||||
if (originalSysDataPerm == null) {
|
||||
errorMessage = "数据验证失败,当前数据权限并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
SysDataPerm sysDataPerm = MyModelUtil.copyTo(sysDataPermDto, SysDataPerm.class);
|
||||
CallResult result = sysDataPermService.verifyRelatedData(sysDataPerm, deptIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> deptIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
deptIdSet = result.getData().getObject("deptIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
if (!sysDataPermService.update(sysDataPerm, originalSysDataPerm, deptIdSet)) {
|
||||
errorMessage = "更新失败,数据不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据权限。
|
||||
*
|
||||
* @param dataPermId 待删除数据权限主键Id。
|
||||
* @return 应答数据结果。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long dataPermId) {
|
||||
if (MyCommonUtil.existBlankArgument(dataPermId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysDataPermService.remove(dataPermId)) {
|
||||
String errorMessage = "数据操作失败,数据权限不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限列表。
|
||||
*
|
||||
* @param sysDataPermDtoFilter 数据权限查询过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象。包含数据权限列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<SysDataPermVo>> list(
|
||||
@MyRequestBody SysDataPermDto sysDataPermDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysDataPerm filter = MyModelUtil.copyTo(sysDataPermDtoFilter, SysDataPerm.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysDataPerm.class);
|
||||
List<SysDataPerm> dataPermList = sysDataPermService.getSysDataPermList(filter, orderBy);
|
||||
List<SysDataPermVo> dataPermVoList = MyModelUtil.copyCollectionTo(dataPermList, SysDataPermVo.class);
|
||||
long totalCount = 0L;
|
||||
if (dataPermList instanceof Page) {
|
||||
totalCount = ((Page<SysDataPerm>) dataPermList).getTotal();
|
||||
}
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(dataPermVoList, totalCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看单条数据权限详情。
|
||||
*
|
||||
* @param dataPermId 数据权限的主键Id。
|
||||
* @return 应答结果对象,包含数据权限的详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SysDataPermVo> view(@RequestParam Long dataPermId) {
|
||||
if (MyCommonUtil.existBlankArgument(dataPermId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
SysDataPerm sysDataPerm =
|
||||
sysDataPermService.getByIdWithRelation(dataPermId, MyRelationParam.full());
|
||||
if (sysDataPerm == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysDataPermVo sysDataPermVo = MyModelUtil.copyTo(sysDataPerm, SysDataPermVo.class);
|
||||
return ResponseResult.success(sysDataPermVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取不包含指定数据权限Id的用户列表。
|
||||
* 用户和数据权限是多对多关系,当前接口将返回没有赋值指定DataPermId的用户列表。可用于给数据权限添加新用户。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param sysUserDtoFilter 用户数据的过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含用户列表数据。
|
||||
*/
|
||||
@PostMapping("/listNotInDataPermUser")
|
||||
public ResponseResult<MyPageData<SysUserVo>> listNotInDataPermUser(
|
||||
@MyRequestBody Long dataPermId,
|
||||
@MyRequestBody SysUserDto sysUserDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doDataPermUserVerify(dataPermId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysUser filter = MyModelUtil.copyTo(sysUserDtoFilter, SysUser.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysUser.class);
|
||||
List<SysUser> userList =
|
||||
sysUserService.getNotInSysUserListByDataPermId(dataPermId, filter, orderBy);
|
||||
List<SysUserVo> userVoList = MyModelUtil.copyCollectionTo(userList, SysUserVo.class);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(userVoList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拥有指定数据权限的用户列表。
|
||||
*
|
||||
* @param dataPermId 数据权限Id。
|
||||
* @param sysUserDtoFilter 用户过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含用户列表数据。
|
||||
*/
|
||||
@PostMapping("/listDataPermUser")
|
||||
public ResponseResult<MyPageData<SysUserVo>> listDataPermUser(
|
||||
@MyRequestBody Long dataPermId,
|
||||
@MyRequestBody SysUserDto sysUserDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doDataPermUserVerify(dataPermId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysUser filter = MyModelUtil.copyTo(sysUserDtoFilter, SysUser.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysUser.class);
|
||||
List<SysUser> userList =
|
||||
sysUserService.getSysUserListByDataPermId(dataPermId, filter, orderBy);
|
||||
List<SysUserVo> userVoList = MyModelUtil.copyCollectionTo(userList, SysUserVo.class);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(userVoList));
|
||||
}
|
||||
|
||||
private ResponseResult<Void> doDataPermUserVerify(Long dataPermId) {
|
||||
if (MyCommonUtil.existBlankArgument(dataPermId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysDataPermService.existId(dataPermId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 为指定数据权限添加用户列表。该操作可同时给一批用户赋值数据权限,并在同一事务内完成。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param userIdListString 逗号分隔的用户Id列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.ADD_M2M)
|
||||
@PostMapping("/addDataPermUser")
|
||||
public ResponseResult<Void> addDataPermUser(
|
||||
@MyRequestBody Long dataPermId, @MyRequestBody String userIdListString) {
|
||||
if (MyCommonUtil.existBlankArgument(dataPermId, userIdListString)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
Set<Long> userIdSet =
|
||||
Arrays.stream(userIdListString.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysDataPermService.existId(dataPermId)
|
||||
|| !sysUserService.existUniqueKeyList("userId", userIdSet)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
sysDataPermService.addDataPermUserList(dataPermId, userIdSet);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 为指定用户移除指定数据权限。
|
||||
*
|
||||
* @param dataPermId 指定数据权限主键Id。
|
||||
* @param userId 指定用户主键Id。
|
||||
* @return 应答数据结果。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE_M2M)
|
||||
@PostMapping("/deleteDataPermUser")
|
||||
public ResponseResult<Void> deleteDataPermUser(
|
||||
@MyRequestBody Long dataPermId, @MyRequestBody Long userId) {
|
||||
if (MyCommonUtil.existBlankArgument(dataPermId, userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysDataPermService.removeDataPermUser(dataPermId, userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.upmsservice.service.*;
|
||||
import com.orangeforms.upmsapi.dto.*;
|
||||
import com.orangeforms.upmsapi.vo.*;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.*;
|
||||
import com.orangeforms.common.core.constant.*;
|
||||
import com.orangeforms.common.core.base.controller.BaseController;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门管理操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "部门管理管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysDept")
|
||||
public class SysDeptController extends BaseController<SysDept, SysDeptVo, Long> {
|
||||
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Override
|
||||
protected IBaseService<SysDept, Long> service() {
|
||||
return sysDeptService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门管理数据。
|
||||
*
|
||||
* @param sysDeptDto 新增对象。
|
||||
* @return 应答结果对象,包含新增对象主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysDeptDto.deptId"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SysDeptDto sysDeptDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto, false);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysDept sysDept = MyModelUtil.copyTo(sysDeptDto, SysDept.class);
|
||||
// 验证父Id的数据合法性
|
||||
SysDept parentSysDept = null;
|
||||
if (MyCommonUtil.isNotBlankOrNull(sysDept.getParentId())) {
|
||||
parentSysDept = sysDeptService.getById(sysDept.getParentId());
|
||||
if (parentSysDept == null) {
|
||||
errorMessage = "数据验证失败,关联的父节点并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_PARENT_ID_NOT_EXIST, errorMessage);
|
||||
}
|
||||
}
|
||||
sysDept = sysDeptService.saveNew(sysDept, parentSysDept);
|
||||
return ResponseResult.success(sysDept.getDeptId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门管理数据。
|
||||
*
|
||||
* @param sysDeptDto 更新对象。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody SysDeptDto sysDeptDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto, true);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysDept sysDept = MyModelUtil.copyTo(sysDeptDto, SysDept.class);
|
||||
SysDept originalSysDept = sysDeptService.getById(sysDept.getDeptId());
|
||||
if (originalSysDept == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
// 验证父Id的数据合法性
|
||||
if (MyCommonUtil.isNotBlankOrNull(sysDept.getParentId())
|
||||
&& ObjectUtils.notEqual(sysDept.getParentId(), originalSysDept.getParentId())) {
|
||||
SysDept parentSysDept = sysDeptService.getById(sysDept.getParentId());
|
||||
if (parentSysDept == null) {
|
||||
errorMessage = "数据验证失败,关联的父节点并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_PARENT_ID_NOT_EXIST, errorMessage);
|
||||
}
|
||||
}
|
||||
if (!sysDeptService.update(sysDept, originalSysDept)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门管理数据。
|
||||
*
|
||||
* @param deptId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long deptId) {
|
||||
String errorMessage;
|
||||
if (MyCommonUtil.existBlankArgument(deptId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
SysDept originalSysDept = sysDeptService.getById(deptId);
|
||||
if (originalSysDept == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
if (sysDeptService.hasChildren(deptId)) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象存在子对象],请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.HAS_CHILDREN_DATA, errorMessage);
|
||||
}
|
||||
if (sysDeptService.hasChildrenUser(deptId)) {
|
||||
errorMessage = "数据验证失败,请先移除部门用户数据后,再删除当前部门!";
|
||||
return ResponseResult.error(ErrorCodeEnum.HAS_CHILDREN_DATA, errorMessage);
|
||||
}
|
||||
if (!sysDeptService.remove(deptId)) {
|
||||
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的部门管理列表。
|
||||
*
|
||||
* @param sysDeptDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<SysDeptVo>> list(
|
||||
@MyRequestBody SysDeptDto sysDeptDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysDept sysDeptFilter = MyModelUtil.copyTo(sysDeptDtoFilter, SysDept.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysDept.class);
|
||||
List<SysDept> sysDeptList = sysDeptService.getSysDeptListWithRelation(sysDeptFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(sysDeptList, SysDept.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定部门管理对象详情。
|
||||
*
|
||||
* @param deptId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SysDeptVo> view(@RequestParam Long deptId) {
|
||||
if (MyCommonUtil.existBlankArgument(deptId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
SysDept sysDept = sysDeptService.getByIdWithRelation(deptId, MyRelationParam.full());
|
||||
if (sysDept == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysDeptVo sysDeptVo = SysDept.INSTANCE.fromModel(sysDept);
|
||||
return ResponseResult.success(sysDeptVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字典形式返回全部部门管理数据集合。字典的键值为[deptId, deptName]。
|
||||
* 白名单接口,登录用户均可访问。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@GetMapping("/listDict")
|
||||
public ResponseResult<List<Map<String, Object>>> listDict(SysDept filter) {
|
||||
List<SysDept> resultList = sysDeptService.getListByFilter(filter);
|
||||
return ResponseResult.success(
|
||||
BeanQuery.select("parentId as parentId", "deptId as id", "deptName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典Id集合,获取查询后的字典数据。
|
||||
*
|
||||
* @param dictIds 字典Id集合。
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@PostMapping("/listDictByIds")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||
@MyRequestBody(elementType = Long.class) List<Long> dictIds) {
|
||||
List<SysDept> resultList = sysDeptService.getInList(new HashSet<>(dictIds));
|
||||
return ResponseResult.success(
|
||||
BeanQuery.select("parentId as parentId", "deptId as id", "deptName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父主键Id,以字典的形式返回其下级数据列表。
|
||||
* 白名单接口,登录用户均可访问。
|
||||
*
|
||||
* @param parentId 父主键Id。
|
||||
* @return 按照字典的形式返回下级数据列表。
|
||||
*/
|
||||
@GetMapping("/listDictByParentId")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByParentId(@RequestParam(required = false) Long parentId) {
|
||||
List<SysDept> resultList = sysDeptService.getListByParentId("parentId", parentId);
|
||||
return ResponseResult.success(
|
||||
BeanQuery.select("parentId as parentId", "deptId as id", "deptName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键Id集合,获取数据对象集合。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param deptIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "listByIds")
|
||||
@PostMapping("/listByIds")
|
||||
public ResponseResult<List<SysDeptVo>> listByIds(
|
||||
@RequestParam Set<Long> deptIds, @RequestParam Boolean withDict) {
|
||||
return super.baseListByIds(deptIds, withDict, SysDept.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键Id,获取数据对象。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "getById")
|
||||
@PostMapping("/getById")
|
||||
public ResponseResult<SysDeptVo> getById(
|
||||
@RequestParam Long deptId, @RequestParam Boolean withDict) {
|
||||
return super.baseGetById(deptId, withDict, SysDept.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id集合,是否全部存在。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param deptIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "existIds")
|
||||
@PostMapping("/existIds")
|
||||
public ResponseResult<Boolean> existIds(@RequestParam Set<Long> deptIds) {
|
||||
return super.baseExistIds(deptIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id是否存在。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "existId")
|
||||
@PostMapping("/existId")
|
||||
public ResponseResult<Boolean> existId(@RequestParam Long deptId) {
|
||||
return super.baseExistId(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象列表和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param data 数据对象。
|
||||
* 主键有值是视为更新操作的数据比对,因此仅当关联Id变化时才会验证。
|
||||
* 主键为空视为新增操作的数据比对,所有关联Id都会被验证。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "verifyRelatedData")
|
||||
@PostMapping("/verifyRelatedData")
|
||||
public ResponseResult<Void> verifyRelatedData(@RequestBody SysDeptDto data) {
|
||||
SysDept sysDept = MyModelUtil.copyTo(data, SysDept.class);
|
||||
return super.baseVerifyRelatedData(sysDept, SysDept::getDeptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象列表和原有对象列表的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param dataList 数据对象列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "verifyRelatedDataList")
|
||||
@PostMapping("/verifyRelatedDataList")
|
||||
public ResponseResult<Void> verifyRelatedDataList(@RequestBody List<SysDeptDto> dataList) {
|
||||
List<SysDept> sysDeptList = MyModelUtil.copyCollectionTo(dataList, SysDept.class);
|
||||
return super.baseVerifyRelatedDataList(sysDeptList, SysDept::getDeptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键Id删除数据。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @return 删除数量。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "deleteById")
|
||||
@PostMapping("/deleteById")
|
||||
public ResponseResult<Integer> deleteById(@RequestParam Long deptId) throws Exception {
|
||||
SysDept filter = new SysDept();
|
||||
filter.setDeptId(deptId);
|
||||
return super.baseDeleteBy(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除符合过滤条件的数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 删除数量。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "deleteBy")
|
||||
@PostMapping("/deleteBy")
|
||||
public ResponseResult<Integer> deleteBy(@RequestBody SysDeptDto filter) throws Exception {
|
||||
return super.baseDeleteBy(MyModelUtil.copyTo(filter, SysDept.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 复杂的查询调用,包括(in list)过滤,对象条件过滤,分页和排序等。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 分页数据集合对象。如MyQueryParam参数的分页属性为空,则不会执行分页操作,只是基于MyPageData对象返回数据结果。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "listBy")
|
||||
@PostMapping("/listBy")
|
||||
public ResponseResult<MyPageData<SysDeptVo>> listBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseListBy(queryParam, SysDept.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复杂的查询调用,包括(in list)过滤,对象条件过滤,分页和排序等。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 分页数据集合对象。如MyQueryParam参数的分页属性为空,则不会执行分页操作,只是基于MyPageData对象返回数据结果。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "listMapBy")
|
||||
@PostMapping("/listMapBy")
|
||||
public ResponseResult<MyPageData<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseListMapBy(queryParam, SysDept.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复杂的查询调用,仅返回单体记录。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含符合查询过滤条件的对象结果集。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "getBy")
|
||||
@PostMapping("/getBy")
|
||||
public ResponseResult<SysDeptVo> getBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseGetBy(queryParam, SysDept.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "countBy")
|
||||
@PostMapping("/countBy")
|
||||
public ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseCountBy(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "aggregateBy")
|
||||
@PostMapping("/aggregateBy")
|
||||
public ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam) {
|
||||
return super.baseAggregateBy(aggregationParam);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsapi.dto.SysMenuDto;
|
||||
import com.orangeforms.upmsapi.vo.SysMenuVo;
|
||||
import com.orangeforms.upmsapi.constant.SysMenuType;
|
||||
import com.orangeforms.upmsservice.model.SysMenu;
|
||||
import com.orangeforms.upmsservice.service.SysMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单管理接口控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "菜单管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysMenu")
|
||||
public class SysMenuController {
|
||||
|
||||
@Autowired
|
||||
private SysMenuService sysMenuService;
|
||||
|
||||
/**
|
||||
* 添加新菜单操作。
|
||||
*
|
||||
* @param sysMenuDto 新菜单对象。
|
||||
* @param permCodeIdListString 与当前菜单Id绑定的权限Id列表,多个权限之间逗号分隔。
|
||||
* @return 应答结果对象,包含新增菜单的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysMenuDto.menuId"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysMenuDto sysMenuDto, @MyRequestBody String permCodeIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysMenuDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysMenu sysMenu = MyModelUtil.copyTo(sysMenuDto, SysMenu.class);
|
||||
if (sysMenu.getParentId() != null) {
|
||||
SysMenu parentSysMenu = sysMenuService.getById(sysMenu.getParentId());
|
||||
if (parentSysMenu == null) {
|
||||
errorMessage = "数据验证失败,关联的父菜单不存在!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (parentSysMenu.getOnlineFormId() != null) {
|
||||
errorMessage = "数据验证失败,不能动态表单菜单添加父菜单!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
}
|
||||
CallResult result = sysMenuService.verifyRelatedData(sysMenu, null, permCodeIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> permCodeIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
permCodeIdSet = result.getData().getObject("permCodeIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
sysMenuService.saveNew(sysMenu, permCodeIdSet);
|
||||
return ResponseResult.success(sysMenu.getMenuId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单数据操作。
|
||||
*
|
||||
* @param sysMenuDto 更新菜单对象。
|
||||
* @param permCodeIdListString 与当前菜单Id绑定的权限Id列表,多个权限之间逗号分隔。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(
|
||||
@MyRequestBody SysMenuDto sysMenuDto, @MyRequestBody String permCodeIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysMenuDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysMenu originalSysMenu = sysMenuService.getById(sysMenuDto.getMenuId());
|
||||
if (originalSysMenu == null) {
|
||||
errorMessage = "数据验证失败,当前菜单并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
SysMenu sysMenu = MyModelUtil.copyTo(sysMenuDto, SysMenu.class);
|
||||
if (ObjectUtil.notEqual(originalSysMenu.getOnlineFormId(), sysMenu.getOnlineFormId())) {
|
||||
if (originalSysMenu.getOnlineFormId() == null) {
|
||||
errorMessage = "数据验证失败,不能为当前菜单添加在线表单Id属性!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
if (sysMenu.getOnlineFormId() == null) {
|
||||
errorMessage = "数据验证失败,不能去掉当前菜单的在线表单Id属性!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
}
|
||||
if (originalSysMenu.getOnlineFormId() != null
|
||||
&& originalSysMenu.getMenuType().equals(SysMenuType.TYPE_BUTTON)) {
|
||||
errorMessage = "数据验证失败,在线表单的内置菜单不能编辑!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
CallResult result = sysMenuService.verifyRelatedData(sysMenu, originalSysMenu, permCodeIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> permCodeIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
permCodeIdSet = result.getData().getObject("permCodeIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
if (!sysMenuService.update(sysMenu, originalSysMenu, permCodeIdSet)) {
|
||||
errorMessage = "数据验证失败,当前权限字并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定菜单操作。
|
||||
*
|
||||
* @param menuId 指定菜单主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long menuId) {
|
||||
if (MyCommonUtil.existBlankArgument(menuId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
String errorMessage;
|
||||
SysMenu menu = sysMenuService.getById(menuId);
|
||||
if (menu == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
if (menu.getOnlineFormId() != null && menu.getMenuType().equals(SysMenuType.TYPE_BUTTON)) {
|
||||
errorMessage = "数据验证失败,在线表单的内置菜单不能删除!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
// 对于在线表单,无需进行子菜单的验证,而是在删除的时候,连同子菜单一起删除。
|
||||
if (menu.getOnlineFormId() == null && sysMenuService.hasChildren(menuId)) {
|
||||
errorMessage = "数据验证失败,当前菜单存在下级菜单!";
|
||||
return ResponseResult.error(ErrorCodeEnum.HAS_CHILDREN_DATA, errorMessage);
|
||||
}
|
||||
if (!sysMenuService.remove(menu)) {
|
||||
errorMessage = "数据操作失败,菜单不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部菜单列表。
|
||||
*
|
||||
* @return 应答结果对象,包含全部菜单数据列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<List<SysMenuVo>> list() {
|
||||
Collection<SysMenu> sysMenuList = sysMenuService.getAllListByOrder("showOrder");
|
||||
return ResponseResult.success(MyModelUtil.copyCollectionTo(sysMenuList, SysMenuVo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定菜单数据详情。
|
||||
*
|
||||
* @param menuId 指定菜单主键Id。
|
||||
* @return 应答结果对象,包含菜单详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SysMenuVo> view(@RequestParam Long menuId) {
|
||||
if (MyCommonUtil.existBlankArgument(menuId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
SysMenu sysMenu = sysMenuService.getByIdWithRelation(menuId, MyRelationParam.full());
|
||||
if (sysMenu == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysMenuVo sysMenuVo = MyModelUtil.copyTo(sysMenu, SysMenuVo.class);
|
||||
return ResponseResult.success(sysMenuVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param url 权限资源地址过滤条件。
|
||||
* @return 应答对象,包含从菜单到权限资源的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysPermWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysPermWithDetail(Long menuId, String url) {
|
||||
if (MyCommonUtil.isBlankOrNull(menuId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysMenuService.getSysPermListWithDetail(menuId, url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 应答对象,包含从菜单到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysUserWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysUserWithDetail(Long menuId, String loginName) {
|
||||
if (MyCommonUtil.isBlankOrNull(menuId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysMenuService.getSysUserListWithDetail(menuId, loginName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.log.model.SysOperationLog;
|
||||
import com.orangeforms.common.log.service.SysOperationLogService;
|
||||
import com.orangeforms.upmsapi.dto.SysOperationLogDto;
|
||||
import com.orangeforms.upmsapi.vo.SysOperationLogVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志接口控制器对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "操作日志接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysOperationLog")
|
||||
public class SysOperationLogController {
|
||||
|
||||
@Autowired
|
||||
private SysOperationLogService operationLogService;
|
||||
|
||||
/**
|
||||
* 数据权限列表。
|
||||
*
|
||||
* @param sysOperationLogDtoFilter 操作日志查询过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象。包含操作日志列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<SysOperationLogVo>> list(
|
||||
@MyRequestBody SysOperationLogDto sysOperationLogDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysOperationLog filter = MyModelUtil.copyTo(sysOperationLogDtoFilter, SysOperationLog.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysOperationLog.class);
|
||||
List<SysOperationLog> operationLogList = operationLogService.getSysOperationLogList(filter, orderBy);
|
||||
List<SysOperationLogVo> operationLogVoList = MyModelUtil.copyCollectionTo(operationLogList, SysOperationLogVo.class);
|
||||
long totalCount = 0L;
|
||||
if (operationLogList instanceof Page) {
|
||||
totalCount = ((Page<SysOperationLog>) operationLogList).getTotal();
|
||||
}
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(operationLogVoList, totalCount));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsapi.dto.SysPermCodeDto;
|
||||
import com.orangeforms.upmsapi.vo.SysPermCodeVo;
|
||||
import com.orangeforms.upmsservice.model.SysPermCode;
|
||||
import com.orangeforms.upmsservice.service.SysPermCodeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限字管理接口控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "权限字管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysPermCode")
|
||||
public class SysPermCodeController {
|
||||
|
||||
@Autowired
|
||||
private SysPermCodeService sysPermCodeService;
|
||||
|
||||
/**
|
||||
* 新增权限字操作。
|
||||
*
|
||||
* @param sysPermCodeDto 新增权限字对象。
|
||||
* @param permIdListString 与当前权限Id绑定的权限资源Id列表,多个权限资源之间逗号分隔。
|
||||
* @return 应答结果对象,包含新增权限字的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysPermCodeDto.permCodeId"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysPermCodeDto sysPermCodeDto, @MyRequestBody String permIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermCodeDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED);
|
||||
}
|
||||
SysPermCode sysPermCode = MyModelUtil.copyTo(sysPermCodeDto, SysPermCode.class);
|
||||
CallResult result = sysPermCodeService.verifyRelatedData(sysPermCode, null, permIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> permIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
permIdSet = result.getData().getObject("permIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
sysPermCode = sysPermCodeService.saveNew(sysPermCode, permIdSet);
|
||||
return ResponseResult.success(sysPermCode.getPermCodeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限字操作。
|
||||
*
|
||||
* @param sysPermCodeDto 更新权限字对象。
|
||||
* @param permIdListString 与当前权限Id绑定的权限资源Id列表,多个权限资源之间逗号分隔。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(
|
||||
@MyRequestBody SysPermCodeDto sysPermCodeDto, @MyRequestBody String permIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermCodeDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysPermCode originalSysPermCode = sysPermCodeService.getById(sysPermCodeDto.getPermCodeId());
|
||||
if (originalSysPermCode == null) {
|
||||
errorMessage = "数据验证失败,当前权限字并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
SysPermCode sysPermCode = MyModelUtil.copyTo(sysPermCodeDto, SysPermCode.class);
|
||||
CallResult result = sysPermCodeService.verifyRelatedData(sysPermCode, originalSysPermCode, permIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> permIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
permIdSet = result.getData().getObject("permIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
try {
|
||||
if (!sysPermCodeService.update(sysPermCode, originalSysPermCode, permIdSet)) {
|
||||
errorMessage = "数据验证失败,当前权限字并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
} catch (DuplicateKeyException e) {
|
||||
errorMessage = "数据操作失败,权限字编码已经存在!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DUPLICATED_UNIQUE_KEY, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定权限字操作。
|
||||
*
|
||||
* @param permCodeId 指定的权限字主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long permCodeId) {
|
||||
if (MyCommonUtil.existBlankArgument(permCodeId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
String errorMessage;
|
||||
if (sysPermCodeService.hasChildren(permCodeId)) {
|
||||
errorMessage = "数据验证失败,当前权限字存在下级权限字!";
|
||||
return ResponseResult.error(ErrorCodeEnum.HAS_CHILDREN_DATA, errorMessage);
|
||||
}
|
||||
if (!sysPermCodeService.remove(permCodeId)) {
|
||||
errorMessage = "数据操作失败,权限字不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看权限字列表。
|
||||
*
|
||||
* @return 应答结果对象,包含权限字列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<List<SysPermCodeVo>> list() {
|
||||
List<SysPermCode> sysPermCodeList =
|
||||
sysPermCodeService.getAllListByOrder("permCodeType", "showOrder");
|
||||
return ResponseResult.success(MyModelUtil.copyCollectionTo(sysPermCodeList, SysPermCodeVo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看权限字对象详情。
|
||||
*
|
||||
* @param permCodeId 指定权限字主键Id。
|
||||
* @return 应答结果对象,包含权限字对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SysPermCodeVo> view(@RequestParam Long permCodeId) {
|
||||
if (MyCommonUtil.existBlankArgument(permCodeId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
SysPermCode sysPermCode =
|
||||
sysPermCodeService.getByIdWithRelation(permCodeId, MyRelationParam.full());
|
||||
if (sysPermCode == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysPermCodeVo sysPermCodeVo = MyModelUtil.copyTo(sysPermCode, SysPermCodeVo.class);
|
||||
return ResponseResult.success(sysPermCodeVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限字的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 应答对象。包含从权限字到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysUserWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysUserWithDetail(Long permCodeId, String loginName) {
|
||||
if (MyCommonUtil.isBlankOrNull(permCodeId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysPermCodeService.getSysUserListWithDetail(permCodeId, loginName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限字的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 应答对象。包含从权限字到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysRoleWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysRoleWithDetail(Long permCodeId, String roleName) {
|
||||
if (MyCommonUtil.isBlankOrNull(permCodeId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysPermCodeService.getSysRoleListWithDetail(permCodeId, roleName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsapi.dto.SysPermDto;
|
||||
import com.orangeforms.upmsapi.vo.SysPermVo;
|
||||
import com.orangeforms.upmsservice.model.SysPerm;
|
||||
import com.orangeforms.upmsservice.service.SysPermService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 权限资源管理接口控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "权限资源管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysPerm")
|
||||
public class SysPermController {
|
||||
|
||||
@Autowired
|
||||
private SysPermService sysPermService;
|
||||
|
||||
/**
|
||||
* 新增权限资源操作。
|
||||
*
|
||||
* @param sysPermDto 新增权限资源对象。
|
||||
* @return 应答结果对象,包含新增权限资源的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysPermDto.permId"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SysPermDto sysPermDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysPerm sysPerm = MyModelUtil.copyTo(sysPermDto, SysPerm.class);
|
||||
CallResult result = sysPermService.verifyRelatedData(sysPerm, null);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
sysPerm = sysPermService.saveNew(sysPerm);
|
||||
return ResponseResult.success(sysPerm.getPermId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限资源操作。
|
||||
*
|
||||
* @param sysPermDto 更新权限资源对象。
|
||||
* @return 应答结果对象,包含更新权限资源的主键Id。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody SysPermDto sysPermDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysPerm originalPerm = sysPermService.getById(sysPermDto.getPermId());
|
||||
if (originalPerm == null) {
|
||||
errorMessage = "数据验证失败,当前权限资源并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
SysPerm sysPerm = MyModelUtil.copyTo(sysPermDto, SysPerm.class);
|
||||
CallResult result = sysPermService.verifyRelatedData(sysPerm, originalPerm);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
sysPermService.update(sysPerm, originalPerm);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定权限资源操作。
|
||||
*
|
||||
* @param permId 指定的权限资源主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long permId) {
|
||||
if (MyCommonUtil.existBlankArgument(permId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysPermService.remove(permId)) {
|
||||
String errorMessage = "数据操作失败,权限不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看权限资源对象详情。
|
||||
*
|
||||
* @param permId 指定权限资源主键Id。
|
||||
* @return 应答结果对象,包含权限资源对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SysPermVo> view(@RequestParam Long permId) {
|
||||
if (MyCommonUtil.existBlankArgument(permId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
SysPerm perm = sysPermService.getById(permId);
|
||||
if (perm == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysPermVo permVo = MyModelUtil.copyTo(perm, SysPermVo.class);
|
||||
return ResponseResult.success(permVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看权限资源列表。
|
||||
*
|
||||
* @param sysPermDtoFilter 过滤对象。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含权限资源列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<SysPermVo>> list(
|
||||
@MyRequestBody SysPermDto sysPermDtoFilter, @MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysPerm filter = MyModelUtil.copyTo(sysPermDtoFilter, SysPerm.class);
|
||||
List<SysPerm> permList = sysPermService.getPermListWithRelation(filter);
|
||||
List<SysPermVo> permVoList = MyModelUtil.copyCollectionTo(permList, SysPermVo.class);
|
||||
long totalCount = 0L;
|
||||
if (permList instanceof Page) {
|
||||
totalCount = ((Page<SysPerm>) permList).getTotal();
|
||||
}
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(permVoList, totalCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 应答对象。包含从权限资源到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysUserWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysUserWithDetail(Long permId, String loginName) {
|
||||
if (MyCommonUtil.isBlankOrNull(permId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysPermService.getSysUserListWithDetail(permId, loginName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 应答对象。包含从权限资源到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysRoleWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysRoleWithDetail(Long permId, String roleName) {
|
||||
if (MyCommonUtil.isBlankOrNull(permId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysPermService.getSysRoleListWithDetail(permId, roleName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param menuName 菜单名。
|
||||
* @return 应答对象。包含从权限资源到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysMenuWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysMenuWithDetail(Long permId, String menuName) {
|
||||
if (MyCommonUtil.isBlankOrNull(permId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysPermService.getSysMenuListWithDetail(permId, menuName));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsapi.dto.SysPermModuleDto;
|
||||
import com.orangeforms.upmsapi.vo.SysPermModuleVo;
|
||||
import com.orangeforms.upmsservice.model.SysPerm;
|
||||
import com.orangeforms.upmsservice.model.SysPermModule;
|
||||
import com.orangeforms.upmsservice.service.SysPermModuleService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 权限资源模块管理接口控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "权限资源模块管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysPermModule")
|
||||
public class SysPermModuleController {
|
||||
|
||||
@Autowired
|
||||
private SysPermModuleService sysPermModuleService;
|
||||
|
||||
/**
|
||||
* 新增权限资源模块操作。
|
||||
*
|
||||
* @param sysPermModuleDto 新增权限资源模块对象。
|
||||
* @return 应答结果对象,包含新增权限资源模块的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysPermModuleDto.moduleId"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SysPermModuleDto sysPermModuleDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermModuleDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysPermModule sysPermModule = MyModelUtil.copyTo(sysPermModuleDto, SysPermModule.class);
|
||||
if (sysPermModule.getParentId() != null
|
||||
&& sysPermModuleService.getById(sysPermModule.getParentId()) == null) {
|
||||
errorMessage = "数据验证失败,关联的上级权限模块并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_PARENT_ID_NOT_EXIST, errorMessage);
|
||||
}
|
||||
sysPermModule = sysPermModuleService.saveNew(sysPermModule);
|
||||
return ResponseResult.success(sysPermModule.getModuleId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限资源模块操作。
|
||||
*
|
||||
* @param sysPermModuleDto 更新权限资源模块对象。
|
||||
* @return 应答结果对象,包含新增权限资源模块的主键Id。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody SysPermModuleDto sysPermModuleDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysPermModuleDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysPermModule sysPermModule = MyModelUtil.copyTo(sysPermModuleDto, SysPermModule.class);
|
||||
SysPermModule originalPermModule = sysPermModuleService.getById(sysPermModule.getModuleId());
|
||||
if (originalPermModule == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
if (sysPermModule.getParentId() != null
|
||||
&& !sysPermModule.getParentId().equals(originalPermModule.getParentId())) {
|
||||
if (sysPermModuleService.getById(sysPermModule.getParentId()) == null) {
|
||||
errorMessage = "数据验证失败,关联的上级权限模块并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_PARENT_ID_NOT_EXIST, errorMessage);
|
||||
}
|
||||
}
|
||||
if (!sysPermModuleService.update(sysPermModule, originalPermModule)) {
|
||||
errorMessage = "数据验证失败,当前模块并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定权限资源模块操作。
|
||||
*
|
||||
* @param moduleId 指定的权限资源模块主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long moduleId) {
|
||||
if (MyCommonUtil.existBlankArgument(moduleId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
String errorMessage;
|
||||
if (sysPermModuleService.hasChildren(moduleId)
|
||||
|| sysPermModuleService.hasModulePerms(moduleId)) {
|
||||
errorMessage = "数据验证失败,当前权限模块存在子模块或权限资源,请先删除关联数据!";
|
||||
return ResponseResult.error(ErrorCodeEnum.HAS_CHILDREN_DATA, errorMessage);
|
||||
}
|
||||
if (!sysPermModuleService.remove(moduleId)) {
|
||||
errorMessage = "数据操作失败,权限模块不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看全部权限资源模块列表。
|
||||
*
|
||||
* @return 应答结果对象,包含权限资源模块列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<List<SysPermModuleVo>> list() {
|
||||
List<SysPermModule> permModuleList = sysPermModuleService.getAllListByOrder("showOrder");
|
||||
return ResponseResult.success(MyModelUtil.copyCollectionTo(permModuleList, SysPermModuleVo.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出全部权限资源模块及其下级关联的权限资源列表。
|
||||
*
|
||||
* @return 应答结果对象,包含树状列表,
|
||||
*/
|
||||
@PostMapping("/listAll")
|
||||
public ResponseResult<List<Map<String, Object>>> listAll() {
|
||||
List<SysPermModule> sysPermModuleList = sysPermModuleService.getPermModuleAndPermList();
|
||||
List<Map<String, Object>> resultList = new LinkedList<>();
|
||||
for (SysPermModule sysPermModule : sysPermModuleList) {
|
||||
Map<String, Object> permModuleMap = new HashMap<>(5);
|
||||
permModuleMap.put("id", sysPermModule.getModuleId());
|
||||
permModuleMap.put("name", sysPermModule.getModuleName());
|
||||
permModuleMap.put("type", sysPermModule.getModuleType());
|
||||
permModuleMap.put("isPerm", false);
|
||||
if (MyCommonUtil.isNotBlankOrNull(sysPermModule.getParentId())) {
|
||||
permModuleMap.put("parentId", sysPermModule.getParentId());
|
||||
}
|
||||
resultList.add(permModuleMap);
|
||||
if (CollectionUtils.isNotEmpty(sysPermModule.getSysPermList())) {
|
||||
for (SysPerm sysPerm : sysPermModule.getSysPermList()) {
|
||||
Map<String, Object> permMap = new HashMap<>(4);
|
||||
permMap.put("id", sysPerm.getPermId());
|
||||
permMap.put("name", sysPerm.getPermName());
|
||||
permMap.put("isPerm", true);
|
||||
permMap.put("url", sysPerm.getUrl());
|
||||
permMap.put("parentId", sysPermModule.getModuleId());
|
||||
resultList.add(permMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResponseResult.success(resultList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import cn.jimmyshi.beanquery.BeanQuery;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.MyPageUtil;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsapi.dto.SysRoleDto;
|
||||
import com.orangeforms.upmsapi.dto.SysUserDto;
|
||||
import com.orangeforms.upmsapi.vo.SysRoleVo;
|
||||
import com.orangeforms.upmsapi.vo.SysUserVo;
|
||||
import com.orangeforms.upmsservice.model.SysRole;
|
||||
import com.orangeforms.upmsservice.model.SysUser;
|
||||
import com.orangeforms.upmsservice.model.SysUserRole;
|
||||
import com.orangeforms.upmsservice.service.SysRoleService;
|
||||
import com.orangeforms.upmsservice.service.SysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 角色管理接口控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "角色管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysRole")
|
||||
public class SysRoleController {
|
||||
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 新增角色操作。
|
||||
*
|
||||
* @param sysRoleDto 新增角色对象。
|
||||
* @param menuIdListString 与当前角色Id绑定的menuId列表,多个menuId之间逗号分隔。
|
||||
* @return 应答结果对象,包含新增角色的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysRoleDto.roleId", "sysRoleDto.createTimeStart", "sysRoleDto.createTimeEnd"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysRoleDto sysRoleDto, @MyRequestBody String menuIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysRoleDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysRole sysRole = MyModelUtil.copyTo(sysRoleDto, SysRole.class);
|
||||
CallResult result = sysRoleService.verifyRelatedData(sysRole, null, menuIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> menuIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
menuIdSet = result.getData().getObject("menuIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
sysRoleService.saveNew(sysRole, menuIdSet);
|
||||
return ResponseResult.success(sysRole.getRoleId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色操作。
|
||||
*
|
||||
* @param sysRoleDto 更新角色对象。
|
||||
* @param menuIdListString 与当前角色Id绑定的menuId列表,多个menuId之间逗号分隔。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {"sysRoleDto.createTimeStart", "sysRoleDto.createTimeEnd"})
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(
|
||||
@MyRequestBody SysRoleDto sysRoleDto, @MyRequestBody String menuIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysRoleDto, Default.class, UpdateGroup.class);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysRole originalSysRole = sysRoleService.getById(sysRoleDto.getRoleId());
|
||||
if (originalSysRole == null) {
|
||||
errorMessage = "数据验证失败,当前角色并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
SysRole sysRole = MyModelUtil.copyTo(sysRoleDto, SysRole.class);
|
||||
CallResult result = sysRoleService.verifyRelatedData(sysRole, originalSysRole, menuIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> menuIdSet = null;
|
||||
if (result.getData() != null) {
|
||||
menuIdSet = result.getData().getObject("menuIdSet", new TypeReference<Set<Long>>(){});
|
||||
}
|
||||
if (!sysRoleService.update(sysRole, originalSysRole, menuIdSet)) {
|
||||
errorMessage = "更新失败,数据不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定角色操作。
|
||||
*
|
||||
* @param roleId 指定角色主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long roleId) {
|
||||
if (MyCommonUtil.existBlankArgument(roleId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysRoleService.remove(roleId)) {
|
||||
String errorMessage = "数据操作失败,角色不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看角色列表。
|
||||
*
|
||||
* @param sysRoleDtoFilter 角色过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含角色列表。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<SysRoleVo>> list(
|
||||
@MyRequestBody SysRoleDto sysRoleDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysRole filter = MyModelUtil.copyTo(sysRoleDtoFilter, SysRole.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysRole.class);
|
||||
List<SysRole> roleList = sysRoleService.getSysRoleList(filter, orderBy);
|
||||
List<SysRoleVo> roleVoList = MyModelUtil.copyCollectionTo(roleList, SysRoleVo.class);
|
||||
long totalCount = 0L;
|
||||
if (roleList instanceof Page) {
|
||||
totalCount = ((Page<SysRole>) roleList).getTotal();
|
||||
}
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(roleVoList, totalCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看角色详情。
|
||||
*
|
||||
* @param roleId 指定角色主键Id。
|
||||
* @return 应答结果对象,包含角色详情对象。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SysRoleVo> view(@RequestParam Long roleId) {
|
||||
if (MyCommonUtil.existBlankArgument(roleId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
SysRole sysRole = sysRoleService.getByIdWithRelation(roleId, MyRelationParam.full());
|
||||
if (sysRole == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysRoleVo sysRoleVo = MyModelUtil.copyTo(sysRole, SysRoleVo.class);
|
||||
return ResponseResult.success(sysRoleVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取不包含指定角色Id的用户列表。
|
||||
* 用户和角色是多对多关系,当前接口将返回没有赋值指定RoleId的用户列表。可用于给角色添加新用户。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param sysUserDtoFilter 用户过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含用户列表数据。
|
||||
*/
|
||||
@PostMapping("/listNotInUserRole")
|
||||
public ResponseResult<MyPageData<SysUserVo>> listNotInUserRole(
|
||||
@MyRequestBody Long roleId,
|
||||
@MyRequestBody SysUserDto sysUserDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doRoleUserVerify(roleId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysUser filter = MyModelUtil.copyTo(sysUserDtoFilter, SysUser.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysUser.class);
|
||||
List<SysUser> userList = sysUserService.getNotInSysUserListByRoleId(roleId, filter, orderBy);
|
||||
List<SysUserVo> userVoList = MyModelUtil.copyCollectionTo(userList, SysUserVo.class);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(userVoList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拥有指定角色的用户列表。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param sysUserDtoFilter 用户过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含用户列表数据。
|
||||
*/
|
||||
@PostMapping("/listUserRole")
|
||||
public ResponseResult<MyPageData<SysUserVo>> listUserRole(
|
||||
@MyRequestBody Long roleId,
|
||||
@MyRequestBody SysUserDto sysUserDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doRoleUserVerify(roleId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysUser filter = MyModelUtil.copyTo(sysUserDtoFilter, SysUser.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysUser.class);
|
||||
List<SysUser> userList = sysUserService.getSysUserListByRoleId(roleId, filter, orderBy);
|
||||
List<SysUserVo> userVoList = MyModelUtil.copyCollectionTo(userList, SysUserVo.class);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(userVoList));
|
||||
}
|
||||
|
||||
private ResponseResult<Void> doRoleUserVerify(Long roleId) {
|
||||
if (MyCommonUtil.existBlankArgument(roleId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysRoleService.existId(roleId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 为指定角色添加用户列表。该操作可同时给一批用户赋值角色,并在同一事务内完成。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param userIdListString 逗号分隔的用户Id列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.ADD_M2M)
|
||||
@PostMapping("/addUserRole")
|
||||
public ResponseResult<Void> addUserRole(
|
||||
@MyRequestBody Long roleId, @MyRequestBody String userIdListString) {
|
||||
if (MyCommonUtil.existBlankArgument(roleId, userIdListString)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
Set<Long> userIdSet = Arrays.stream(
|
||||
userIdListString.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysRoleService.existId(roleId)
|
||||
|| !sysUserService.existUniqueKeyList("userId", userIdSet)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
List<SysUserRole> userRoleList = new LinkedList<>();
|
||||
for (Long userId : userIdSet) {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(roleId);
|
||||
userRole.setUserId(userId);
|
||||
userRoleList.add(userRole);
|
||||
}
|
||||
sysRoleService.addUserRoleList(userRoleList);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 为指定用户移除指定角色。
|
||||
*
|
||||
* @param roleId 指定角色主键Id。
|
||||
* @param userId 指定用户主键Id。
|
||||
* @return 应答数据结果。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE_M2M)
|
||||
@PostMapping("/deleteUserRole")
|
||||
public ResponseResult<Void> deleteUserRole(
|
||||
@MyRequestBody Long roleId, @MyRequestBody Long userId) {
|
||||
if (MyCommonUtil.existBlankArgument(roleId, userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysRoleService.removeUserRole(roleId, userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字典形式返回全部角色管理数据集合。字典的键值为[roleId, roleName]。
|
||||
* 白名单接口,登录用户均可访问。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 应答结果对象,包含的数据为 List<Map<String, String>>,map中包含两条记录,key的值分别是id和name,value对应具体数据。
|
||||
*/
|
||||
@GetMapping("/listDict")
|
||||
public ResponseResult<List<Map<String, Object>>> listDict(SysRole filter) {
|
||||
List<SysRole> resultList = sysRoleService.getListByFilter(filter);
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"roleId as id", "roleName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典Id集合,获取查询后的字典数据。
|
||||
*
|
||||
* @param dictIds 字典Id集合。
|
||||
* @return 应答结果对象,包含字典形式的数据集合。
|
||||
*/
|
||||
@PostMapping("/listDictByIds")
|
||||
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||
@MyRequestBody(elementType = Long.class) List<Long> dictIds) {
|
||||
List<SysRole> resultList = sysRoleService.getInList(new HashSet<>(dictIds));
|
||||
return ResponseResult.success(BeanQuery.select(
|
||||
"roleId as id", "roleName as name").executeFrom(resultList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 应答对象,包含从角色到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysPermWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysPermWithDetail(Long roleId, String url) {
|
||||
if (MyCommonUtil.isBlankOrNull(roleId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysRoleService.getSysPermListWithDetail(roleId, url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 应答对象,包含从角色到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysPermCodeWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysPermCodeWithDetail(Long roleId, String permCode) {
|
||||
if (MyCommonUtil.isBlankOrNull(roleId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysRoleService.getSysPermCodeListWithDetail(roleId, permCode));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
package com.orangeforms.upmsservice.controller;
|
||||
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.github.pagehelper.page.PageMethod;
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.upmsservice.service.*;
|
||||
import com.orangeforms.upmsapi.dto.*;
|
||||
import com.orangeforms.upmsapi.vo.*;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.util.*;
|
||||
import com.orangeforms.common.core.constant.*;
|
||||
import com.orangeforms.common.core.base.controller.BaseController;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.annotation.MyRequestBody;
|
||||
import com.orangeforms.common.log.annotation.OperationLog;
|
||||
import com.orangeforms.common.log.model.constant.SysOperationLogType;
|
||||
import com.orangeforms.upmsservice.config.ApplicationConfig;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户管理操作控制器类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Api(tags = "用户管理管理接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysUser")
|
||||
public class SysUserController extends BaseController<SysUser, SysUserVo, Long> {
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private ApplicationConfig appConfig;
|
||||
|
||||
@Override
|
||||
protected IBaseService<SysUser, Long> service() {
|
||||
return sysUserService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户操作。
|
||||
*
|
||||
* @param sysUserDto 新增用户对象。
|
||||
* @param dataPermIdListString 逗号分隔的数据权限Id列表。
|
||||
* @param roleIdListString 逗号分隔的角色Id列表。
|
||||
* @return 应答结果对象,包含新增用户的主键Id。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"sysUserDto.userId",
|
||||
"sysUserDto.createTimeStart",
|
||||
"sysUserDto.createTimeEnd"})
|
||||
@OperationLog(type = SysOperationLogType.ADD)
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(
|
||||
@MyRequestBody SysUserDto sysUserDto,
|
||||
@MyRequestBody String dataPermIdListString,
|
||||
@MyRequestBody String roleIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUserDto);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysUser sysUser = MyModelUtil.copyTo(sysUserDto, SysUser.class);
|
||||
CallResult result = sysUserService.verifyRelatedData(
|
||||
sysUser, null, roleIdListString, dataPermIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> roleIdSet = result.getData().getObject("roleIdSet", new TypeReference<Set<Long>>() {});
|
||||
Set<Long> dataPermIdSet = result.getData().getObject("dataPermIdSet", new TypeReference<Set<Long>>() {});
|
||||
sysUserService.saveNew(sysUser, roleIdSet, dataPermIdSet);
|
||||
return ResponseResult.success(sysUser.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户操作。
|
||||
*
|
||||
* @param sysUserDto 更新用户对象。
|
||||
* @param dataPermIdListString 逗号分隔的数据权限Id列表。
|
||||
* @param roleIdListString 逗号分隔的角色Id列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperationSupport(ignoreParameters = {
|
||||
"sysUserDto.createTimeStart",
|
||||
"sysUserDto.createTimeEnd"})
|
||||
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(
|
||||
@MyRequestBody SysUserDto sysUserDto,
|
||||
@MyRequestBody String dataPermIdListString,
|
||||
@MyRequestBody String roleIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUserDto, true);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
SysUser originalUser = sysUserService.getById(sysUserDto.getUserId());
|
||||
if (originalUser == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysUser sysUser = MyModelUtil.copyTo(sysUserDto, SysUser.class);
|
||||
CallResult result = sysUserService.verifyRelatedData(
|
||||
sysUser, originalUser, roleIdListString, dataPermIdListString);
|
||||
if (!result.isSuccess()) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||
}
|
||||
Set<Long> roleIdSet = result.getData().getObject("roleIdSet", new TypeReference<Set<Long>>() {});
|
||||
Set<Long> dataPermIdSet = result.getData().getObject("dataPermIdSet", new TypeReference<Set<Long>>() {});
|
||||
if (!sysUserService.update(sysUser, originalUser, roleIdSet, dataPermIdSet)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户管理数据。
|
||||
*
|
||||
* @param userId 删除对象主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@OperationLog(type = SysOperationLogType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult<Void> delete(@MyRequestBody Long userId) {
|
||||
String errorMessage;
|
||||
if (MyCommonUtil.existBlankArgument(userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 验证关联Id的数据合法性
|
||||
SysUser originalSysUser = sysUserService.getById(userId);
|
||||
if (originalSysUser == null) {
|
||||
// NOTE: 修改下面方括号中的话述
|
||||
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
if (!sysUserService.remove(userId)) {
|
||||
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列出符合过滤条件的用户管理列表。
|
||||
*
|
||||
* @param sysUserDtoFilter 过滤对象。
|
||||
* @param orderParam 排序参数。
|
||||
* @param pageParam 分页参数。
|
||||
* @return 应答结果对象,包含查询结果集。
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<MyPageData<SysUserVo>> list(
|
||||
@MyRequestBody SysUserDto sysUserDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysUser sysUserFilter = MyModelUtil.copyTo(sysUserDtoFilter, SysUser.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysUser.class);
|
||||
List<SysUser> sysUserList = sysUserService.getSysUserListWithRelation(sysUserFilter, orderBy);
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(sysUserList, SysUser.INSTANCE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看指定用户管理对象详情。
|
||||
*
|
||||
* @param userId 指定对象主键Id。
|
||||
* @return 应答结果对象,包含对象详情。
|
||||
*/
|
||||
@GetMapping("/view")
|
||||
public ResponseResult<SysUserVo> view(@RequestParam Long userId) {
|
||||
if (MyCommonUtil.existBlankArgument(userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
// 这里查看用户数据时候,需要把用户多对多关联的角色和数据权限Id一并查出。
|
||||
SysUser sysUser = sysUserService.getByIdWithRelation(userId, MyRelationParam.full());
|
||||
if (sysUser == null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||
}
|
||||
SysUserVo sysUserVo = SysUser.INSTANCE.fromModel(sysUser);
|
||||
return ResponseResult.success(sysUserVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 应答对象,包含从用户到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysPermWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysPermWithDetail(Long userId, String url) {
|
||||
if (MyCommonUtil.isBlankOrNull(userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysUserService.getSysPermListWithDetail(userId, url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 应答对象,包含从用户到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysPermCodeWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysPermCodeWithDetail(Long userId, String permCode) {
|
||||
if (MyCommonUtil.isBlankOrNull(userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysUserService.getSysPermCodeListWithDetail(userId, permCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param menuName 菜单名称过滤条件。
|
||||
* @return 应答对象,包含从用户到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@GetMapping("/listSysMenuWithDetail")
|
||||
public ResponseResult<List<Map<String, Object>>> listSysMenuWithDetail(Long userId, String menuName) {
|
||||
if (MyCommonUtil.isBlankOrNull(userId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
return ResponseResult.success(sysUserService.getSysMenuListWithDetail(userId, menuName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键Id集合,获取数据对象集合。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param userIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "listByIds")
|
||||
@PostMapping("/listByIds")
|
||||
public ResponseResult<List<SysUserVo>> listByIds(
|
||||
@RequestParam Set<Long> userIds, @RequestParam Boolean withDict) {
|
||||
return super.baseListByIds(userIds, withDict, SysUser.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键Id,获取数据对象。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param userId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "getById")
|
||||
@PostMapping("/getById")
|
||||
public ResponseResult<SysUserVo> getById(
|
||||
@RequestParam Long userId, @RequestParam Boolean withDict) {
|
||||
return super.baseGetById(userId, withDict, SysUser.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id集合,是否全部存在。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param userIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "existIds")
|
||||
@PostMapping("/existIds")
|
||||
public ResponseResult<Boolean> existIds(@RequestParam Set<Long> userIds) {
|
||||
return super.baseExistIds(userIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id是否存在。仅限于微服务间远程接口调用。
|
||||
*
|
||||
* @param userId 主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "existId")
|
||||
@PostMapping("/existId")
|
||||
public ResponseResult<Boolean> existId(@RequestParam Long userId) {
|
||||
return super.baseExistId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象列表和原有对象的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param data 数据对象。
|
||||
* 主键有值是视为更新操作的数据比对,因此仅当关联Id变化时才会验证。
|
||||
* 主键为空视为新增操作的数据比对,所有关联Id都会被验证。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "verifyRelatedData")
|
||||
@PostMapping("/verifyRelatedData")
|
||||
public ResponseResult<Void> verifyRelatedData(@RequestBody SysUserDto data) {
|
||||
SysUser sysUser = MyModelUtil.copyTo(data, SysUser.class);
|
||||
return super.baseVerifyRelatedData(sysUser, SysUser::getUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最新对象列表和原有对象列表的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param dataList 数据对象列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "verifyRelatedDataList")
|
||||
@PostMapping("/verifyRelatedDataList")
|
||||
public ResponseResult<Void> verifyRelatedDataList(@RequestBody List<SysUserDto> dataList) {
|
||||
List<SysUser> sysUserList = MyModelUtil.copyCollectionTo(dataList, SysUser.class);
|
||||
return super.baseVerifyRelatedDataList(sysUserList, SysUser::getUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键Id删除数据。
|
||||
*
|
||||
* @param userId 主键Id。
|
||||
* @return 删除数量。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "deleteById")
|
||||
@PostMapping("/deleteById")
|
||||
public ResponseResult<Integer> deleteById(@RequestParam Long userId) throws Exception {
|
||||
SysUser filter = new SysUser();
|
||||
filter.setUserId(userId);
|
||||
return super.baseDeleteBy(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除符合过滤条件的数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 删除数量。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "deleteBy")
|
||||
@PostMapping("/deleteBy")
|
||||
public ResponseResult<Integer> deleteBy(@RequestBody SysUserDto filter) throws Exception {
|
||||
return super.baseDeleteBy(MyModelUtil.copyTo(filter, SysUser.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 复杂的查询调用,包括(in list)过滤,对象条件过滤,分页和排序等。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 分页数据集合对象。如MyQueryParam参数的分页属性为空,则不会执行分页操作,只是基于MyPageData对象返回数据结果。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "listBy")
|
||||
@PostMapping("/listBy")
|
||||
public ResponseResult<MyPageData<SysUserVo>> listBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseListBy(queryParam, SysUser.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复杂的查询调用,包括(in list)过滤,对象条件过滤,分页和排序等。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 分页数据集合对象。如MyQueryParam参数的分页属性为空,则不会执行分页操作,只是基于MyPageData对象返回数据结果。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "listMapBy")
|
||||
@PostMapping("/listMapBy")
|
||||
public ResponseResult<MyPageData<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseListMapBy(queryParam, SysUser.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复杂的查询调用,仅返回单体记录。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含符合查询过滤条件的对象结果集。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "getBy")
|
||||
@PostMapping("/getBy")
|
||||
public ResponseResult<SysUserVo> getBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseGetBy(queryParam, SysUser.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。主要用于微服务间远程过程调用。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "countBy")
|
||||
@PostMapping("/countBy")
|
||||
public ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam) {
|
||||
return super.baseCountBy(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "aggregateBy")
|
||||
@PostMapping("/aggregateBy")
|
||||
public ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam) {
|
||||
return super.baseAggregateBy(aggregationParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定角色Id集合的用户数据集合。
|
||||
* @param roleIds 角色Id集合。
|
||||
* @return 应该结果对象,包含查询后的用户列表。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "getSysUserListByRoleIds")
|
||||
@GetMapping("/getSysUserListByRoleIds")
|
||||
public ResponseResult<List<SysUserVo>> getSysUserListByRoleIds(@RequestParam Set<Long> roleIds) {
|
||||
List<SysUserVo> resultList = new LinkedList<>();
|
||||
for (Long roleId : roleIds) {
|
||||
List<SysUser> userList = sysUserService.getSysUserListByRoleId(roleId, null, null);
|
||||
if (CollUtil.isNotEmpty(userList)) {
|
||||
resultList.addAll(SysUser.INSTANCE.fromModelList(userList));
|
||||
}
|
||||
}
|
||||
return ResponseResult.success(resultList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定部门Id集合的用户数据集合。
|
||||
* @param deptIds 部门Id集合。
|
||||
* @return 应该结果对象,包含查询后的用户列表。
|
||||
*/
|
||||
@ApiOperation(hidden = true, value = "getSysUserListByDeptIds")
|
||||
@GetMapping("/getSysUserListByDeptIds")
|
||||
public ResponseResult<List<SysUserVo>> getSysUserListByDeptIds(@RequestParam Set<Long> deptIds) {
|
||||
List<SysUserVo> resultList = new LinkedList<>();
|
||||
for (Long deptId : deptIds) {
|
||||
SysUser filter = new SysUser();
|
||||
filter.setDeptId(deptId);
|
||||
List<SysUser> userList = sysUserService.getSysUserList(filter, null);
|
||||
if (CollUtil.isNotEmpty(userList)) {
|
||||
resultList.addAll(SysUser.INSTANCE.fromModelList(userList));
|
||||
}
|
||||
}
|
||||
return ResponseResult.success(resultList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysDataPermDept;
|
||||
|
||||
/**
|
||||
* 数据权限与部门关系数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysDataPermDeptMapper extends BaseDaoMapper<SysDataPermDept> {
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysDataPerm;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据权限数据访问操作接口。
|
||||
* NOTE: 该对象一定不能被 @EnableDataPerm 注解标注,否则会导致无限递归。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysDataPermMapper extends BaseDaoMapper<SysDataPerm> {
|
||||
|
||||
/**
|
||||
* 获取数据权限列表。
|
||||
*
|
||||
* @param sysDataPermFilter 过滤对象。
|
||||
* @param orderBy 排序字符串。
|
||||
* @return 过滤后的数据权限列表。
|
||||
*/
|
||||
List<SysDataPerm> getSysDataPermList(
|
||||
@Param("sysDataPermFilter") SysDataPerm sysDataPermFilter, @Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 获取指定用户的数据权限列表。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @return 数据权限列表。
|
||||
*/
|
||||
List<SysDataPerm> getSysDataPermListByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysDataPermUser;
|
||||
|
||||
/**
|
||||
* 数据权限与用户关系数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysDataPermUserMapper extends BaseDaoMapper<SysDataPermUser> {
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysDept;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门管理数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysDeptMapper extends BaseDaoMapper<SysDept> {
|
||||
|
||||
/**
|
||||
* 批量插入对象列表。
|
||||
*
|
||||
* @param sysDeptList 新增对象列表。
|
||||
*/
|
||||
void insertList(List<SysDept> sysDeptList);
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param inFilterColumn 参与(In-list)过滤的数据表列。
|
||||
* @param inFilterValues 参与(In-list)过滤的数据表列值集合。
|
||||
* @param sysDeptFilter 过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
<M> List<SysDept> getSysDeptList(
|
||||
@Param("inFilterColumn") String inFilterColumn,
|
||||
@Param("inFilterValues") Set<M> inFilterValues,
|
||||
@Param("sysDeptFilter") SysDept sysDeptFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 获取对象列表,过滤条件中包含like和between条件,以及指定属性的(in list)过滤条件。
|
||||
*
|
||||
* @param inFilterColumn 参与(In-list)过滤的数据表列。
|
||||
* @param inFilterValues 参与(In-list)过滤的数据表列值集合。
|
||||
* @param sysDeptFilter 过滤对象。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
<M> Integer getSysDeptCount(
|
||||
@Param("inFilterColumn") String inFilterColumn,
|
||||
@Param("inFilterValues") Set<M> inFilterValues,
|
||||
@Param("sysDeptFilter") SysDept sysDeptFilter);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysDeptRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门关系树关联关系表访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysDeptRelationMapper extends BaseDaoMapper<SysDeptRelation> {
|
||||
|
||||
/**
|
||||
* 将myDeptId的所有子部门,与其父部门parentDeptId解除关联关系。
|
||||
*
|
||||
* @param parentDeptId myDeptId的父部门Id。
|
||||
* @param myDeptId 当前部门。
|
||||
*/
|
||||
void removeBetweenChildrenAndParents(
|
||||
@Param("parentDeptId") Long parentDeptId, @Param("myDeptId") Long myDeptId);
|
||||
|
||||
/**
|
||||
* 批量插入部门关联数据。
|
||||
* 由于目前版本(3.4.1)的Mybatis Plus没有提供真正的批量插入,为了保证效率需要自己实现。
|
||||
* 目前我们仅仅给出MySQL的insert list实现作为参考,其他数据库需要自行修改。
|
||||
*
|
||||
* @param deptRelationList 部门关联关系数据列表。
|
||||
*/
|
||||
void insertList(List<SysDeptRelation> deptRelationList);
|
||||
|
||||
/**
|
||||
* 批量插入当前部门的所有父部门列表,包括自己和自己的关系。
|
||||
*
|
||||
* @param parentDeptId myDeptId的父部门Id。
|
||||
* @param myDeptId 当前部门。
|
||||
*/
|
||||
void insertParentList(@Param("parentDeptId") Long parentDeptId, @Param("myDeptId") Long myDeptId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysMenu;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysMenuMapper extends BaseDaoMapper<SysMenu> {
|
||||
|
||||
/**
|
||||
* 获取登录用户的菜单列表。
|
||||
*
|
||||
* @param userId 登录用户。
|
||||
* @return 菜单列表。
|
||||
*/
|
||||
List<SysMenu> getMenuListByUserId(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 获取当前用户有权访问的在线表单菜单,仅返回类型为BUTTON的菜单。
|
||||
*
|
||||
* @param userId 指定的用户。
|
||||
* @param menuType 菜单类型,NULL则返回全部类型。
|
||||
* @return 在线表单关联的菜单列表。
|
||||
*/
|
||||
List<SysMenu> getOnlineMenuListByUserId(
|
||||
@Param("userId") Long userId, @Param("menuType") Integer menuType);
|
||||
|
||||
/**
|
||||
* 查询菜单的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param url 权限资源地址过滤条件。
|
||||
* @return 包含从菜单到权限资源的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermListWithDetail(
|
||||
@Param("menuId") Long menuId, @Param("url") String url);
|
||||
|
||||
/**
|
||||
* 查询菜单的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从菜单到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysUserListWithDetail(
|
||||
@Param("menuId") Long menuId, @Param("loginName") String loginName);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysMenuPermCode;
|
||||
|
||||
/**
|
||||
* 菜单与权限字关系数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysMenuPermCodeMapper extends BaseDaoMapper<SysMenuPermCode> {
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPermCode;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 权限字数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermCodeMapper extends BaseDaoMapper<SysPermCode> {
|
||||
|
||||
/**
|
||||
* 获取用户的所有权限字列表。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @return 该用户的权限字列表。
|
||||
*/
|
||||
List<String> getPermCodeListByUserId(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 查询权限字的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从权限字到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysUserListWithDetail(
|
||||
@Param("permCodeId") Long permCodeId, @Param("loginName") String loginName);
|
||||
|
||||
/**
|
||||
* 查询权限字的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 包含从权限字到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysRoleListWithDetail(
|
||||
@Param("permCodeId") Long permCodeId, @Param("roleName") String roleName);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPermCodePerm;
|
||||
|
||||
/**
|
||||
* 权限字与权限资源关系数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermCodePermMapper extends BaseDaoMapper<SysPermCodePerm> {
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPerm;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 权限资源数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermMapper extends BaseDaoMapper<SysPerm> {
|
||||
|
||||
/**
|
||||
* 获取用户的权限列表。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @return 该用户的权限标识列表。
|
||||
*/
|
||||
List<String> getPermListByUserId(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从权限资源到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysUserListWithDetail(
|
||||
@Param("permId") Long permId, @Param("loginName") String loginName);
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 包含从权限资源到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysRoleListWithDetail(
|
||||
@Param("permId") Long permId, @Param("roleName") String roleName);
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param menuName 菜单名。
|
||||
* @return 包含从权限资源到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysMenuListWithDetail(
|
||||
@Param("permId") Long permId, @Param("menuName") String menuName);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPermModule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限资源模块数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermModuleMapper extends BaseDaoMapper<SysPermModule> {
|
||||
|
||||
/**
|
||||
* 获取整个权限模块和权限关联后的全部数据。
|
||||
*
|
||||
* @return 关联的权限模块和权限资源列表。
|
||||
*/
|
||||
List<SysPermModule> getPermModuleAndPermList();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPermWhitelist;
|
||||
|
||||
/**
|
||||
* 权限资源白名单数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermWhitelistMapper extends BaseDaoMapper<SysPermWhitelist> {
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysRole;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysRoleMapper extends BaseDaoMapper<SysRole> {
|
||||
|
||||
/**
|
||||
* 获取对象列表,过滤条件中包含like和between条件。
|
||||
*
|
||||
* @param sysRoleFilter 过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
List<SysRole> getSysRoleList(@Param("sysRoleFilter") SysRole sysRoleFilter, @Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 查询角色的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 包含从角色到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermListWithDetail(
|
||||
@Param("roleId") Long roleId, @Param("url") String url);
|
||||
|
||||
/**
|
||||
* 查询角色的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 包含从角色到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermCodeListWithDetail(
|
||||
@Param("roleId") Long roleId, @Param("permCode") String permCode);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysRoleMenu;
|
||||
|
||||
/**
|
||||
* 角色与菜单操作关联关系数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysRoleMenuMapper extends BaseDaoMapper<SysRoleMenu> {
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户管理数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysUserMapper extends BaseDaoMapper<SysUser> {
|
||||
|
||||
/**
|
||||
* 批量插入对象列表。
|
||||
*
|
||||
* @param sysUserList 新增对象列表。
|
||||
*/
|
||||
void insertList(List<SysUser> sysUserList);
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
* @param inFilterColumn 参与(In-list)过滤的数据表列。
|
||||
* @param inFilterValues 参与(In-list)过滤的数据表列值集合。
|
||||
* @param sysUserFilter 过滤对象。
|
||||
* @param orderBy 排序字符串,order by从句的参数。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
<M> List<SysUser> getSysUserList(
|
||||
@Param("inFilterColumn") String inFilterColumn,
|
||||
@Param("inFilterValues") Set<M> inFilterValues,
|
||||
@Param("sysUserFilter") SysUser sysUserFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 获取对象列表,过滤条件中包含like和between条件,以及指定属性的(in list)过滤条件。
|
||||
*
|
||||
* @param inFilterColumn 参与(In-list)过滤的数据表列。
|
||||
* @param inFilterValues 参与(In-list)过滤的数据表列值集合。
|
||||
* @param sysUserFilter 过滤对象。
|
||||
* @return 对象列表。
|
||||
*/
|
||||
<M> Integer getSysUserCount(
|
||||
@Param("inFilterColumn") String inFilterColumn,
|
||||
@Param("inFilterValues") Set<M> inFilterValues,
|
||||
@Param("sysUserFilter") SysUser sysUserFilter);
|
||||
|
||||
/**
|
||||
* 根据角色Id,获取关联的用户Id列表。
|
||||
*
|
||||
* @param roleId 关联的角色Id。
|
||||
* @param sysUserFilter 用户过滤条件对象。
|
||||
* @param orderBy order by从句的参数。
|
||||
* @return 和RoleId关联的用户列表。
|
||||
*/
|
||||
List<SysUser> getSysUserListByRoleId(
|
||||
@Param("roleId") Long roleId,
|
||||
@Param("sysUserFilter") SysUser sysUserFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 根据角色Id,获取和当前角色Id没有建立多对多关联关系的用户Id列表。
|
||||
*
|
||||
* @param roleId 关联的角色Id。
|
||||
* @param sysUserFilter 用户过滤条件对象。
|
||||
* @param orderBy order by从句的参数。
|
||||
* @return 和RoleId没有建立关联关系的用户列表。
|
||||
*/
|
||||
List<SysUser> getNotInSysUserListByRoleId(
|
||||
@Param("roleId") Long roleId,
|
||||
@Param("sysUserFilter") SysUser sysUserFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 根据数据权限Id,获取关联的用户Id列表。
|
||||
*
|
||||
* @param dataPermId 关联的数据权限Id。
|
||||
* @param sysUserFilter 用户过滤条件对象。
|
||||
* @param orderBy order by从句的参数。
|
||||
* @return 和DataPermId关联的用户列表。
|
||||
*/
|
||||
List<SysUser> getSysUserListByDataPermId(
|
||||
@Param("dataPermId") Long dataPermId,
|
||||
@Param("sysUserFilter") SysUser sysUserFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 根据数据权限Id,获取和当前数据权限Id没有建立多对多关联关系的用户Id列表。
|
||||
*
|
||||
* @param dataPermId 关联的数据权限Id。
|
||||
* @param sysUserFilter 用户过滤条件对象。
|
||||
* @param orderBy order by从句的参数。
|
||||
* @return 和DataPermId没有建立关联关系的用户列表。
|
||||
*/
|
||||
List<SysUser> getNotInSysUserListByDataPermId(
|
||||
@Param("dataPermId") Long dataPermId,
|
||||
@Param("sysUserFilter") SysUser sysUserFilter,
|
||||
@Param("orderBy") String orderBy);
|
||||
|
||||
/**
|
||||
* 查询用户的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 包含从用户到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermListWithDetail(
|
||||
@Param("userId") Long userId, @Param("url") String url);
|
||||
|
||||
/**
|
||||
* 查询用户的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 包含从用户到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermCodeListWithDetail(
|
||||
@Param("userId") Long userId, @Param("permCode") String permCode);
|
||||
|
||||
/**
|
||||
* 查询用户的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param menuName 菜单名称过滤条件。
|
||||
* @return 包含从用户到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysMenuListWithDetail(
|
||||
@Param("userId") Long userId, @Param("menuName") String menuName);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.orangeforms.upmsservice.dao;
|
||||
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.model.SysUserRole;
|
||||
|
||||
/**
|
||||
* 用户与角色关联关系数据访问操作接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysUserRoleMapper extends BaseDaoMapper<SysUserRole> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysDataPermDeptMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysDataPermDept">
|
||||
<id column="data_perm_id" jdbcType="BIGINT" property="dataPermId"/>
|
||||
<id column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysDataPermMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysDataPerm">
|
||||
<id column="data_perm_id" jdbcType="BIGINT" property="dataPermId"/>
|
||||
<result column="data_perm_name" jdbcType="VARCHAR" property="dataPermName"/>
|
||||
<result column="rule_type" jdbcType="INTEGER" property="ruleType"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseResultMapEx" type="com.orangeforms.upmsservice.model.SysDataPerm" extends="BaseResultMap">
|
||||
<collection property="dataPermDeptList" column="data_perm_id" javaType="ArrayList"
|
||||
ofType="com.orangeforms.upmsservice.model.SysDataPermDept" notNullColumn="dept_id"
|
||||
resultMap="com.orangeforms.upmsservice.dao.SysDataPermDeptMapper.BaseResultMap">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="filterRef">
|
||||
<if test="sysDataPermFilter != null">
|
||||
<if test="sysDataPermFilter.ruleType != null">
|
||||
AND zz_sys_data_perm.rule_type = #{sysDataPermFilter.ruleType}
|
||||
</if>
|
||||
<if test="sysDataPermFilter.searchString != null and sysDataPermFilter.searchString != ''">
|
||||
<bind name= "safeSearchString" value= "'%' + sysDataPermFilter.searchString + '%'" />
|
||||
AND IFNULL(zz_sys_data_perm.data_perm_name, '') LIKE #{safeSearchString}
|
||||
</if>
|
||||
</if>
|
||||
AND zz_sys_data_perm.deleted_flag = ${@com.orangeforms.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
</sql>
|
||||
|
||||
<select id="getSysDataPermList" resultMap="BaseResultMap" parameterType="com.orangeforms.upmsservice.model.SysDataPerm">
|
||||
SELECT
|
||||
zz_sys_data_perm.*
|
||||
FROM
|
||||
zz_sys_data_perm
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getSysDataPermListByUserId" resultMap="BaseResultMapEx" parameterType="com.orangeforms.upmsservice.model.SysDataPerm">
|
||||
SELECT
|
||||
zz_sys_data_perm.*,
|
||||
zz_sys_data_perm_dept.*
|
||||
FROM
|
||||
zz_sys_data_perm_user
|
||||
INNER JOIN
|
||||
zz_sys_data_perm ON zz_sys_data_perm_user.data_perm_id = zz_sys_data_perm.data_perm_id
|
||||
LEFT JOIN
|
||||
zz_sys_data_perm_dept ON zz_sys_data_perm.data_perm_id = zz_sys_data_perm_dept.data_perm_id
|
||||
<where>
|
||||
AND zz_sys_data_perm_user.user_id = #{userId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysDataPermUserMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysDataPermUser">
|
||||
<id column="data_perm_id" jdbcType="BIGINT" property="dataPermId"/>
|
||||
<id column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysDeptMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysDept">
|
||||
<id column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
||||
<result column="dept_name" jdbcType="VARCHAR" property="deptName"/>
|
||||
<result column="show_order" jdbcType="INTEGER" property="showOrder"/>
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertList">
|
||||
INSERT INTO zz_sys_dept
|
||||
(dept_id,
|
||||
dept_name,
|
||||
show_order,
|
||||
parent_id,
|
||||
deleted_flag,
|
||||
create_user_id,
|
||||
update_user_id,
|
||||
create_time,
|
||||
update_time)
|
||||
VALUES
|
||||
<foreach collection="list" index="index" item="item" separator="," >
|
||||
(#{item.deptId},
|
||||
#{item.deptName},
|
||||
#{item.showOrder},
|
||||
#{item.parentId},
|
||||
#{item.deletedFlag},
|
||||
#{item.createUserId},
|
||||
#{item.updateUserId},
|
||||
#{item.createTime},
|
||||
#{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orangeforms.upmsservice.dao.SysDeptMapper.inputFilterRef"/>
|
||||
AND zz_sys_dept.deleted_flag = ${@com.orangeforms.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="sysDeptFilter != null">
|
||||
<if test="sysDeptFilter.deptName != null and sysDeptFilter.deptName != ''">
|
||||
<bind name = "safeSysDeptDeptName" value = "'%' + sysDeptFilter.deptName + '%'" />
|
||||
AND zz_sys_dept.dept_name LIKE #{safeSysDeptDeptName}
|
||||
</if>
|
||||
<if test="sysDeptFilter.parentId != null">
|
||||
AND zz_sys_dept.parent_id = #{sysDeptFilter.parentId}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getSysDeptList" resultMap="BaseResultMap" parameterType="com.orangeforms.upmsservice.model.SysDept">
|
||||
SELECT * FROM zz_sys_dept
|
||||
<where>
|
||||
<if test="inFilterColumn != null and inFilterColumn != '' and inFilterValues != null and inFilterValues.size > 0">
|
||||
AND ${inFilterColumn} IN
|
||||
<foreach collection="inFilterValues" item="item" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</if>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getSysDeptCount" resultType="java.lang.Integer" parameterType="com.orangeforms.upmsservice.model.SysDept">
|
||||
SELECT COUNT(1) FROM zz_sys_dept
|
||||
<where>
|
||||
<if test="inFilterColumn != null and inFilterColumn != '' and inFilterValues != null and inFilterValues.size > 0">
|
||||
AND ${inFilterColumn} IN
|
||||
<foreach collection="inFilterValues" item="item" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</if>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysDeptRelationMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysDeptRelation">
|
||||
<id column="parent_dept_id" jdbcType="BIGINT" property="parentDeptId"/>
|
||||
<id column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
||||
</resultMap>
|
||||
|
||||
<delete id="removeBetweenChildrenAndParents">
|
||||
DELETE a FROM zz_sys_dept_relation a
|
||||
INNER JOIN zz_sys_dept_relation b ON a.dept_id = b.dept_id
|
||||
WHERE a.parent_dept_id = #{parentDeptId} AND b.parent_dept_id = #{myDeptId}
|
||||
</delete>
|
||||
|
||||
<insert id="insertList">
|
||||
INSERT INTO zz_sys_dept_relation(parent_dept_id, dept_id) VALUES
|
||||
<foreach collection="list" index="index" item="item" separator=",">
|
||||
(#{item.parentDeptId}, #{item.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertParentList">
|
||||
INSERT INTO zz_sys_dept_relation(parent_dept_id, dept_id)
|
||||
SELECT t.parent_dept_id, #{myDeptId} FROM zz_sys_dept_relation t
|
||||
WHERE t.dept_id = #{parentDeptId}
|
||||
UNION ALL
|
||||
SELECT #{myDeptId}, #{myDeptId}
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysMenuMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysMenu">
|
||||
<id column="menu_id" jdbcType="BIGINT" property="menuId"/>
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||
<result column="menu_name" jdbcType="VARCHAR" property="menuName"/>
|
||||
<result column="menu_type" jdbcType="INTEGER" property="menuType"/>
|
||||
<result column="form_router_name" jdbcType="VARCHAR" property="formRouterName"/>
|
||||
<result column="online_form_id" jdbcType="BIGINT" property="onlineFormId"/>
|
||||
<result column="online_menu_perm_type" jdbcType="INTEGER" property="onlineMenuPermType"/>
|
||||
<result column="show_order" jdbcType="INTEGER" property="showOrder"/>
|
||||
<result column="icon" jdbcType="VARCHAR" property="icon"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getMenuListByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
m.*
|
||||
FROM
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu m
|
||||
<where>
|
||||
AND ur.user_id = #{userId}
|
||||
AND ur.role_id = rm.role_id
|
||||
AND rm.menu_id = m.menu_id
|
||||
AND m.menu_type <= ${@com.orangeforms.upmsapi.constant.SysMenuType@TYPE_MENU}
|
||||
</where>
|
||||
ORDER BY m.show_order
|
||||
</select>
|
||||
|
||||
<select id="getOnlineMenuListByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
m.*
|
||||
FROM
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu m
|
||||
<where>
|
||||
AND ur.user_id = #{userId}
|
||||
AND ur.role_id = rm.role_id
|
||||
AND rm.menu_id = m.menu_id
|
||||
AND m.online_form_id IS NOT NULL
|
||||
<if test="menuType != null">
|
||||
AND m.menu_type = #{menuType}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY m.show_order
|
||||
</select>
|
||||
|
||||
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||
<select id="getSysPermListWithDetail" resultType="map">
|
||||
SELECT
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.show_name showName,
|
||||
pc.perm_code_type permCodeType,
|
||||
pc.perm_code permCode,
|
||||
p.perm_id permId,
|
||||
p.perm_name permName,
|
||||
p.url
|
||||
FROM
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_perm_code_perm pcp,
|
||||
zz_sys_perm_code pc,
|
||||
zz_sys_perm p
|
||||
<where>
|
||||
AND mpc.menu_id = #{menuId}
|
||||
AND mpc.perm_code_id = pc.perm_code_id
|
||||
AND mpc.perm_code_id = pcp.perm_code_id
|
||||
AND pcp.perm_id = p.perm_id
|
||||
<if test="url != null and url != ''">
|
||||
AND p.url = #{url}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
pc.perm_code_id, p.url
|
||||
</select>
|
||||
|
||||
<select id="getSysUserListWithDetail" resultType="map">
|
||||
SELECT
|
||||
u.user_id userId,
|
||||
u.login_name loginName,
|
||||
u.show_name showName,
|
||||
r.role_id roleId,
|
||||
r.role_name roleName
|
||||
FROM
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_role r,
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_user u
|
||||
<where>
|
||||
AND rm.menu_id = #{menuId}
|
||||
AND rm.role_id = r.role_id
|
||||
AND rm.role_id = ur.role_id
|
||||
AND ur.user_id = u.user_id
|
||||
<if test="loginName != null and loginName != ''">
|
||||
AND u.login_name = #{loginName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
u.user_id, r.role_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysMenuPermCodeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysMenuPermCode">
|
||||
<id column="menu_id" jdbcType="BIGINT" property="menuId"/>
|
||||
<id column="perm_code_id" jdbcType="BIGINT" property="permCodeId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysPermCodeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysPermCode">
|
||||
<id column="perm_code_id" jdbcType="BIGINT" property="permCodeId"/>
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||
<result column="perm_code" jdbcType="VARCHAR" property="permCode"/>
|
||||
<result column="perm_code_type" jdbcType="INTEGER" property="permCodeType"/>
|
||||
<result column="show_name" jdbcType="VARCHAR" property="showName"/>
|
||||
<result column="show_order" jdbcType="INTEGER" property="showOrder"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getPermCodeListByUserId" resultType="java.lang.String">
|
||||
SELECT
|
||||
pc.perm_code
|
||||
FROM
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_perm_code pc
|
||||
<where>
|
||||
AND ur.user_id = #{userId}
|
||||
AND ur.role_id = rm.role_id
|
||||
AND rm.menu_id = mpc.menu_id
|
||||
AND mpc.perm_code_id = pc.perm_code_id
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||
<select id="getSysUserListWithDetail" resultType="map">
|
||||
SELECT
|
||||
u.user_id userId,
|
||||
u.login_name loginName,
|
||||
u.show_name showName,
|
||||
r.role_id roleId,
|
||||
r.role_name roleName,
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType
|
||||
FROM
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_menu m,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_role r,
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_user u
|
||||
<where>
|
||||
AND mpc.perm_code_id = #{permCodeId}
|
||||
AND mpc.menu_id = m.menu_id
|
||||
AND mpc.menu_id = rm.menu_id
|
||||
AND rm.role_id = r.role_id
|
||||
AND rm.role_id = ur.role_id
|
||||
AND ur.user_id = u.user_id
|
||||
<if test="loginName != null and loginName != ''">
|
||||
AND u.login_name = #{loginName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
u.user_id, r.role_id, m.menu_id
|
||||
</select>
|
||||
|
||||
<select id="getSysRoleListWithDetail" resultType="map">
|
||||
SELECT
|
||||
r.role_id roleId,
|
||||
r.role_name roleName,
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType
|
||||
FROM
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_menu m,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_role r
|
||||
<where>
|
||||
AND mpc.perm_code_id = #{permCodeId}
|
||||
AND mpc.menu_id = m.menu_id
|
||||
AND mpc.menu_id = rm.menu_id
|
||||
AND rm.role_id = r.role_id
|
||||
<if test="roleName != null and roleName != ''">
|
||||
AND r.role_name = #{roleName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
r.role_id, m.menu_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysPermCodePermMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysPermCodePerm">
|
||||
<id column="perm_code_id" jdbcType="BIGINT" property="permCodeId"/>
|
||||
<id column="perm_id" jdbcType="BIGINT" property="permId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysPermMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysPerm">
|
||||
<id column="perm_id" jdbcType="BIGINT" property="permId"/>
|
||||
<result column="module_id" jdbcType="BIGINT" property="moduleId"/>
|
||||
<result column="perm_name" jdbcType="VARCHAR" property="permName"/>
|
||||
<result column="url" jdbcType="VARCHAR" property="url"/>
|
||||
<result column="show_order" jdbcType="INTEGER" property="showOrder"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getPermListByUserId" resultType="java.lang.String">
|
||||
SELECT
|
||||
p.url
|
||||
FROM
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_perm_code_perm pcp,
|
||||
zz_sys_perm p
|
||||
<where>
|
||||
AND ur.user_id = #{userId}
|
||||
AND ur.role_id = rm.role_id
|
||||
AND rm.menu_id = mpc.menu_id
|
||||
AND mpc.perm_code_id = pcp.perm_code_id
|
||||
AND pcp.perm_id = p.perm_id
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||
<select id="getSysUserListWithDetail" resultType="map">
|
||||
SELECT
|
||||
u.user_id userId,
|
||||
u.login_name loginName,
|
||||
u.show_name showName,
|
||||
r.role_id roleId,
|
||||
r.role_name roleName,
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType,
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.perm_code permCode,
|
||||
pc.perm_code_type permCodeType
|
||||
FROM
|
||||
zz_sys_perm_code_perm pcp,
|
||||
zz_sys_perm_code pc,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_menu m,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_role r,
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_user u
|
||||
<where>
|
||||
AND pcp.perm_id = #{permId}
|
||||
AND pcp.perm_code_id = pc.perm_code_id
|
||||
AND pcp.perm_code_id = mpc.perm_code_id
|
||||
AND mpc.menu_id = m.menu_id
|
||||
AND mpc.menu_id = rm.menu_id
|
||||
AND rm.role_id = r.role_id
|
||||
AND rm.role_id = ur.role_id
|
||||
AND ur.user_id = u.user_id
|
||||
<if test="loginName != null and loginName != ''">
|
||||
AND u.login_name = #{loginName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
u.user_id, r.role_id, m.menu_id, pc.perm_code_id
|
||||
</select>
|
||||
|
||||
<select id="getSysRoleListWithDetail" resultType="map">
|
||||
SELECT
|
||||
r.role_id roleId,
|
||||
r.role_name roleName,
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType,
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.perm_code permCode,
|
||||
pc.perm_code_type permCodeType
|
||||
FROM
|
||||
zz_sys_perm_code_perm pcp,
|
||||
zz_sys_perm_code pc,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_menu m,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_role r
|
||||
<where>
|
||||
AND pcp.perm_id = #{permId}
|
||||
AND pcp.perm_code_id = pc.perm_code_id
|
||||
AND pcp.perm_code_id = mpc.perm_code_id
|
||||
AND mpc.menu_id = m.menu_id
|
||||
AND mpc.menu_id = rm.menu_id
|
||||
AND rm.role_id = r.role_id
|
||||
<if test="roleName != null and roleName != ''">
|
||||
AND r.role_name = #{roleName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
r.role_id, m.menu_id, pc.perm_code_id
|
||||
</select>
|
||||
|
||||
<select id="getSysMenuListWithDetail" resultType="map">
|
||||
SELECT
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType,
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.perm_code permCode,
|
||||
pc.perm_code_type permCodeType
|
||||
FROM
|
||||
zz_sys_perm_code_perm pcp,
|
||||
zz_sys_perm_code pc,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_menu m
|
||||
<where>
|
||||
AND pcp.perm_id = #{permId}
|
||||
AND pcp.perm_code_id = pc.perm_code_id
|
||||
AND pcp.perm_code_id = mpc.perm_code_id
|
||||
AND mpc.menu_id = m.menu_id
|
||||
<if test="menuName != null and menuName != ''">
|
||||
AND m.menu_name = #{menuName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
m.menu_id, pc.perm_code_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysPermModuleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysPermModule">
|
||||
<id column="module_id" jdbcType="BIGINT" property="moduleId"/>
|
||||
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||
<result column="module_name" jdbcType="VARCHAR" property="moduleName"/>
|
||||
<result column="module_type" jdbcType="INTEGER" property="moduleType"/>
|
||||
<result column="show_order" jdbcType="INTEGER" property="showOrder"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseResultMapEx" type="com.orangeforms.upmsservice.model.SysPermModule" extends="BaseResultMap">
|
||||
<collection property="sysPermList" column="module_id" javaType="ArrayList"
|
||||
ofType="com.orangeforms.upmsservice.model.SysPerm" notNullColumn="perm_id"
|
||||
resultMap="com.orangeforms.upmsservice.dao.SysPermMapper.BaseResultMap">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getPermModuleAndPermList" resultMap="BaseResultMapEx">
|
||||
SELECT
|
||||
pm.module_id,
|
||||
pm.module_name,
|
||||
pm.parent_id,
|
||||
pm.module_type,
|
||||
p.perm_id,
|
||||
p.perm_name,
|
||||
p.module_id,
|
||||
p.url
|
||||
FROM
|
||||
zz_sys_perm_module pm
|
||||
LEFT JOIN
|
||||
zz_sys_perm p ON pm.module_id = p.module_id AND p.deleted_flag = ${@com.orangeforms.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
<where>
|
||||
AND pm.deleted_flag = ${@com.orangeforms.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
</where>
|
||||
ORDER BY
|
||||
pm.show_order, p.show_order
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysPermWhitelistMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysPermWhitelist">
|
||||
<id column="perm_url" jdbcType="VARCHAR" property="permUrl"/>
|
||||
<result column="module_name" jdbcType="VARCHAR" property="moduleName"/>
|
||||
<result column="perm_name" jdbcType="VARCHAR" property="permName"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysRoleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysRole">
|
||||
<id column="role_id" jdbcType="BIGINT" property="roleId"/>
|
||||
<result column="role_name" jdbcType="VARCHAR" property="roleName"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="filterRef">
|
||||
<if test="sysRoleFilter != null">
|
||||
<if test="sysRoleFilter.roleName != null and sysRoleFilter.roleName != ''">
|
||||
<bind name= "safeRoleName" value= "'%' + sysRoleFilter.roleName + '%'"/>
|
||||
AND role_name LIKE #{safeRoleName}
|
||||
</if>
|
||||
</if>
|
||||
AND deleted_flag = ${@com.orangeforms.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
</sql>
|
||||
|
||||
<select id="getSysRoleList" resultMap="BaseResultMap" parameterType="com.orangeforms.upmsservice.model.SysRole">
|
||||
SELECT * FROM zz_sys_role
|
||||
<where>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||
<select id="getSysPermListWithDetail" resultType="map">
|
||||
SELECT
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType,
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.perm_code permCode,
|
||||
pc.perm_code_type permCodeType,
|
||||
p.url
|
||||
FROM
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu m,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_perm_code pc,
|
||||
zz_sys_perm_code_perm pcp,
|
||||
zz_sys_perm p
|
||||
<where>
|
||||
AND rm.role_id = #{roleId}
|
||||
AND rm.menu_id = m.menu_id
|
||||
AND rm.menu_id = mpc.menu_id
|
||||
AND mpc.perm_code_id = pc.perm_code_id
|
||||
AND mpc.perm_code_id = pcp.perm_code_id
|
||||
AND pcp.perm_id = p.perm_id
|
||||
<if test="url != null and url != ''">
|
||||
AND p.url = #{url}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
m.menu_id, pc.perm_code_id, p.url
|
||||
</select>
|
||||
|
||||
<select id="getSysPermCodeListWithDetail" resultType="map">
|
||||
SELECT
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType,
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.perm_code permCode,
|
||||
pc.perm_code_type permCodeType
|
||||
FROM
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu m,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_perm_code pc
|
||||
<where>
|
||||
AND rm.role_id = #{roleId}
|
||||
AND rm.menu_id = m.menu_id
|
||||
AND rm.menu_id = mpc.menu_id
|
||||
AND mpc.perm_code_id = pc.perm_code_id
|
||||
<if test="permCode != null and permCode != ''">
|
||||
AND pc.perm_code = #{permCode}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
m.menu_id, pc.perm_code_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysRoleMenuMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysRoleMenu">
|
||||
<id column="role_id" jdbcType="BIGINT" property="roleId"/>
|
||||
<id column="menu_id" jdbcType="BIGINT" property="menuId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,264 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysUserMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysUser">
|
||||
<id column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||
<result column="login_name" jdbcType="VARCHAR" property="loginName"/>
|
||||
<result column="show_name" jdbcType="VARCHAR" property="showName"/>
|
||||
<result column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
||||
<result column="user_type" jdbcType="INTEGER" property="userType"/>
|
||||
<result column="head_image_url" jdbcType="VARCHAR" property="headImageUrl"/>
|
||||
<result column="user_status" jdbcType="INTEGER" property="userStatus"/>
|
||||
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertList">
|
||||
INSERT INTO zz_sys_user
|
||||
(user_id,
|
||||
login_name,
|
||||
password,
|
||||
show_name,
|
||||
dept_id,
|
||||
user_type,
|
||||
head_image_url,
|
||||
user_status,
|
||||
deleted_flag,
|
||||
create_user_id,
|
||||
update_user_id,
|
||||
create_time,
|
||||
update_time)
|
||||
VALUES
|
||||
<foreach collection="list" index="index" item="item" separator="," >
|
||||
(#{item.userId},
|
||||
#{item.loginName},
|
||||
#{item.password},
|
||||
#{item.showName},
|
||||
#{item.deptId},
|
||||
#{item.userType},
|
||||
#{item.headImageUrl},
|
||||
#{item.userStatus},
|
||||
#{item.deletedFlag},
|
||||
#{item.createUserId},
|
||||
#{item.updateUserId},
|
||||
#{item.createTime},
|
||||
#{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
<include refid="com.orangeforms.upmsservice.dao.SysUserMapper.inputFilterRef"/>
|
||||
AND zz_sys_user.deleted_flag = ${@com.orangeforms.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||
</sql>
|
||||
|
||||
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||
<sql id="inputFilterRef">
|
||||
<if test="sysUserFilter != null">
|
||||
<if test="sysUserFilter.loginName != null and sysUserFilter.loginName != ''">
|
||||
<bind name = "safeSysUserLoginName" value = "'%' + sysUserFilter.loginName + '%'" />
|
||||
AND zz_sys_user.login_name LIKE #{safeSysUserLoginName}
|
||||
</if>
|
||||
<if test="sysUserFilter.showName != null and sysUserFilter.showName != ''">
|
||||
<bind name = "safeSysUserShowName" value = "'%' + sysUserFilter.showName + '%'" />
|
||||
AND zz_sys_user.show_name LIKE #{safeSysUserShowName}
|
||||
</if>
|
||||
<if test="sysUserFilter.deptId != null">
|
||||
AND zz_sys_user.dept_id = #{sysUserFilter.deptId}
|
||||
</if>
|
||||
<if test="sysUserFilter.userStatus != null">
|
||||
AND zz_sys_user.user_status = #{sysUserFilter.userStatus}
|
||||
</if>
|
||||
<if test="sysUserFilter.createTimeStart != null and sysUserFilter.createTimeStart != ''">
|
||||
AND zz_sys_user.create_time >= #{sysUserFilter.createTimeStart}
|
||||
</if>
|
||||
<if test="sysUserFilter.createTimeEnd != null and sysUserFilter.createTimeEnd != ''">
|
||||
AND zz_sys_user.create_time <= #{sysUserFilter.createTimeEnd}
|
||||
</if>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getSysUserList" resultMap="BaseResultMap" parameterType="com.orangeforms.upmsservice.model.SysUser">
|
||||
SELECT * FROM zz_sys_user
|
||||
<where>
|
||||
<if test="inFilterColumn != null and inFilterColumn != '' and inFilterValues != null and inFilterValues.size > 0">
|
||||
AND ${inFilterColumn} IN
|
||||
<foreach collection="inFilterValues" item="item" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</if>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getSysUserCount" resultType="java.lang.Integer" parameterType="com.orangeforms.upmsservice.model.SysUser">
|
||||
SELECT COUNT(1) FROM zz_sys_user
|
||||
<where>
|
||||
<if test="inFilterColumn != null and inFilterColumn != '' and inFilterValues != null and inFilterValues.size > 0">
|
||||
AND ${inFilterColumn} IN
|
||||
<foreach collection="inFilterValues" item="item" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</if>
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getSysUserListByRoleId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
zz_sys_user.*
|
||||
FROM
|
||||
zz_sys_user_role,
|
||||
zz_sys_user
|
||||
<where>
|
||||
AND zz_sys_user_role.role_id = #{roleId}
|
||||
AND zz_sys_user_role.user_id = zz_sys_user.user_id
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getNotInSysUserListByRoleId" resultMap="BaseResultMap">
|
||||
SELECT * FROM zz_sys_user
|
||||
<where>
|
||||
NOT EXISTS (SELECT * FROM zz_sys_user_role
|
||||
WHERE zz_sys_user_role.role_id = #{roleId} AND zz_sys_user_role.user_id = zz_sys_user.user_id)
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getSysUserListByDataPermId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
zz_sys_user.*
|
||||
FROM
|
||||
zz_sys_data_perm_user,
|
||||
zz_sys_user
|
||||
<where>
|
||||
AND zz_sys_data_perm_user.data_perm_id = #{dataPermId}
|
||||
AND zz_sys_data_perm_user.user_id = zz_sys_user.user_id
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getNotInSysUserListByDataPermId" resultMap="BaseResultMap">
|
||||
SELECT * FROM zz_sys_user
|
||||
<where>
|
||||
NOT EXISTS (SELECT * FROM zz_sys_data_perm_user
|
||||
WHERE zz_sys_data_perm_user.data_perm_id = #{dataPermId} AND zz_sys_data_perm_user.user_id = zz_sys_user.user_id)
|
||||
<include refid="filterRef"/>
|
||||
</where>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 以下查询仅用于权限分配的问题定位,由于关联表较多,可能会给系统运行带来性能影响 -->
|
||||
<select id="getSysPermListWithDetail" resultType="map">
|
||||
SELECT
|
||||
r.role_id roleId,
|
||||
r.role_name roleName,
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType,
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.perm_code permCode,
|
||||
pc.perm_code_type permCodeType,
|
||||
p.url
|
||||
FROM
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_role r,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu m,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_perm_code pc,
|
||||
zz_sys_perm_code_perm pcp,
|
||||
zz_sys_perm p
|
||||
<where>
|
||||
AND ur.user_id = #{userId}
|
||||
AND ur.role_id = r.role_id
|
||||
AND ur.role_id = rm.role_id
|
||||
AND rm.menu_id = m.menu_id
|
||||
AND rm.menu_id = mpc.menu_id
|
||||
AND mpc.perm_code_id = pc.perm_code_id
|
||||
AND mpc.perm_code_id = pcp.perm_code_id
|
||||
AND pcp.perm_id = p.perm_id
|
||||
<if test="url != null and url != ''">
|
||||
AND p.url = #{url}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
r.role_id, m.menu_id, pc.perm_code_id, p.url
|
||||
</select>
|
||||
|
||||
<select id="getSysPermCodeListWithDetail" resultType="map">
|
||||
SELECT
|
||||
r.role_id roleId,
|
||||
r.role_name roleName,
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType,
|
||||
pc.perm_code_id permCodeId,
|
||||
pc.perm_code permCode,
|
||||
pc.perm_code_type permCodeType
|
||||
FROM
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_role r,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu m,
|
||||
zz_sys_menu_perm_code mpc,
|
||||
zz_sys_perm_code pc
|
||||
<where>
|
||||
AND ur.user_id = #{userId}
|
||||
AND ur.role_id = r.role_id
|
||||
AND ur.role_id = rm.role_id
|
||||
AND rm.menu_id = m.menu_id
|
||||
AND rm.menu_id = mpc.menu_id
|
||||
AND mpc.perm_code_id = pc.perm_code_id
|
||||
<if test="permCode != null and permCode != ''">
|
||||
AND pc.perm_code = #{permCode}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
r.role_id, m.menu_id, pc.perm_code_id
|
||||
</select>
|
||||
|
||||
<select id="getSysMenuListWithDetail" resultType="map">
|
||||
SELECT
|
||||
r.role_id roleId,
|
||||
r.role_name roleName,
|
||||
m.menu_id menuId,
|
||||
m.menu_name menuName,
|
||||
m.menu_type menuType
|
||||
FROM
|
||||
zz_sys_user_role ur,
|
||||
zz_sys_role r,
|
||||
zz_sys_role_menu rm,
|
||||
zz_sys_menu m
|
||||
<where>
|
||||
AND ur.user_id = #{userId}
|
||||
AND ur.role_id = r.role_id
|
||||
AND ur.role_id = rm.role_id
|
||||
AND rm.menu_id = m.menu_id
|
||||
<if test="menuName != null and menuName != ''">
|
||||
AND m.menu_name = #{menuName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
r.role_id, m.menu_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orangeforms.upmsservice.dao.SysUserRoleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.orangeforms.upmsservice.model.SysUserRole">
|
||||
<id column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||
<id column="role_id" jdbcType="BIGINT" property="roleId"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.common.core.annotation.RelationManyToMany;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.common.core.util.MyCommonUtil;
|
||||
import com.orangeforms.upmsapi.vo.SysDataPermVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 数据权限实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_data_perm")
|
||||
public class SysDataPerm extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@TableId(value = "data_perm_id")
|
||||
private Long dataPermId;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@TableField(value = "data_perm_name")
|
||||
private String dataPermName;
|
||||
|
||||
/**
|
||||
* 数据权限规则类型(0: 全部可见 1: 只看自己 2: 只看本部门 3: 本部门及子部门 4: 多部门及子部门 5: 自定义部门列表)。
|
||||
*/
|
||||
@TableField(value = "rule_type")
|
||||
private Integer ruleType;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String deptIdListString;
|
||||
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysDataPermDeptMapper",
|
||||
relationMasterIdField = "dataPermId",
|
||||
relationModelClass = SysDataPermDept.class)
|
||||
@TableField(exist = false)
|
||||
private List<SysDataPermDept> dataPermDeptList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String searchString;
|
||||
|
||||
public void setSearchString(String searchString) {
|
||||
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
|
||||
}
|
||||
|
||||
@Mapper
|
||||
public interface SysDataPermModelMapper extends BaseModelMapper<SysDataPermVo, SysDataPerm> {
|
||||
/**
|
||||
* 转换VO对象到实体对象。
|
||||
*
|
||||
* @param sysDataPermVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Mapping(target = "dataPermDeptList", expression = "java(mapToBean(sysDataPermVo.getDataPermDeptList(), com.orangeforms.upmsservice.model.SysDataPermDept.class))")
|
||||
@Override
|
||||
SysDataPerm toModel(SysDataPermVo sysDataPermVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param sysDataPerm 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Mapping(target = "dataPermDeptList", expression = "java(beanToMap(sysDataPerm.getDataPermDeptList(), false))")
|
||||
@Override
|
||||
SysDataPermVo fromModel(SysDataPerm sysDataPerm);
|
||||
}
|
||||
public static final SysDataPermModelMapper INSTANCE = Mappers.getMapper(SysDataPerm.SysDataPermModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 数据权限与部门关联实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@ToString(of = {"deptId"})
|
||||
@TableName(value = "zz_sys_data_perm_dept")
|
||||
public class SysDataPermDept {
|
||||
|
||||
/**
|
||||
* 数据权限Id。
|
||||
*/
|
||||
@TableField(value = "data_perm_id")
|
||||
private Long dataPermId;
|
||||
|
||||
/**
|
||||
* 关联部门Id。
|
||||
*/
|
||||
@TableField(value = "dept_id")
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据权限与用户关联实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_sys_data_perm_user")
|
||||
public class SysDataPermUser {
|
||||
|
||||
/**
|
||||
* 数据权限Id。
|
||||
*/
|
||||
@TableField(value = "data_perm_id")
|
||||
private Long dataPermId;
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.upmsapi.vo.SysDeptVo;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* SysDept实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_dept")
|
||||
public class SysDept extends BaseModel {
|
||||
|
||||
/**
|
||||
* 部门Id。
|
||||
*/
|
||||
@TableId(value = "dept_id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 部门名称。
|
||||
*/
|
||||
@TableField(value = "dept_name")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 显示顺序。
|
||||
*/
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 父部门Id。
|
||||
*/
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@Mapper
|
||||
public interface SysDeptModelMapper extends BaseModelMapper<SysDeptVo, SysDept> {
|
||||
}
|
||||
public static final SysDeptModelMapper INSTANCE = Mappers.getMapper(SysDeptModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 部门关联实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "zz_sys_dept_relation")
|
||||
public class SysDeptRelation {
|
||||
|
||||
/**
|
||||
* 上级部门Id。
|
||||
*/
|
||||
@TableField(value = "parent_dept_id")
|
||||
private Long parentDeptId;
|
||||
|
||||
/**
|
||||
* 部门Id。
|
||||
*/
|
||||
@TableField(value = "dept_id")
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.common.core.annotation.RelationManyToMany;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.upmsapi.vo.SysMenuVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_menu")
|
||||
public class SysMenu extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@TableId(value = "menu_id")
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 父菜单Id,目录菜单的父菜单为null。
|
||||
*/
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单显示名称。
|
||||
*/
|
||||
@TableField(value = "menu_name")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单类型(0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
||||
*/
|
||||
@TableField(value = "menu_type")
|
||||
private Integer menuType;
|
||||
|
||||
/**
|
||||
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
||||
*/
|
||||
@TableField(value = "form_router_name")
|
||||
private String formRouterName;
|
||||
|
||||
/**
|
||||
* 在线表单主键Id,仅用于在线表单绑定的菜单。
|
||||
*/
|
||||
@TableField(value = "online_form_id")
|
||||
private Long onlineFormId;
|
||||
|
||||
/**
|
||||
* 在线表单菜单的权限控制类型,具体值可参考SysOnlineMenuPermType常量对象。
|
||||
*/
|
||||
@TableField(value = "online_menu_perm_type")
|
||||
private Integer onlineMenuPermType;
|
||||
|
||||
/**
|
||||
* 菜单显示顺序 (值越小,排序越靠前)。
|
||||
*/
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 菜单图标。
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysMenuPermCodeMapper",
|
||||
relationMasterIdField = "menuId",
|
||||
relationModelClass = SysMenuPermCode.class)
|
||||
@TableField(exist = false)
|
||||
private List<SysMenuPermCode> sysMenuPermCodeList;
|
||||
|
||||
@Mapper
|
||||
public interface SysMenuModelMapper extends BaseModelMapper<SysMenuVo, SysMenu> {
|
||||
/**
|
||||
* 转换VO对象到实体对象。
|
||||
*
|
||||
* @param sysMenuVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Mapping(target = "sysMenuPermCodeList", expression = "java(mapToBean(sysMenuVo.getSysMenuPermCodeList(), com.orangeforms.upmsservice.model.SysMenuPermCode.class))")
|
||||
@Override
|
||||
SysMenu toModel(SysMenuVo sysMenuVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param sysMenu 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Mapping(target = "sysMenuPermCodeList", expression = "java(beanToMap(sysMenu.getSysMenuPermCodeList(), false))")
|
||||
@Override
|
||||
SysMenuVo fromModel(SysMenu sysMenu);
|
||||
}
|
||||
public static final SysMenuModelMapper INSTANCE = Mappers.getMapper(SysMenu.SysMenuModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 菜单与权限字关联实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_sys_menu_perm_code")
|
||||
public class SysMenuPermCode {
|
||||
|
||||
/**
|
||||
* 关联菜单Id。
|
||||
*/
|
||||
@TableField(value = "menu_id")
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 关联权限字Id。
|
||||
*/
|
||||
@TableField(value = "perm_code_id")
|
||||
private Long permCodeId;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import com.orangeforms.common.core.annotation.RelationDict;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限资源实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_perm")
|
||||
public class SysPerm extends BaseModel {
|
||||
|
||||
/**
|
||||
* 权限Id。
|
||||
*/
|
||||
@TableId(value = "perm_id")
|
||||
private Long permId;
|
||||
|
||||
/**
|
||||
* 权限所在的权限模块Id。
|
||||
*/
|
||||
@TableField(value = "module_id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 权限名称。
|
||||
*/
|
||||
@TableField(value = "perm_name")
|
||||
private String permName;
|
||||
|
||||
/**
|
||||
* 关联的URL。
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 权限在当前模块下的顺序,由小到大。
|
||||
*/
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "moduleId",
|
||||
slaveServiceName = "SysPermModuleService",
|
||||
slaveModelClass = SysPermModule.class,
|
||||
slaveIdField = "moduleId",
|
||||
slaveNameField = "moduleName")
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> moduleIdDictMap;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.common.core.annotation.RelationManyToMany;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.upmsapi.vo.SysPermCodeVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限字实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_perm_code")
|
||||
public class SysPermCode extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@TableId(value = "perm_code_id")
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 上级权限字Id。
|
||||
*/
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限字标识(一般为有含义的英文字符串)。
|
||||
*/
|
||||
@TableField(value = "perm_code")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 权限类型(0: 表单 1: UI片段 2: 操作)。
|
||||
*/
|
||||
@TableField(value = "perm_code_type")
|
||||
private Integer permCodeType;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@TableField(value = "show_name")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 显示顺序(数值越小,越靠前)。
|
||||
*/
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysPermCodePermMapper",
|
||||
relationMasterIdField = "permCodeId",
|
||||
relationModelClass = SysPermCodePerm.class)
|
||||
@TableField(exist = false)
|
||||
private List<SysPermCodePerm> sysPermCodePermList;
|
||||
|
||||
@Mapper
|
||||
public interface SysPermCodeModelMapper extends BaseModelMapper<SysPermCodeVo, SysPermCode> {
|
||||
/**
|
||||
* 转换VO对象到实体对象。
|
||||
*
|
||||
* @param sysPermCodeVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Mapping(target = "sysPermCodePermList", expression = "java(mapToBean(sysPermCodeVo.getSysPermCodePermList(), com.orangeforms.upmsservice.model.SysPermCodePerm.class))")
|
||||
@Override
|
||||
SysPermCode toModel(SysPermCodeVo sysPermCodeVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param sysPermCode 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Mapping(target = "sysPermCodePermList", expression = "java(beanToMap(sysPermCode.getSysPermCodePermList(), false))")
|
||||
@Override
|
||||
SysPermCodeVo fromModel(SysPermCode sysPermCode);
|
||||
}
|
||||
public static final SysPermCodeModelMapper INSTANCE = Mappers.getMapper(SysPermCode.SysPermCodeModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 权限字与权限资源关联实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_sys_perm_code_perm")
|
||||
public class SysPermCodePerm {
|
||||
|
||||
/**
|
||||
* 权限字Id。
|
||||
*/
|
||||
@TableField(value = "perm_code_id")
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 权限Id。
|
||||
*/
|
||||
@TableField(value = "perm_id")
|
||||
private Long permId;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限模块实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_perm_module")
|
||||
public class SysPermModule extends BaseModel {
|
||||
|
||||
/**
|
||||
* 权限模块Id。
|
||||
*/
|
||||
@TableId(value = "module_id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 上级权限模块Id。
|
||||
*/
|
||||
@TableField(value = "parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限模块名称。
|
||||
*/
|
||||
@TableField(value = "module_name")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
||||
*/
|
||||
@TableField(value = "module_type")
|
||||
private Integer moduleType;
|
||||
|
||||
/**
|
||||
* 权限模块在当前层级下的顺序,由小到大。
|
||||
*/
|
||||
@TableField(value = "show_order")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<SysPerm> sysPermList;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 白名单实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_sys_perm_whitelist")
|
||||
public class SysPermWhitelist {
|
||||
|
||||
/**
|
||||
* 权限资源的URL。
|
||||
*/
|
||||
@TableId(value = "perm_url")
|
||||
private String permUrl;
|
||||
|
||||
/**
|
||||
* 权限资源所属模块名字(通常是Controller的名字)。
|
||||
*/
|
||||
@TableField(value = "module_name")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 权限的名称。
|
||||
*/
|
||||
@TableField(value = "perm_name")
|
||||
private String permName;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.common.core.annotation.RelationManyToMany;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orangeforms.upmsapi.vo.SysRoleVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_role")
|
||||
public class SysRole extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@TableId(value = "role_id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称。
|
||||
*/
|
||||
@TableField(value = "role_name")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysRoleMenuMapper",
|
||||
relationMasterIdField = "roleId",
|
||||
relationModelClass = SysRoleMenu.class)
|
||||
@TableField(exist = false)
|
||||
private List<SysRoleMenu> sysRoleMenuList;
|
||||
|
||||
@Mapper
|
||||
public interface SysRoleModelMapper extends BaseModelMapper<SysRoleVo, SysRole> {
|
||||
/**
|
||||
* 转换VO对象到实体对象。
|
||||
*
|
||||
* @param sysRoleVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Mapping(target = "sysRoleMenuList", expression = "java(mapToBean(sysRoleVo.getSysRoleMenuList(), com.orangeforms.upmsservice.model.SysRoleMenu.class))")
|
||||
@Override
|
||||
SysRole toModel(SysRoleVo sysRoleVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param sysRole 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Mapping(target = "sysRoleMenuList", expression = "java(beanToMap(sysRole.getSysRoleMenuList(), false))")
|
||||
@Override
|
||||
SysRoleVo fromModel(SysRole sysRole);
|
||||
}
|
||||
public static final SysRoleModelMapper INSTANCE = Mappers.getMapper(SysRole.SysRoleModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 角色菜单实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_sys_role_menu")
|
||||
public class SysRoleMenu {
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@TableField(value = "role_id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 菜单Id。
|
||||
*/
|
||||
@TableField(value = "menu_id")
|
||||
private Long menuId;
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orangeforms.upmsapi.vo.SysUserVo;
|
||||
import com.orangeforms.upmsapi.constant.SysUserType;
|
||||
import com.orangeforms.upmsapi.constant.SysUserStatus;
|
||||
import com.orangeforms.common.core.annotation.*;
|
||||
import com.orangeforms.common.core.base.model.BaseModel;
|
||||
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SysUser实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "zz_sys_user")
|
||||
public class SysUser extends BaseModel {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@TableId(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 登录用户名。
|
||||
*/
|
||||
@TableField(value = "login_name")
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* 用户显示名称。
|
||||
*/
|
||||
@TableField(value = "show_name")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 用户部门Id。
|
||||
*/
|
||||
@TableField(value = "dept_id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
||||
*/
|
||||
@TableField(value = "user_type")
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 用户头像的Url。
|
||||
*/
|
||||
@TableField(value = "head_image_url")
|
||||
private String headImageUrl;
|
||||
|
||||
/**
|
||||
* 用户状态(0: 正常 1: 锁定)。
|
||||
*/
|
||||
@TableField(value = "user_status")
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(value = "deleted_flag")
|
||||
private Integer deletedFlag;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String createTimeEnd;
|
||||
|
||||
/**
|
||||
* 多对多用户角色数据集合。
|
||||
*/
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysUserRoleMapper",
|
||||
relationMasterIdField = "userId",
|
||||
relationModelClass = SysUserRole.class)
|
||||
@TableField(exist = false)
|
||||
private List<SysUserRole> sysUserRoleList;
|
||||
|
||||
/**
|
||||
* 多对多用户数据权限数据集合。
|
||||
*/
|
||||
@RelationManyToMany(
|
||||
relationMapperName = "sysDataPermUserMapper",
|
||||
relationMasterIdField = "userId",
|
||||
relationModelClass = SysDataPermUser.class)
|
||||
@TableField(exist = false)
|
||||
private List<SysDataPermUser> sysDataPermUserList;
|
||||
|
||||
@RelationDict(
|
||||
masterIdField = "deptId",
|
||||
slaveServiceName = "sysDeptService",
|
||||
slaveModelClass = SysDept.class,
|
||||
slaveIdField = "deptId",
|
||||
slaveNameField = "deptName")
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> deptIdDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "userType",
|
||||
constantDictClass = SysUserType.class)
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> userTypeDictMap;
|
||||
|
||||
@RelationConstDict(
|
||||
masterIdField = "userStatus",
|
||||
constantDictClass = SysUserStatus.class)
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> userStatusDictMap;
|
||||
|
||||
@Mapper
|
||||
public interface SysUserModelMapper extends BaseModelMapper<SysUserVo, SysUser> {
|
||||
/**
|
||||
* 转换Vo对象到实体对象。
|
||||
*
|
||||
* @param sysUserVo 域对象。
|
||||
* @return 实体对象。
|
||||
*/
|
||||
@Mapping(target = "sysUserRoleList", expression = "java(mapToBean(sysUserVo.getSysUserRoleList(), com.orangeforms.upmsservice.model.SysUserRole.class))")
|
||||
@Mapping(target = "sysDataPermUserList", expression = "java(mapToBean(sysUserVo.getSysDataPermUserList(), com.orangeforms.upmsservice.model.SysDataPermUser.class))")
|
||||
@Override
|
||||
SysUser toModel(SysUserVo sysUserVo);
|
||||
/**
|
||||
* 转换实体对象到VO对象。
|
||||
*
|
||||
* @param sysUser 实体对象。
|
||||
* @return 域对象。
|
||||
*/
|
||||
@Mapping(target = "sysUserRoleList", expression = "java(beanToMap(sysUser.getSysUserRoleList(), false))")
|
||||
@Mapping(target = "sysDataPermUserList", expression = "java(beanToMap(sysUser.getSysDataPermUserList(), false))")
|
||||
@Override
|
||||
SysUserVo fromModel(SysUser sysUser);
|
||||
}
|
||||
public static final SysUserModelMapper INSTANCE = Mappers.getMapper(SysUserModelMapper.class);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orangeforms.upmsservice.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户角色实体对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "zz_sys_user_role")
|
||||
public class SysUserRole {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@TableField(value = "role_id")
|
||||
private Long roleId;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 数据权限数据服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysDataPermService extends IBaseService<SysDataPerm, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增的数据权限对象。
|
||||
*
|
||||
* @param dataPerm 新增的数据权限对象。
|
||||
* @param deptIdSet 关联的部门Id列表。
|
||||
* @return 新增后的数据权限对象。
|
||||
*/
|
||||
SysDataPerm saveNew(SysDataPerm dataPerm, Set<Long> deptIdSet);
|
||||
|
||||
/**
|
||||
* 更新数据权限对象。
|
||||
*
|
||||
* @param dataPerm 更新的数据权限对象。
|
||||
* @param originalDataPerm 原有的数据权限对象。
|
||||
* @param deptIdSet 关联的部门Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SysDataPerm dataPerm, SysDataPerm originalDataPerm, Set<Long> deptIdSet);
|
||||
|
||||
/**
|
||||
* 删除指定数据权限。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long dataPermId);
|
||||
|
||||
/**
|
||||
* 获取数据权限列表。
|
||||
*
|
||||
* @param filter 数据权限过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 数据权限查询列表。
|
||||
*/
|
||||
List<SysDataPerm> getSysDataPermList(SysDataPerm filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 将指定会话的数据权限集合从缓存中移除。
|
||||
*
|
||||
* @param sessionId 会话Id。
|
||||
*/
|
||||
void removeDataPermCache(String sessionId);
|
||||
|
||||
/**
|
||||
* 将指定用户的指定会话的数据权限集合存入缓存。
|
||||
*
|
||||
* @param sessionId 会话Id。
|
||||
* @param userId 用户主键Id。
|
||||
* @param deptId 用户所属部门主键Id。
|
||||
* @return 查询并缓存后的数据权限集合。返回格式为,Map<RuleType, DeptIdString>。
|
||||
*/
|
||||
Map<Integer, String> putDataPermCache(String sessionId, Long userId, Long deptId);
|
||||
|
||||
/**
|
||||
* 获取指定用户Id的数据权限列表。并基于权限规则类型进行了一级分组。
|
||||
*
|
||||
* @param userId 指定的用户Id。
|
||||
* @param deptId 用户所属部门主键Id。
|
||||
* @return 合并优化后的数据权限列表。返回格式为,Map<RuleType, DeptIdString>。
|
||||
*/
|
||||
Map<Integer, String> getSysDataPermListByUserId(Long userId, Long deptId);
|
||||
|
||||
/**
|
||||
* 添加用户和数据权限之间的多对多关联关系。
|
||||
*
|
||||
* @param dataPermId 数据权限Id。
|
||||
* @param userIdSet 关联的用户Id列表。
|
||||
*/
|
||||
void addDataPermUserList(Long dataPermId, Set<Long> userIdSet);
|
||||
|
||||
/**
|
||||
* 移除用户和数据权限之间的多对多关联关系。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param userId 用户主键Id。
|
||||
* @return true移除成功,否则false。
|
||||
*/
|
||||
boolean removeDataPermUser(Long dataPermId, Long userId);
|
||||
|
||||
/**
|
||||
* 验证数据权限对象关联菜单数据是否都合法。
|
||||
*
|
||||
* @param dataPerm 与数据权限关联的菜单数据列表。
|
||||
* @param deptIdListString 与数据权限关联的部门Id列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
CallResult verifyRelatedData(SysDataPerm dataPerm, String deptIdListString);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门管理数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysDeptService extends IBaseService<SysDept, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增的部门对象。
|
||||
*
|
||||
* @param sysDept 新增的部门对象。
|
||||
* @param parentSysDept 上级部门对象。
|
||||
* @return 新增后的部门对象。
|
||||
*/
|
||||
SysDept saveNew(SysDept sysDept, SysDept parentSysDept);
|
||||
|
||||
/**
|
||||
* 更新部门对象。
|
||||
*
|
||||
* @param sysDept 更新的部门对象。
|
||||
* @param originalSysDept 原有的部门对象。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SysDept sysDept, SysDept originalSysDept);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long deptId);
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<SysDept> getSysDeptList(SysDept filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
<M> List<SysDept> getSysDeptList(String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<SysDept> getSysDeptListWithRelation(SysDept filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 同时还包含主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
<M> List<SysDept> getSysDeptListWithRelation(
|
||||
String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 判断指定对象是否包含下级对象。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
boolean hasChildren(Long deptId);
|
||||
|
||||
/**
|
||||
* 判断指定部门Id是否包含用户对象。
|
||||
*
|
||||
* @param deptId 部门主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
boolean hasChildrenUser(Long deptId);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.model.SysMenu;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单数据服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysMenuService extends IBaseService<SysMenu, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增的菜单对象。
|
||||
*
|
||||
* @param sysMenu 新增的菜单对象。
|
||||
* @param permCodeIdSet 权限字Id列表。
|
||||
* @return 新增后的菜单对象。
|
||||
*/
|
||||
SysMenu saveNew(SysMenu sysMenu, Set<Long> permCodeIdSet);
|
||||
|
||||
/**
|
||||
* 更新菜单对象。
|
||||
*
|
||||
* @param sysMenu 更新的菜单对象。
|
||||
* @param originalSysMenu 原有的菜单对象。
|
||||
* @param permCodeIdSet 权限字Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SysMenu sysMenu, SysMenu originalSysMenu, Set<Long> permCodeIdSet);
|
||||
|
||||
/**
|
||||
* 删除指定的菜单。
|
||||
*
|
||||
* @param menu 菜单对象。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(SysMenu menu);
|
||||
|
||||
/**
|
||||
* 获取全部菜单列表。
|
||||
*
|
||||
* @return 全部菜单列表。
|
||||
*/
|
||||
Collection<SysMenu> getAllMenuList();
|
||||
|
||||
/**
|
||||
* 获取指定用户Id的菜单列表,已去重。
|
||||
*
|
||||
* @param userId 用户主键Id。
|
||||
* @return 用户关联的菜单列表。
|
||||
*/
|
||||
Collection<SysMenu> getMenuListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 判断当前菜单是否存在子菜单。
|
||||
*
|
||||
* @param menuId 菜单主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
boolean hasChildren(Long menuId);
|
||||
|
||||
/**
|
||||
* 验证菜单对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysMenu 当前操作的对象。
|
||||
* @param originalSysMenu 原有对象。
|
||||
* @param permCodeIdListString 逗号分隔的权限Id列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
CallResult verifyRelatedData(SysMenu sysMenu, SysMenu originalSysMenu, String permCodeIdListString);
|
||||
|
||||
/**
|
||||
* 查询菜单的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param url 权限资源地址过滤条件。
|
||||
* @return 包含从菜单到权限资源的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermListWithDetail(Long menuId, String url);
|
||||
|
||||
/**
|
||||
* 查询菜单的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从菜单到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysUserListWithDetail(Long menuId, String loginName);
|
||||
|
||||
/**
|
||||
* 获取指定类型的所有在线表单的菜单。
|
||||
*
|
||||
* @param menuType 菜单类型,NULL则返回全部类型。
|
||||
* @return 在线表单关联的菜单列表。
|
||||
*/
|
||||
List<SysMenu> getAllOnlineMenuList(Integer menuType);
|
||||
|
||||
/**
|
||||
* 获取当前用户有权访问的在线表单菜单,仅返回类型为BUTTON的菜单。
|
||||
*
|
||||
* @param userId 指定的用户。
|
||||
* @param menuType 菜单类型,NULL则返回全部类型。
|
||||
* @return 在线表单关联的菜单列表。
|
||||
*/
|
||||
List<SysMenu> getOnlineMenuListByUserId(Long userId, Integer menuType);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.model.SysPermCode;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限字数据服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermCodeService extends IBaseService<SysPermCode, Long> {
|
||||
|
||||
/**
|
||||
* 获取指定用户的权限字列表,已去重。
|
||||
*
|
||||
* @param userId 用户主键Id。
|
||||
* @return 用户关联的权限字列表。
|
||||
*/
|
||||
Collection<String> getPermCodeListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 获取所有权限字数据列表,已去重。
|
||||
*
|
||||
* @return 全部权限字列表。
|
||||
*/
|
||||
Collection<String> getAllPermCodeList();
|
||||
|
||||
/**
|
||||
* 保存新增的权限字对象。
|
||||
*
|
||||
* @param sysPermCode 新增的权限字对象。
|
||||
* @param permIdSet 权限资源Id列表。
|
||||
* @return 新增后的权限字对象。
|
||||
*/
|
||||
SysPermCode saveNew(SysPermCode sysPermCode, Set<Long> permIdSet);
|
||||
|
||||
/**
|
||||
* 更新权限字对象。
|
||||
*
|
||||
* @param sysPermCode 更新的权限字对象。
|
||||
* @param originalSysPermCode 原有的权限字对象。
|
||||
* @param permIdSet 权限资源Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SysPermCode sysPermCode, SysPermCode originalSysPermCode, Set<Long> permIdSet);
|
||||
|
||||
/**
|
||||
* 删除指定的权限字。
|
||||
*
|
||||
* @param permCodeId 权限字主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long permCodeId);
|
||||
|
||||
/**
|
||||
* 判断当前权限字是否存在下级权限字对象。
|
||||
*
|
||||
* @param permCodeId 权限字主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
boolean hasChildren(Long permCodeId);
|
||||
|
||||
/**
|
||||
* 验证权限字对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysPermCode 当前操作的对象。
|
||||
* @param originalSysPermCode 原有对象。
|
||||
* @param permIdListString 逗号分隔的权限资源Id列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
CallResult verifyRelatedData(SysPermCode sysPermCode, SysPermCode originalSysPermCode, String permIdListString);
|
||||
|
||||
/**
|
||||
* 查询权限字的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从权限字到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysUserListWithDetail(Long permCodeId, String loginName);
|
||||
|
||||
/**
|
||||
* 查询权限字的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 包含从权限字到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysRoleListWithDetail(Long permCodeId, String roleName);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.upmsservice.model.SysPermModule;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限资源模块数据服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermModuleService extends IBaseService<SysPermModule, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增的权限资源模块对象。
|
||||
*
|
||||
* @param sysPermModule 新增的权限资源模块对象。
|
||||
* @return 新增后的权限资源模块对象。
|
||||
*/
|
||||
SysPermModule saveNew(SysPermModule sysPermModule);
|
||||
|
||||
/**
|
||||
* 更新权限资源模块对象。
|
||||
*
|
||||
* @param sysPermModule 更新的权限资源模块对象。
|
||||
* @param originalSysPermModule 原有的权限资源模块对象。
|
||||
* @return 更新成功返回true,否则false
|
||||
*/
|
||||
boolean update(SysPermModule sysPermModule, SysPermModule originalSysPermModule);
|
||||
|
||||
/**
|
||||
* 删除指定的权限资源模块。
|
||||
*
|
||||
* @param moduleId 权限资源模块主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long moduleId);
|
||||
|
||||
/**
|
||||
* 获取权限模块资源及其关联的权限资源列表。
|
||||
*
|
||||
* @return 权限资源模块及其关联的权限资源列表。
|
||||
*/
|
||||
List<SysPermModule> getPermModuleAndPermList();
|
||||
|
||||
/**
|
||||
* 判断是否存在下级权限资源模块。
|
||||
*
|
||||
* @param moduleId 权限资源模块主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
boolean hasChildren(Long moduleId);
|
||||
|
||||
/**
|
||||
* 判断是否存在权限数据。
|
||||
*
|
||||
* @param moduleId 权限资源模块主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
boolean hasModulePerms(Long moduleId);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.model.SysPerm;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限资源数据服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermService extends IBaseService<SysPerm, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增的权限资源对象。
|
||||
*
|
||||
* @param perm 新增的权限资源对象。
|
||||
* @return 新增后的权限资源对象。
|
||||
*/
|
||||
SysPerm saveNew(SysPerm perm);
|
||||
|
||||
/**
|
||||
* 更新权限资源对象。
|
||||
*
|
||||
* @param perm 更新的权限资源对象。
|
||||
* @param originalPerm 原有的权限资源对象。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SysPerm perm, SysPerm originalPerm);
|
||||
|
||||
/**
|
||||
* 删除权限资源。
|
||||
*
|
||||
* @param permId 权限资源主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long permId);
|
||||
|
||||
/**
|
||||
* 获取权限数据列表。
|
||||
*
|
||||
* @param sysPermFilter 过滤对象。
|
||||
* @return 权限列表。
|
||||
*/
|
||||
List<SysPerm> getPermListWithRelation(SysPerm sysPermFilter);
|
||||
|
||||
/**
|
||||
* 获取与指定用户关联的权限资源列表,已去重。
|
||||
*
|
||||
* @param userId 关联的用户主键Id。
|
||||
* @return 与指定用户Id关联的权限资源URL列表。
|
||||
*/
|
||||
Collection<String> getPermListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从权限资源到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysUserListWithDetail(Long permId, String loginName);
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 包含从权限资源到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysRoleListWithDetail(Long permId, String roleName);
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param menuName 菜单名。
|
||||
* @return 包含从权限资源到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysMenuListWithDetail(Long permId, String menuName);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.upmsservice.model.SysPermWhitelist;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 白名单数据服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysPermWhitelistService extends IBaseService<SysPermWhitelist, String> {
|
||||
|
||||
/**
|
||||
* 获取白名单权限资源的列表。
|
||||
*
|
||||
* @return 白名单权限资源地址列表。
|
||||
*/
|
||||
List<String> getWhitelistPermList();
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.model.SysRole;
|
||||
import com.orangeforms.upmsservice.model.SysUserRole;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色数据服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysRoleService extends IBaseService<SysRole, Long> {
|
||||
|
||||
/**
|
||||
* 保存新增的角色对象。
|
||||
*
|
||||
* @param role 新增的角色对象。
|
||||
* @param menuIdSet 菜单Id列表。
|
||||
* @return 新增后的角色对象。
|
||||
*/
|
||||
SysRole saveNew(SysRole role, Set<Long> menuIdSet);
|
||||
|
||||
/**
|
||||
* 更新角色对象。
|
||||
*
|
||||
* @param role 更新的角色对象。
|
||||
* @param originalRole 原有的角色对象。
|
||||
* @param menuIdSet 菜单Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SysRole role, SysRole originalRole, Set<Long> menuIdSet);
|
||||
|
||||
/**
|
||||
* 删除指定角色。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long roleId);
|
||||
|
||||
/**
|
||||
* 获取用户的用户角色对象列表。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @return 用户角色对象列表。
|
||||
*/
|
||||
List<SysUserRole> getSysUserRoleListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 获取角色列表。
|
||||
*
|
||||
* @param filter 角色过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 角色列表。
|
||||
*/
|
||||
List<SysRole> getSysRoleList(SysRole filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 批量新增用户角色关联。
|
||||
*
|
||||
* @param userRoleList 用户角色关系数据列表。
|
||||
*/
|
||||
void addUserRoleList(List<SysUserRole> userRoleList);
|
||||
|
||||
/**
|
||||
* 移除指定用户和指定角色的关联关系。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param userId 用户主键Id。
|
||||
* @return 移除成功返回true,否则false。
|
||||
*/
|
||||
boolean removeUserRole(Long roleId, Long userId);
|
||||
|
||||
/**
|
||||
* 验证角色对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysRole 当前操作的对象。
|
||||
* @param originalSysRole 原有对象。
|
||||
* @param menuIdListString 逗号分隔的menuId列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
CallResult verifyRelatedData(SysRole sysRole, SysRole originalSysRole, String menuIdListString);
|
||||
|
||||
/**
|
||||
* 查询角色的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 包含从角色到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermListWithDetail(Long roleId, String url);
|
||||
|
||||
/**
|
||||
* 查询角色的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 包含从角色到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermCodeListWithDetail(Long roleId, String permCode);
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.orangeforms.upmsservice.service;
|
||||
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.common.core.base.service.IBaseService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户管理数据操作服务接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface SysUserService extends IBaseService<SysUser, Long> {
|
||||
|
||||
/**
|
||||
* 获取指定登录名的用户对象。
|
||||
*
|
||||
* @param loginName 指定登录用户名。
|
||||
* @return 用户对象。
|
||||
*/
|
||||
SysUser getSysUserByLoginName(String loginName);
|
||||
|
||||
/**
|
||||
* 保存新增的用户对象。
|
||||
*
|
||||
* @param user 新增的用户对象。
|
||||
* @param roleIdSet 用户角色Id集合。
|
||||
* @param dataPermIdSet 数据权限Id集合。
|
||||
* @return 新增后的用户对象。
|
||||
*/
|
||||
SysUser saveNew(SysUser user, Set<Long> roleIdSet, Set<Long> dataPermIdSet);
|
||||
|
||||
/**
|
||||
* 更新用户对象。
|
||||
*
|
||||
* @param user 更新的用户对象。
|
||||
* @param originalUser 原有的用户对象。
|
||||
* @param roleIdSet 用户角色Id列表。
|
||||
* @param dataPermIdSet 数据权限Id集合。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
boolean update(SysUser user, SysUser originalUser, Set<Long> roleIdSet, Set<Long> dataPermIdSet);
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param userId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
boolean remove(Long userId);
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysUserListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<SysUser> getSysUserList(SysUser filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysUserListWithRelation)方法。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
<M> List<SysUser> getSysUserList(String inFilterField, Set<M> inFilterValues, SysUser filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysUserList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
List<SysUser> getSysUserListWithRelation(SysUser filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 同时还包含主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysUserList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
<M> List<SysUser> getSysUserListWithRelation(
|
||||
String inFilterField, Set<M> inFilterValues, SysUser filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取指定角色的用户列表。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
List<SysUser> getSysUserListByRoleId(Long roleId, SysUser filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取不属于指定角色的用户列表。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
List<SysUser> getNotInSysUserListByRoleId(Long roleId, SysUser filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取指定数据权限的用户列表。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
List<SysUser> getSysUserListByDataPermId(Long dataPermId, SysUser filter, String orderBy);
|
||||
|
||||
/**
|
||||
* 获取不属于指定数据权限的用户列表。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
List<SysUser> getNotInSysUserListByDataPermId(Long dataPermId, SysUser filter, String orderBy);
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 包含从用户到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermListWithDetail(Long userId, String url);
|
||||
|
||||
/**
|
||||
* 查询用户的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 包含从用户到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysPermCodeListWithDetail(Long userId, String permCode);
|
||||
|
||||
/**
|
||||
* 查询用户的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param menuName 菜单名称过滤条件。
|
||||
* @return 包含从用户到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
List<Map<String, Object>> getSysMenuListWithDetail(Long userId, String menuName);
|
||||
|
||||
/**
|
||||
* 验证用户对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysUser 当前操作的对象。
|
||||
* @param originalSysUser 原有对象。
|
||||
* @param roleIds 逗号分隔的角色Id列表字符串。
|
||||
* @param dataPermIds 逗号分隔的数据权限Id列表字符串。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
CallResult verifyRelatedData(
|
||||
SysUser sysUser, SysUser originalSysUser, String roleIds, String dataPermIds);
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.util.RedisKeyUtil;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.datafilter.constant.DataPermRuleType;
|
||||
import com.orangeforms.upmsservice.dao.SysDataPermDeptMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysDataPermMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysDataPermUserMapper;
|
||||
import com.orangeforms.upmsservice.service.SysDataPermService;
|
||||
import com.orangeforms.upmsservice.service.SysDeptService;
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.upmsservice.config.ApplicationConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.redisson.api.RBucket;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据权限数据服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysDataPermService")
|
||||
public class SysDataPermServiceImpl extends BaseService<SysDataPerm, Long> implements SysDataPermService {
|
||||
|
||||
@Autowired
|
||||
private SysDataPermMapper sysDataPermMapper;
|
||||
@Autowired
|
||||
private SysDataPermDeptMapper sysDataPermDeptMapper;
|
||||
@Autowired
|
||||
private SysDataPermUserMapper sysDataPermUserMapper;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
@Autowired
|
||||
private ApplicationConfig applicationConfig;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回主对象的Mapper对象。
|
||||
*
|
||||
* @return 主对象的Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysDataPerm> mapper() {
|
||||
return sysDataPermMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的数据权限对象。
|
||||
*
|
||||
* @param dataPerm 新增的数据权限对象。
|
||||
* @param deptIdSet 关联的部门Id列表。
|
||||
* @return 新增后的数据权限对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysDataPerm saveNew(SysDataPerm dataPerm, Set<Long> deptIdSet) {
|
||||
dataPerm.setDataPermId(idGenerator.nextLongId());
|
||||
dataPerm.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(dataPerm);
|
||||
sysDataPermMapper.insert(dataPerm);
|
||||
this.insertRelationData(dataPerm, deptIdSet);
|
||||
return dataPerm;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据权限对象。
|
||||
*
|
||||
* @param dataPerm 更新的数据权限对象。
|
||||
* @param originalDataPerm 原有的数据权限对象。
|
||||
* @param deptIdSet 关联的部门Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysDataPerm dataPerm, SysDataPerm originalDataPerm, Set<Long> deptIdSet) {
|
||||
MyModelUtil.fillCommonsForUpdate(dataPerm, originalDataPerm);
|
||||
UpdateWrapper<SysDataPerm> uw = this.createUpdateQueryForNullValue(dataPerm, dataPerm.getDataPermId());
|
||||
if (sysDataPermMapper.update(dataPerm, uw) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||
dataPermDept.setDataPermId(dataPerm.getDataPermId());
|
||||
sysDataPermDeptMapper.delete(new QueryWrapper<>(dataPermDept));
|
||||
this.insertRelationData(dataPerm, deptIdSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据权限。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long dataPermId) {
|
||||
if (sysDataPermMapper.deleteById(dataPermId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||
dataPermDept.setDataPermId(dataPermId);
|
||||
sysDataPermDeptMapper.delete(new QueryWrapper<>(dataPermDept));
|
||||
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||
dataPermUser.setDataPermId(dataPermId);
|
||||
sysDataPermUserMapper.delete(new QueryWrapper<>(dataPermUser));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据权限列表。
|
||||
*
|
||||
* @param filter 数据权限过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 数据权限查询列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysDataPerm> getSysDataPermList(SysDataPerm filter, String orderBy) {
|
||||
return sysDataPermMapper.getSysDataPermList(filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定会话的数据权限集合从缓存中移除。
|
||||
*
|
||||
* @param sessionId 会话Id。
|
||||
*/
|
||||
@Override
|
||||
public void removeDataPermCache(String sessionId) {
|
||||
String sessionPermKey = RedisKeyUtil.makeSessionDataPermIdKey(sessionId);
|
||||
redissonClient.getBucket(sessionPermKey).deleteAsync();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定用户的指定会话的数据权限集合存入缓存。
|
||||
*
|
||||
* @param sessionId 会话Id。
|
||||
* @param userId 用户主键Id。
|
||||
* @param deptId 用户所属部门主键Id。
|
||||
* @return 查询并缓存后的数据权限集合。返回格式为,Map<RuleType, DeptIdString>。
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, String> putDataPermCache(String sessionId, Long userId, Long deptId) {
|
||||
Map<Integer, String> dataPermMap = this.getSysDataPermListByUserId(userId, deptId);
|
||||
if (dataPermMap.size() > 0) {
|
||||
String dataPermSessionKey = RedisKeyUtil.makeSessionDataPermIdKey(sessionId);
|
||||
RBucket<String> bucket = redissonClient.getBucket(dataPermSessionKey);
|
||||
bucket.set(JSON.toJSONString(dataPermMap),
|
||||
applicationConfig.getDataPermExpiredSeconds(), TimeUnit.SECONDS);
|
||||
}
|
||||
return dataPermMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定用户Id的数据权限列表。并基于权限规则类型进行了一级分组。
|
||||
*
|
||||
* @param userId 指定的用户Id。
|
||||
* @param deptId 用户所属部门主键Id。
|
||||
* @return 合并优化后的数据权限列表。返回格式为,Map<RuleType, DeptIdString>。
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer, String> getSysDataPermListByUserId(Long userId, Long deptId) {
|
||||
List<SysDataPerm> dataPermList = sysDataPermMapper.getSysDataPermListByUserId(userId);
|
||||
dataPermList.forEach(dataPerm -> {
|
||||
if (CollectionUtils.isNotEmpty(dataPerm.getDataPermDeptList())) {
|
||||
Set<Long> deptIdSet = dataPerm.getDataPermDeptList().stream()
|
||||
.map(SysDataPermDept::getDeptId).collect(Collectors.toSet());
|
||||
dataPerm.setDeptIdListString(StringUtils.join(deptIdSet, ","));
|
||||
}
|
||||
});
|
||||
// 为了更方便进行后续的合并优化处理,这里再基于规则类型进行分组。ruleMap的key是规则类型。
|
||||
Map<Integer, List<SysDataPerm>> ruleMap =
|
||||
dataPermList.stream().collect(Collectors.groupingBy(SysDataPerm::getRuleType));
|
||||
Map<Integer, String> resultMap = new HashMap<>(ruleMap.size());
|
||||
// 如有有ALL存在,就可以直接退出了,没有必要在处理后续的规则了。
|
||||
if (ruleMap.containsKey(DataPermRuleType.TYPE_ALL)) {
|
||||
resultMap.put(DataPermRuleType.TYPE_ALL, "null");
|
||||
return resultMap;
|
||||
}
|
||||
// 这里优先合并最复杂的多部门及子部门场景。
|
||||
String deptIds = processMultiDeptAndChildren(ruleMap, deptId);
|
||||
if (deptIds != null) {
|
||||
resultMap.put(DataPermRuleType.TYPE_MULTI_DEPT_AND_CHILD_DEPT, deptIds);
|
||||
}
|
||||
// 合并当前部门及子部门的优化
|
||||
if (ruleMap.get(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT) != null) {
|
||||
// 需要与仅仅当前部门规则进行合并。
|
||||
ruleMap.remove(DataPermRuleType.TYPE_DEPT_ONLY);
|
||||
resultMap.put(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT, "null");
|
||||
}
|
||||
// 合并自定义部门了。
|
||||
deptIds = processMultiDept(ruleMap, deptId);
|
||||
if (deptIds != null) {
|
||||
resultMap.put(DataPermRuleType.TYPE_CUSTOM_DEPT_LIST, deptIds);
|
||||
}
|
||||
// 最后处理当前部门和当前用户。
|
||||
if (ruleMap.get(DataPermRuleType.TYPE_DEPT_ONLY) != null) {
|
||||
resultMap.put(DataPermRuleType.TYPE_DEPT_ONLY, "null");
|
||||
}
|
||||
if (ruleMap.get(DataPermRuleType.TYPE_USER_ONLY) != null) {
|
||||
resultMap.put(DataPermRuleType.TYPE_USER_ONLY, "null");
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
private String processMultiDeptAndChildren(Map<Integer, List<SysDataPerm>> ruleMap, Long deptId) {
|
||||
List<SysDataPerm> parentDeptList = ruleMap.get(DataPermRuleType.TYPE_MULTI_DEPT_AND_CHILD_DEPT);
|
||||
if (parentDeptList == null) {
|
||||
return null;
|
||||
}
|
||||
Set<Long> deptIdSet = new HashSet<>();
|
||||
for (SysDataPerm parentDept : parentDeptList) {
|
||||
deptIdSet.addAll(Arrays.stream(StringUtils.split(
|
||||
parentDept.getDeptIdListString(), ",")).map(Long::valueOf).collect(Collectors.toSet()));
|
||||
}
|
||||
// 在合并所有的多父部门Id之后,需要判断是否有本部门及子部门的规则。如果有,就继续合并。
|
||||
if (ruleMap.containsKey(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT)) {
|
||||
// 如果多父部门列表中包含当前部门,那么可以直接删除该规则了,如果没包含,就加入到多部门的DEPT_ID的IN LIST中。
|
||||
deptIdSet.add(deptId);
|
||||
ruleMap.remove(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT);
|
||||
}
|
||||
// 需要与仅仅当前部门规则进行合并。
|
||||
if (ruleMap.containsKey(DataPermRuleType.TYPE_DEPT_ONLY)) {
|
||||
if (deptIdSet.contains(deptId)) {
|
||||
ruleMap.remove(DataPermRuleType.TYPE_DEPT_ONLY);
|
||||
}
|
||||
}
|
||||
return StringUtils.join(deptIdSet, ',');
|
||||
}
|
||||
|
||||
private String processMultiDept(Map<Integer, List<SysDataPerm>> ruleMap, Long deptId) {
|
||||
List<SysDataPerm> customDeptList = ruleMap.get(DataPermRuleType.TYPE_CUSTOM_DEPT_LIST);
|
||||
if (customDeptList == null) {
|
||||
return null;
|
||||
}
|
||||
Set<Long> deptIdSet = new HashSet<>();
|
||||
for (SysDataPerm customDept : customDeptList) {
|
||||
deptIdSet.addAll(Arrays.stream(StringUtils.split(
|
||||
customDept.getDeptIdListString(), ",")).map(Long::valueOf).collect(Collectors.toSet()));
|
||||
}
|
||||
if (ruleMap.containsKey(DataPermRuleType.TYPE_DEPT_ONLY)) {
|
||||
deptIdSet.add(deptId);
|
||||
ruleMap.remove(DataPermRuleType.TYPE_DEPT_ONLY);
|
||||
}
|
||||
return StringUtils.join(deptIdSet, ',');
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户和数据权限之间的多对多关联关系。
|
||||
*
|
||||
* @param dataPermId 数据权限Id。
|
||||
* @param userIdSet 关联的用户Id列表。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void addDataPermUserList(Long dataPermId, Set<Long> userIdSet) {
|
||||
for (Long userId : userIdSet) {
|
||||
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||
dataPermUser.setDataPermId(dataPermId);
|
||||
dataPermUser.setUserId(userId);
|
||||
sysDataPermUserMapper.insert(dataPermUser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除用户和数据权限之间的多对多关联关系。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param userId 用户主键Id。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeDataPermUser(Long dataPermId, Long userId) {
|
||||
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||
dataPermUser.setDataPermId(dataPermId);
|
||||
dataPermUser.setUserId(userId);
|
||||
return sysDataPermUserMapper.delete(new QueryWrapper<>(dataPermUser)) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据权限对象关联菜单数据是否都合法。
|
||||
*
|
||||
* @param dataPerm 与数据权限关联的菜单数据列表。
|
||||
* @param deptIdListString 与数据权限关联的部门Id列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(SysDataPerm dataPerm, String deptIdListString) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if (dataPerm.getRuleType() == DataPermRuleType.TYPE_MULTI_DEPT_AND_CHILD_DEPT
|
||||
|| dataPerm.getRuleType() == DataPermRuleType.TYPE_CUSTOM_DEPT_LIST) {
|
||||
if (StringUtils.isBlank(deptIdListString)) {
|
||||
return CallResult.error("数据验证失败,部门列表不能为空!");
|
||||
}
|
||||
Set<Long> deptIdSet = Arrays.stream(StringUtils.split(
|
||||
deptIdListString, ",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysDeptService.existAllPrimaryKeys(deptIdSet)) {
|
||||
return CallResult.error("数据验证失败,存在不合法的部门数据,请刷新后重试!");
|
||||
}
|
||||
jsonObject.put("deptIdSet", deptIdSet);
|
||||
}
|
||||
return CallResult.ok(jsonObject);
|
||||
}
|
||||
|
||||
private void insertRelationData(SysDataPerm dataPerm, Set<Long> deptIdSet) {
|
||||
if (CollectionUtils.isNotEmpty(deptIdSet)) {
|
||||
for (Long deptId : deptIdSet) {
|
||||
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||
dataPermDept.setDataPermId(dataPerm.getDataPermId());
|
||||
dataPermDept.setDeptId(deptId);
|
||||
sysDataPermDeptMapper.insert(dataPermDept);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orangeforms.upmsservice.service.*;
|
||||
import com.orangeforms.upmsservice.dao.*;
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.common.core.util.*;
|
||||
import com.orangeforms.common.core.object.MyRelationParam;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门管理数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysDeptService")
|
||||
public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements SysDeptService {
|
||||
|
||||
@Autowired
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
@Autowired
|
||||
private SysDeptRelationMapper sysDeptRelationMapper;
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
@Autowired
|
||||
private SysDataPermDeptMapper sysDataPermDeptMapper;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysDept> mapper() {
|
||||
return sysDeptMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的部门对象。
|
||||
*
|
||||
* @param sysDept 新增的部门对象。
|
||||
* @param parentSysDept 上级部门对象。
|
||||
* @return 新增后的部门对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysDept saveNew(SysDept sysDept, SysDept parentSysDept) {
|
||||
sysDept.setDeptId(idGenerator.nextLongId());
|
||||
sysDept.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(sysDept);
|
||||
sysDeptMapper.insert(sysDept);
|
||||
// 同步插入部门关联关系数据
|
||||
if (parentSysDept == null) {
|
||||
sysDeptRelationMapper.insert(new SysDeptRelation(sysDept.getDeptId(), sysDept.getDeptId()));
|
||||
} else {
|
||||
sysDeptRelationMapper.insertParentList(parentSysDept.getDeptId(), sysDept.getDeptId());
|
||||
}
|
||||
return sysDept;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门对象。
|
||||
*
|
||||
* @param sysDept 更新的部门对象。
|
||||
* @param originalSysDept 原有的部门对象。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysDept sysDept, SysDept originalSysDept) {
|
||||
MyModelUtil.fillCommonsForUpdate(sysDept, originalSysDept);
|
||||
UpdateWrapper<SysDept> uw = this.createUpdateQueryForNullValue(sysDept, sysDept.getDeptId());
|
||||
if (sysDeptMapper.update(sysDept, uw) == 0) {
|
||||
return false;
|
||||
}
|
||||
if (ObjectUtils.notEqual(sysDept.getParentId(), originalSysDept.getParentId())) {
|
||||
this.updateParentRelation(sysDept, originalSysDept);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateParentRelation(SysDept sysDept, SysDept originalSysDept) {
|
||||
// 1. 在删除当前部门与原有父部门的关联关系之前,先将原有的所有父部门Id缓存。
|
||||
List<Long> originalParentIdList = new LinkedList<>();
|
||||
if (originalSysDept.getParentId() != null) {
|
||||
SysDept originalParentDept = getById(originalSysDept.getParentId());
|
||||
while (originalParentDept != null) {
|
||||
originalParentIdList.add(originalParentDept.getDeptId());
|
||||
if (originalParentDept.getParentId() == null) {
|
||||
break;
|
||||
}
|
||||
originalParentDept = getById(originalParentDept.getParentId());
|
||||
}
|
||||
}
|
||||
// 删除其子部门与其原有父部门之间的关联关系。
|
||||
for (Long parentDeptId : originalParentIdList) {
|
||||
sysDeptRelationMapper.removeBetweenChildrenAndParents(parentDeptId, sysDept.getDeptId());
|
||||
}
|
||||
// 2. 将当前部门与原有的父部门列表解除关系。
|
||||
SysDeptRelation filter = new SysDeptRelation();
|
||||
filter.setDeptId(sysDept.getDeptId());
|
||||
sysDeptRelationMapper.delete(new QueryWrapper<>(filter));
|
||||
// 3. 将当前部门和新的父部门列表建立关联关系。
|
||||
// 在插入与新父部门的关联关系
|
||||
List<SysDeptRelation> deptRelationList = new LinkedList<>();
|
||||
// 先插入自己和自己的关系。
|
||||
deptRelationList.add(new SysDeptRelation(sysDept.getDeptId(), sysDept.getDeptId()));
|
||||
SysDept parentSysDept = null;
|
||||
if (sysDept.getParentId() != null) {
|
||||
parentSysDept = getById(sysDept.getParentId());
|
||||
}
|
||||
List<Long> newParentIdList = new LinkedList<>();
|
||||
// 再插入直接父部门,以及父部门的父部门,并向上以此类推。
|
||||
while (parentSysDept != null) {
|
||||
newParentIdList.add(parentSysDept.getDeptId());
|
||||
deptRelationList.add(
|
||||
new SysDeptRelation(parentSysDept.getDeptId(), sysDept.getDeptId()));
|
||||
if (parentSysDept.getParentId() == null) {
|
||||
break;
|
||||
}
|
||||
parentSysDept = getById(parentSysDept.getParentId());
|
||||
}
|
||||
sysDeptRelationMapper.insertList(deptRelationList);
|
||||
// 4. 将当前部门的子部门与其新的父部门建立关联关系
|
||||
QueryWrapper<SysDeptRelation> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(MyModelUtil.mapToColumnName("parentDeptId", SysDeptRelation.class), sysDept.getDeptId());
|
||||
queryWrapper.ne(MyModelUtil.mapToColumnName("deptId", SysDeptRelation.class), sysDept.getDeptId());
|
||||
List<SysDeptRelation> childRelationList = sysDeptRelationMapper.selectList(queryWrapper);
|
||||
List<SysDeptRelation> newChildrenAndParentList = new LinkedList<>();
|
||||
for (Long newParentId : newParentIdList) {
|
||||
for (SysDeptRelation childDeptRelation : childRelationList) {
|
||||
newChildrenAndParentList.add(new SysDeptRelation(newParentId, childDeptRelation.getDeptId()));
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(newChildrenAndParentList)) {
|
||||
sysDeptRelationMapper.insertList(newChildrenAndParentList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long deptId) {
|
||||
if (sysDeptMapper.deleteById(deptId) == 0) {
|
||||
return false;
|
||||
}
|
||||
// 这里删除当前部门及其父部门的关联关系。
|
||||
// 当前部门和子部门的关系无需在这里删除,因为包含子部门时不能删除父部门。
|
||||
SysDeptRelation deptRelation = new SysDeptRelation();
|
||||
deptRelation.setDeptId(deptId);
|
||||
sysDeptRelationMapper.delete(new QueryWrapper<>(deptRelation));
|
||||
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||
dataPermDept.setDeptId(deptId);
|
||||
sysDataPermDeptMapper.delete(new QueryWrapper<>(dataPermDept));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<SysDept> getSysDeptList(SysDept filter, String orderBy) {
|
||||
return sysDeptMapper.getSysDeptList(null, null, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public <M> List<SysDept> getSysDeptList(
|
||||
String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy) {
|
||||
String inFilterColumn = MyModelUtil.mapToColumnName(inFilterField, SysDept.class);
|
||||
return sysDeptMapper.getSysDeptList(inFilterColumn, inFilterValues, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<SysDept> getSysDeptListWithRelation(SysDept filter, String orderBy) {
|
||||
List<SysDept> resultList = sysDeptMapper.getSysDeptList(null, null, filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 同时还包含主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public <M> List<SysDept> getSysDeptListWithRelation(
|
||||
String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy) {
|
||||
String inFilterColumn = MyModelUtil.mapToColumnName(inFilterField, SysDept.class);
|
||||
List<SysDept> resultList =
|
||||
sysDeptMapper.getSysDeptList(inFilterColumn, inFilterValues, filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指定对象是否包含下级对象。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Long deptId) {
|
||||
SysDept filter = new SysDept();
|
||||
filter.setParentId(deptId);
|
||||
return getCountByFilter(filter) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指定部门Id是否包含用户对象。
|
||||
*
|
||||
* @param deptId 部门主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildrenUser(Long deptId) {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setDeptId(deptId);
|
||||
return sysUserService.getCountByFilter(sysUser) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsapi.constant.SysMenuType;
|
||||
import com.orangeforms.upmsapi.constant.SysOnlineMenuPermType;
|
||||
import com.orangeforms.upmsservice.service.SysMenuService;
|
||||
import com.orangeforms.upmsservice.service.SysPermCodeService;
|
||||
import com.orangeforms.upmsservice.dao.SysMenuPermCodeMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysRoleMenuMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysMenuMapper;
|
||||
import com.orangeforms.upmsservice.model.SysMenu;
|
||||
import com.orangeforms.upmsservice.model.SysMenuPermCode;
|
||||
import com.orangeforms.upmsservice.model.SysRoleMenu;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 菜单数据服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysMenuService")
|
||||
public class SysMenuServiceImpl extends BaseService<SysMenu, Long> implements SysMenuService {
|
||||
|
||||
@Autowired
|
||||
private SysMenuMapper sysMenuMapper;
|
||||
@Autowired
|
||||
private SysRoleMenuMapper sysRoleMenuMapper;
|
||||
@Autowired
|
||||
private SysMenuPermCodeMapper sysMenuPermCodeMapper;
|
||||
@Autowired
|
||||
private SysPermCodeService sysPermCodeService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回主对象的Mapper对象。
|
||||
*
|
||||
* @return 主对象的Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysMenu> mapper() {
|
||||
return sysMenuMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的菜单对象。
|
||||
*
|
||||
* @param sysMenu 新增的菜单对象。
|
||||
* @param permCodeIdSet 权限字Id列表。
|
||||
* @return 新增后的菜单对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysMenu saveNew(SysMenu sysMenu, Set<Long> permCodeIdSet) {
|
||||
sysMenu.setMenuId(idGenerator.nextLongId());
|
||||
sysMenu.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(sysMenu);
|
||||
sysMenuMapper.insert(sysMenu);
|
||||
if (permCodeIdSet != null) {
|
||||
for (Long permCodeId : permCodeIdSet) {
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setMenuId(sysMenu.getMenuId());
|
||||
menuPermCode.setPermCodeId(permCodeId);
|
||||
sysMenuPermCodeMapper.insert(menuPermCode);
|
||||
}
|
||||
}
|
||||
// 判断当前菜单是否为指向在线表单的菜单,并将根据约定,动态插入两个子菜单。
|
||||
if (sysMenu.getOnlineFormId() != null) {
|
||||
SysMenu viewSubMenu = new SysMenu();
|
||||
viewSubMenu.setMenuId(idGenerator.nextLongId());
|
||||
viewSubMenu.setParentId(sysMenu.getMenuId());
|
||||
viewSubMenu.setMenuType(SysMenuType.TYPE_BUTTON);
|
||||
viewSubMenu.setMenuName("查看");
|
||||
viewSubMenu.setShowOrder(0);
|
||||
viewSubMenu.setOnlineFormId(sysMenu.getOnlineFormId());
|
||||
viewSubMenu.setOnlineMenuPermType(SysOnlineMenuPermType.TYPE_VIEW);
|
||||
viewSubMenu.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(viewSubMenu);
|
||||
sysMenuMapper.insert(viewSubMenu);
|
||||
SysMenu editSubMenu = new SysMenu();
|
||||
editSubMenu.setMenuId(idGenerator.nextLongId());
|
||||
editSubMenu.setParentId(sysMenu.getMenuId());
|
||||
editSubMenu.setMenuType(SysMenuType.TYPE_BUTTON);
|
||||
editSubMenu.setMenuName("编辑");
|
||||
editSubMenu.setShowOrder(1);
|
||||
editSubMenu.setOnlineFormId(sysMenu.getOnlineFormId());
|
||||
editSubMenu.setOnlineMenuPermType(SysOnlineMenuPermType.TYPE_EDIT);
|
||||
editSubMenu.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(editSubMenu);
|
||||
sysMenuMapper.insert(editSubMenu);
|
||||
}
|
||||
return sysMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单对象。
|
||||
*
|
||||
* @param sysMenu 更新的菜单对象。
|
||||
* @param originalSysMenu 原有的菜单对象。
|
||||
* @param permCodeIdSet 权限字Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysMenu sysMenu, SysMenu originalSysMenu, Set<Long> permCodeIdSet) {
|
||||
MyModelUtil.fillCommonsForUpdate(sysMenu, originalSysMenu);
|
||||
sysMenu.setMenuType(originalSysMenu.getMenuType());
|
||||
UpdateWrapper<SysMenu> uw = this.createUpdateQueryForNullValue(sysMenu, sysMenu.getMenuId());
|
||||
if (sysMenuMapper.update(sysMenu, uw) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysMenuPermCode deletedMenuPermCode = new SysMenuPermCode();
|
||||
deletedMenuPermCode.setMenuId(sysMenu.getMenuId());
|
||||
sysMenuPermCodeMapper.delete(new QueryWrapper<>(deletedMenuPermCode));
|
||||
if (permCodeIdSet != null) {
|
||||
for (Long permCodeId : permCodeIdSet) {
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setMenuId(sysMenu.getMenuId());
|
||||
menuPermCode.setPermCodeId(permCodeId);
|
||||
sysMenuPermCodeMapper.insert(menuPermCode);
|
||||
}
|
||||
}
|
||||
// 如果当前菜单的在线表单Id变化了,就需要同步更新他的内置子菜单也同步更新。
|
||||
if (ObjectUtil.notEqual(originalSysMenu.getOnlineFormId(), sysMenu.getOnlineFormId())) {
|
||||
SysMenu onlineSubMenu = new SysMenu();
|
||||
onlineSubMenu.setOnlineFormId(sysMenu.getOnlineFormId());
|
||||
sysMenuMapper.update(onlineSubMenu,
|
||||
new QueryWrapper<SysMenu>().lambda().eq(SysMenu::getParentId, sysMenu.getMenuId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定的菜单。
|
||||
*
|
||||
* @param menu 菜单对象。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(SysMenu menu) {
|
||||
Long menuId = menu.getMenuId();
|
||||
if (sysMenuMapper.deleteById(menuId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setMenuId(menuId);
|
||||
sysRoleMenuMapper.delete(new QueryWrapper<>(roleMenu));
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setMenuId(menuId);
|
||||
sysMenuPermCodeMapper.delete(new QueryWrapper<>(menuPermCode));
|
||||
// 如果为指向在线表单的菜单,则连同删除子菜单
|
||||
if (menu.getOnlineFormId() != null) {
|
||||
sysMenuMapper.delete(new QueryWrapper<SysMenu>().lambda().eq(SysMenu::getParentId, menuId));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部菜单列表。
|
||||
*
|
||||
* @return 全部菜单列表。
|
||||
*/
|
||||
@Override
|
||||
public Collection<SysMenu> getAllMenuList() {
|
||||
QueryWrapper<SysMenu> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc(this.safeMapToColumnName("showOrder"));
|
||||
queryWrapper.in(this.safeMapToColumnName("menuType"),
|
||||
Arrays.asList(SysMenuType.TYPE_MENU, SysMenuType.TYPE_DIRECTORY));
|
||||
return sysMenuMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定用户Id的菜单列表,已去重。
|
||||
*
|
||||
* @param userId 用户主键Id。
|
||||
* @return 用户关联的菜单列表。
|
||||
*/
|
||||
@Override
|
||||
public Collection<SysMenu> getMenuListByUserId(Long userId) {
|
||||
List<SysMenu> menuList = sysMenuMapper.getMenuListByUserId(userId);
|
||||
LinkedHashMap<Long, SysMenu> menuMap = new LinkedHashMap<>();
|
||||
for (SysMenu menu : menuList) {
|
||||
menuMap.put(menu.getMenuId(), menu);
|
||||
}
|
||||
return menuMap.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前菜单是否存在子菜单。
|
||||
*
|
||||
* @param menuId 菜单主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Long menuId) {
|
||||
SysMenu menu = new SysMenu();
|
||||
menu.setParentId(menuId);
|
||||
return this.getCountByFilter(menu) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证菜单对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysMenu 当前操作的对象。
|
||||
* @param originalSysMenu 原有对象。
|
||||
* @param permCodeIdListString 逗号分隔的权限Id列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(SysMenu sysMenu, SysMenu originalSysMenu, String permCodeIdListString) {
|
||||
// menu、ui fragment和button类型的menu不能没有parentId
|
||||
if (sysMenu.getParentId() == null) {
|
||||
if (sysMenu.getMenuType() != SysMenuType.TYPE_DIRECTORY) {
|
||||
return CallResult.error("数据验证失败,当前类型菜单项的上级菜单不能为空!");
|
||||
}
|
||||
}
|
||||
if (this.needToVerify(sysMenu, originalSysMenu, SysMenu::getParentId)) {
|
||||
String errorMessage = checkErrorOfNonDirectoryMenu(sysMenu);
|
||||
if (errorMessage != null) {
|
||||
return CallResult.error(errorMessage);
|
||||
}
|
||||
}
|
||||
JSONObject jsonObject = null;
|
||||
if (StringUtils.isNotBlank(permCodeIdListString)) {
|
||||
Set<Long> permCodeIdSet = Arrays.stream(
|
||||
permCodeIdListString.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysPermCodeService.existAllPrimaryKeys(permCodeIdSet)) {
|
||||
return CallResult.error("数据验证失败,存在不合法的权限字,请刷新后重试!");
|
||||
}
|
||||
jsonObject = new JSONObject();
|
||||
jsonObject.put("permCodeIdSet", permCodeIdSet);
|
||||
}
|
||||
return CallResult.ok(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param url 权限资源地址过滤条件。
|
||||
* @return 包含从菜单到权限资源的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysPermListWithDetail(Long menuId, String url) {
|
||||
return sysMenuMapper.getSysPermListWithDetail(menuId, url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜单的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param menuId 菜单Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从菜单到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysUserListWithDetail(Long menuId, String loginName) {
|
||||
return sysMenuMapper.getSysUserListWithDetail(menuId, loginName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定类型的所有在线表单的菜单。
|
||||
*
|
||||
* @param menuType 菜单类型,NULL则返回全部类型。
|
||||
* @return 在线表单关联的菜单列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getAllOnlineMenuList(Integer menuType) {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper =
|
||||
new QueryWrapper<SysMenu>().lambda().isNotNull(SysMenu::getOnlineFormId);
|
||||
if (menuType != null) {
|
||||
queryWrapper.eq(SysMenu::getMenuType, menuType);
|
||||
}
|
||||
return sysMenuMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户有权访问的在线表单菜单,仅返回类型为BUTTON的菜单。
|
||||
*
|
||||
* @param userId 指定的用户。
|
||||
* @param menuType 菜单类型,NULL则返回全部类型。
|
||||
* @return 在线表单关联的菜单列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenu> getOnlineMenuListByUserId(Long userId, Integer menuType) {
|
||||
return sysMenuMapper.getOnlineMenuListByUserId(userId, menuType);
|
||||
}
|
||||
|
||||
private String checkErrorOfNonDirectoryMenu(SysMenu sysMenu) {
|
||||
// 判断父节点是否存在
|
||||
SysMenu parentSysMenu = getById(sysMenu.getParentId());
|
||||
if (parentSysMenu == null) {
|
||||
return "数据验证失败,关联的上级菜单并不存在,请刷新后重试!";
|
||||
}
|
||||
// 逐个判断每种类型的菜单,他的父菜单的合法性,先从目录类型和菜单类型开始
|
||||
if (sysMenu.getMenuType() == SysMenuType.TYPE_DIRECTORY
|
||||
|| sysMenu.getMenuType() == SysMenuType.TYPE_MENU) {
|
||||
// 他们的上级只能是目录
|
||||
if (parentSysMenu.getMenuType() != SysMenuType.TYPE_DIRECTORY) {
|
||||
return "数据验证失败,当前类型菜单项的上级菜单只能是目录类型!";
|
||||
}
|
||||
} else if (sysMenu.getMenuType() == SysMenuType.TYPE_UI_FRAGMENT) {
|
||||
// ui fragment的上级只能是menu类型
|
||||
if (parentSysMenu.getMenuType() != SysMenuType.TYPE_MENU) {
|
||||
return "数据验证失败,当前类型菜单项的上级菜单只能是菜单类型和按钮类型!";
|
||||
}
|
||||
} else if (sysMenu.getMenuType() == SysMenuType.TYPE_BUTTON) {
|
||||
// button的上级只能是menu和ui fragment
|
||||
if (parentSysMenu.getMenuType() != SysMenuType.TYPE_MENU
|
||||
&& parentSysMenu.getMenuType() != SysMenuType.TYPE_UI_FRAGMENT) {
|
||||
return "数据验证失败,当前类型菜单项的上级菜单只能是菜单类型和UI片段类型!";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.dao.SysMenuPermCodeMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysPermCodeMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysPermCodePermMapper;
|
||||
import com.orangeforms.upmsservice.model.SysMenuPermCode;
|
||||
import com.orangeforms.upmsservice.model.SysPermCode;
|
||||
import com.orangeforms.upmsservice.model.SysPermCodePerm;
|
||||
import com.orangeforms.upmsservice.service.SysPermCodeService;
|
||||
import com.orangeforms.upmsservice.service.SysPermService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 权限字数据服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysPermCodeService")
|
||||
public class SysPermCodeServiceImpl extends BaseService<SysPermCode, Long> implements SysPermCodeService {
|
||||
|
||||
@Autowired
|
||||
private SysPermCodeMapper sysPermCodeMapper;
|
||||
@Autowired
|
||||
private SysPermCodePermMapper sysPermCodePermMapper;
|
||||
@Autowired
|
||||
private SysMenuPermCodeMapper sysMenuPermCodeMapper;
|
||||
@Autowired
|
||||
private SysPermService sysPermService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回主对象的Mapper对象。
|
||||
*
|
||||
* @return 主对象的Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysPermCode> mapper() {
|
||||
return sysPermCodeMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定用户的权限字列表,已去重。
|
||||
*
|
||||
* @param userId 用户主键Id。
|
||||
* @return 用户关联的权限字列表。
|
||||
*/
|
||||
@Override
|
||||
public Collection<String> getPermCodeListByUserId(Long userId) {
|
||||
List<String> permCodeList = sysPermCodeMapper.getPermCodeListByUserId(userId);
|
||||
return new HashSet<>(permCodeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有权限字数据列表,已去重。
|
||||
*
|
||||
* @return 全部权限字列表。
|
||||
*/
|
||||
@Override
|
||||
public Collection<String> getAllPermCodeList() {
|
||||
List<SysPermCode> permCodeList = this.getAllList();
|
||||
return permCodeList.stream().map(SysPermCode::getPermCode).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的权限字对象。
|
||||
*
|
||||
* @param sysPermCode 新增的权限字对象。
|
||||
* @param permIdSet 权限资源Id列表。
|
||||
* @return 新增后的权限字对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysPermCode saveNew(SysPermCode sysPermCode, Set<Long> permIdSet) {
|
||||
sysPermCode.setPermCodeId(idGenerator.nextLongId());
|
||||
sysPermCode.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(sysPermCode);
|
||||
sysPermCodeMapper.insert(sysPermCode);
|
||||
if (permIdSet != null) {
|
||||
for (Long permId : permIdSet) {
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermCodeId(sysPermCode.getPermCodeId());
|
||||
permCodePerm.setPermId(permId);
|
||||
sysPermCodePermMapper.insert(permCodePerm);
|
||||
}
|
||||
}
|
||||
return sysPermCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限字对象。
|
||||
*
|
||||
* @param sysPermCode 更新的权限字对象。
|
||||
* @param originalSysPermCode 原有的权限字对象。
|
||||
* @param permIdSet 权限资源Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysPermCode sysPermCode, SysPermCode originalSysPermCode, Set<Long> permIdSet) {
|
||||
sysPermCode.setParentId(originalSysPermCode.getParentId());
|
||||
MyModelUtil.fillCommonsForUpdate(sysPermCode, originalSysPermCode);
|
||||
UpdateWrapper<SysPermCode> uw =
|
||||
this.createUpdateQueryForNullValue(sysPermCode, sysPermCode.getPermCodeId());
|
||||
if (sysPermCodeMapper.update(sysPermCode, uw) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysPermCodePerm deletedPermCodePerm = new SysPermCodePerm();
|
||||
deletedPermCodePerm.setPermCodeId(sysPermCode.getPermCodeId());
|
||||
sysPermCodePermMapper.delete(new QueryWrapper<>(deletedPermCodePerm));
|
||||
if (permIdSet != null) {
|
||||
for (Long permId : permIdSet) {
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermCodeId(sysPermCode.getPermCodeId());
|
||||
permCodePerm.setPermId(permId);
|
||||
sysPermCodePermMapper.insert(permCodePerm);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定的权限字。
|
||||
*
|
||||
* @param permCodeId 权限字主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long permCodeId) {
|
||||
if (sysPermCodeMapper.deleteById(permCodeId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysMenuPermCode menuPermCode = new SysMenuPermCode();
|
||||
menuPermCode.setPermCodeId(permCodeId);
|
||||
sysMenuPermCodeMapper.delete(new QueryWrapper<>(menuPermCode));
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermCodeId(permCodeId);
|
||||
sysPermCodePermMapper.delete(new QueryWrapper<>(permCodePerm));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前权限字是否存在下级权限字对象。
|
||||
*
|
||||
* @param permCodeId 权限字主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Long permCodeId) {
|
||||
SysPermCode permCode = new SysPermCode();
|
||||
permCode.setParentId(permCodeId);
|
||||
return this.getCountByFilter(permCode) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证权限字对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysPermCode 当前操作的对象。
|
||||
* @param originalSysPermCode 原有对象。
|
||||
* @param permIdListString 逗号分隔的权限资源Id列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(
|
||||
SysPermCode sysPermCode, SysPermCode originalSysPermCode, String permIdListString) {
|
||||
if (this.needToVerify(sysPermCode, originalSysPermCode, SysPermCode::getParentId)) {
|
||||
if (getById(sysPermCode.getParentId()) == null) {
|
||||
return CallResult.error("数据验证失败,关联的上级权限字并不存在,请刷新后重试!");
|
||||
}
|
||||
}
|
||||
JSONObject jsonObject = null;
|
||||
if (StringUtils.isNotBlank(permIdListString)) {
|
||||
Set<Long> permIdSet = Arrays.stream(
|
||||
permIdListString.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysPermService.existAllPrimaryKeys(permIdSet)) {
|
||||
return CallResult.error("数据验证失败,存在不合法的权限资源,请刷新后重试!");
|
||||
}
|
||||
jsonObject = new JSONObject();
|
||||
jsonObject.put("permIdSet", permIdSet);
|
||||
}
|
||||
return CallResult.ok(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限字的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从权限字到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysUserListWithDetail(Long permCodeId, String loginName) {
|
||||
return sysPermCodeMapper.getSysUserListWithDetail(permCodeId, loginName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限字的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permCodeId 权限字Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 包含从权限字到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysRoleListWithDetail(Long permCodeId, String roleName) {
|
||||
return sysPermCodeMapper.getSysRoleListWithDetail(permCodeId, roleName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.upmsservice.dao.SysPermModuleMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPerm;
|
||||
import com.orangeforms.upmsservice.model.SysPermModule;
|
||||
import com.orangeforms.upmsservice.service.SysPermModuleService;
|
||||
import com.orangeforms.upmsservice.service.SysPermService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限资源模块数据服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysPermModuleService")
|
||||
public class SysPermModuleServiceImpl extends BaseService<SysPermModule, Long> implements SysPermModuleService {
|
||||
|
||||
@Autowired
|
||||
private SysPermModuleMapper sysPermModuleMapper;
|
||||
@Autowired
|
||||
private SysPermService sysPermService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回主对象的Mapper对象。
|
||||
*
|
||||
* @return 主对象的Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysPermModule> mapper() {
|
||||
return sysPermModuleMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的权限资源模块对象。
|
||||
*
|
||||
* @param sysPermModule 新增的权限资源模块对象。
|
||||
* @return 新增后的权限资源模块对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysPermModule saveNew(SysPermModule sysPermModule) {
|
||||
sysPermModule.setModuleId(idGenerator.nextLongId());
|
||||
MyModelUtil.fillCommonsForInsert(sysPermModule);
|
||||
sysPermModule.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
sysPermModuleMapper.insert(sysPermModule);
|
||||
return sysPermModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限资源模块对象。
|
||||
*
|
||||
* @param sysPermModule 更新的权限资源模块对象。
|
||||
* @param originalSysPermModule 原有的权限资源模块对象。
|
||||
* @return 更新成功返回true,否则false
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysPermModule sysPermModule, SysPermModule originalSysPermModule) {
|
||||
MyModelUtil.fillCommonsForUpdate(sysPermModule, originalSysPermModule);
|
||||
return sysPermModuleMapper.updateById(sysPermModule) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定的权限资源模块。
|
||||
*
|
||||
* @param moduleId 权限资源模块主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long moduleId) {
|
||||
return sysPermModuleMapper.deleteById(moduleId) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限模块资源及其关联的权限资源列表。
|
||||
*
|
||||
* @return 权限资源模块及其关联的权限资源列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysPermModule> getPermModuleAndPermList() {
|
||||
return sysPermModuleMapper.getPermModuleAndPermList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否存在下级权限资源模块。
|
||||
*
|
||||
* @param moduleId 权限资源模块主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Long moduleId) {
|
||||
SysPermModule permModule = new SysPermModule();
|
||||
permModule.setParentId(moduleId);
|
||||
return this.getCountByFilter(permModule) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否存在权限数据。
|
||||
*
|
||||
* @param moduleId 权限资源模块主键Id。
|
||||
* @return 存在返回true,否则false。
|
||||
*/
|
||||
@Override
|
||||
public boolean hasModulePerms(Long moduleId) {
|
||||
SysPerm filter = new SysPerm();
|
||||
filter.setModuleId(moduleId);
|
||||
return sysPermService.getCountByFilter(filter) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.object.MyRelationParam;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.dao.SysPermCodePermMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysPermMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPerm;
|
||||
import com.orangeforms.upmsservice.model.SysPermCodePerm;
|
||||
import com.orangeforms.upmsservice.model.SysPermModule;
|
||||
import com.orangeforms.upmsservice.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限资源数据服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysPermService")
|
||||
public class SysPermServiceImpl extends BaseService<SysPerm, Long> implements SysPermService {
|
||||
|
||||
@Autowired
|
||||
private SysPermMapper sysPermMapper;
|
||||
@Autowired
|
||||
private SysPermCodePermMapper sysPermCodePermMapper;
|
||||
@Autowired
|
||||
private SysPermModuleService sysPermModuleService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回主对象的Mapper对象。
|
||||
*
|
||||
* @return 主对象的Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysPerm> mapper() {
|
||||
return sysPermMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的权限资源对象。
|
||||
*
|
||||
* @param perm 新增的权限资源对象。
|
||||
* @return 新增后的权限资源对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysPerm saveNew(SysPerm perm) {
|
||||
perm.setPermId(idGenerator.nextLongId());
|
||||
MyModelUtil.fillCommonsForInsert(perm);
|
||||
perm.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
sysPermMapper.insert(perm);
|
||||
return perm;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限资源对象。
|
||||
*
|
||||
* @param perm 更新的权限资源对象。
|
||||
* @param originalPerm 原有的权限资源对象。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysPerm perm, SysPerm originalPerm) {
|
||||
MyModelUtil.fillCommonsForUpdate(perm, originalPerm);
|
||||
return sysPermMapper.updateById(perm) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除权限资源。
|
||||
*
|
||||
* @param permId 权限资源主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long permId) {
|
||||
if (sysPermMapper.deleteById(permId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysPermCodePerm permCodePerm = new SysPermCodePerm();
|
||||
permCodePerm.setPermId(permId);
|
||||
sysPermCodePermMapper.delete(new QueryWrapper<>(permCodePerm));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限数据列表。
|
||||
*
|
||||
* @param sysPermFilter 过滤对象。
|
||||
* @return 权限列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysPerm> getPermListWithRelation(SysPerm sysPermFilter) {
|
||||
QueryWrapper<SysPerm> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc(this.safeMapToColumnName("showOrder"));
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(sysPermFilter.getModuleId()),
|
||||
this.safeMapToColumnName("moduleId"), sysPermFilter.getModuleId());
|
||||
queryWrapper.like(ObjectUtil.isNotNull(sysPermFilter.getUrl()),
|
||||
this.safeMapToColumnName("url"), "%" + sysPermFilter.getUrl() + "%");
|
||||
List<SysPerm> permList = sysPermMapper.selectList(queryWrapper);
|
||||
// 这里因为权限只有字典数据,所以仅仅做字典关联。
|
||||
this.buildRelationForDataList(permList, MyRelationParam.dictOnly());
|
||||
return permList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取与指定用户关联的权限资源列表,已去重。
|
||||
*
|
||||
* @param userId 关联的用户主键Id。
|
||||
* @return 与指定用户Id关联的权限资源列表。
|
||||
*/
|
||||
@Override
|
||||
public Collection<String> getPermListByUserId(Long userId) {
|
||||
List<String> urlList = sysPermMapper.getPermListByUserId(userId);
|
||||
return new HashSet<>(urlList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证权限资源对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysPerm 当前操作的对象。
|
||||
* @param originalSysPerm 原有对象。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(SysPerm sysPerm, SysPerm originalSysPerm) {
|
||||
if (this.needToVerify(sysPerm, originalSysPerm, SysPerm::getModuleId)) {
|
||||
SysPermModule permModule = sysPermModuleService.getById(sysPerm.getModuleId());
|
||||
if (permModule == null) {
|
||||
return CallResult.error("数据验证失败,关联的权限模块Id并不存在,请刷新后重试!");
|
||||
}
|
||||
}
|
||||
return CallResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的用户列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param loginName 登录名。
|
||||
* @return 包含从权限资源到用户的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysUserListWithDetail(Long permId, String loginName) {
|
||||
return sysPermMapper.getSysUserListWithDetail(permId, loginName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的角色列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param roleName 角色名。
|
||||
* @return 包含从权限资源到角色的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysRoleListWithDetail(Long permId, String roleName) {
|
||||
return sysPermMapper.getSysRoleListWithDetail(permId, roleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询权限资源地址的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param permId 权限资源Id。
|
||||
* @param menuName 菜单名。
|
||||
* @return 包含从权限资源到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysMenuListWithDetail(Long permId, String menuName) {
|
||||
return sysPermMapper.getSysMenuListWithDetail(permId, menuName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysPermWhitelistMapper;
|
||||
import com.orangeforms.upmsservice.model.SysPermWhitelist;
|
||||
import com.orangeforms.upmsservice.service.SysPermWhitelistService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 白名单数据服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysPermWhitelistService")
|
||||
public class SysPermWhitelistServiceImpl extends BaseService<SysPermWhitelist, String> implements SysPermWhitelistService {
|
||||
|
||||
@Autowired
|
||||
private SysPermWhitelistMapper sysPermWhitelistMapper;
|
||||
|
||||
/**
|
||||
* 返回主对象的Mapper对象。
|
||||
*
|
||||
* @return 主对象的Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysPermWhitelist> mapper() {
|
||||
return sysPermWhitelistMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取白名单权限资源的列表。
|
||||
*
|
||||
* @return 白名单权限资源地址列表。
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWhitelistPermList() {
|
||||
List<SysPermWhitelist> dataList = this.getAllList();
|
||||
Function<SysPermWhitelist, String> getterFunc = SysPermWhitelist::getPermUrl;
|
||||
return dataList.stream()
|
||||
.filter(x -> getterFunc.apply(x) != null).map(getterFunc).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.util.MyModelUtil;
|
||||
import com.orangeforms.common.core.object.CallResult;
|
||||
import com.orangeforms.upmsservice.dao.SysRoleMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysRoleMenuMapper;
|
||||
import com.orangeforms.upmsservice.dao.SysUserRoleMapper;
|
||||
import com.orangeforms.upmsservice.model.SysRole;
|
||||
import com.orangeforms.upmsservice.model.SysRoleMenu;
|
||||
import com.orangeforms.upmsservice.model.SysUserRole;
|
||||
import com.orangeforms.upmsservice.service.SysMenuService;
|
||||
import com.orangeforms.upmsservice.service.SysRoleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 角色数据服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysRoleService")
|
||||
public class SysRoleServiceImpl extends BaseService<SysRole, Long> implements SysRoleService {
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
@Autowired
|
||||
private SysRoleMenuMapper sysRoleMenuMapper;
|
||||
@Autowired
|
||||
private SysUserRoleMapper sysUserRoleMapper;
|
||||
@Autowired
|
||||
private SysMenuService sysMenuService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回主对象的Mapper对象。
|
||||
*
|
||||
* @return 主对象的Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysRole> mapper() {
|
||||
return sysRoleMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的角色对象。
|
||||
*
|
||||
* @param role 新增的角色对象。
|
||||
* @param menuIdSet 菜单Id列表。
|
||||
* @return 新增后的角色对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysRole saveNew(SysRole role, Set<Long> menuIdSet) {
|
||||
role.setRoleId(idGenerator.nextLongId());
|
||||
role.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(role);
|
||||
sysRoleMapper.insert(role);
|
||||
if (menuIdSet != null) {
|
||||
for (Long menuId : menuIdSet) {
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(role.getRoleId());
|
||||
roleMenu.setMenuId(menuId);
|
||||
sysRoleMenuMapper.insert(roleMenu);
|
||||
}
|
||||
}
|
||||
return role;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色对象。
|
||||
*
|
||||
* @param role 更新的角色对象。
|
||||
* @param originalRole 原有的角色对象。
|
||||
* @param menuIdSet 菜单Id列表。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysRole role, SysRole originalRole, Set<Long> menuIdSet) {
|
||||
MyModelUtil.fillCommonsForUpdate(role, originalRole);
|
||||
if (sysRoleMapper.updateById(role) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysRoleMenu deletedRoleMenu = new SysRoleMenu();
|
||||
deletedRoleMenu.setRoleId(role.getRoleId());
|
||||
sysRoleMenuMapper.delete(new QueryWrapper<>(deletedRoleMenu));
|
||||
if (menuIdSet != null) {
|
||||
for (Long menuId : menuIdSet) {
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(role.getRoleId());
|
||||
roleMenu.setMenuId(menuId);
|
||||
sysRoleMenuMapper.insert(roleMenu);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定角色。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @return 删除成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long roleId) {
|
||||
if (sysRoleMapper.deleteById(roleId) != 1) {
|
||||
return false;
|
||||
}
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(roleId);
|
||||
sysRoleMenuMapper.delete(new QueryWrapper<>(roleMenu));
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(roleId);
|
||||
sysUserRoleMapper.delete(new QueryWrapper<>(userRole));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色列表。
|
||||
*
|
||||
* @param filter 角色过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 角色列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> getSysRoleList(SysRole filter, String orderBy) {
|
||||
return sysRoleMapper.getSysRoleList(filter, orderBy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUserRole> getSysUserRoleListByUserId(Long userId) {
|
||||
SysUserRole filter = new SysUserRole();
|
||||
filter.setUserId(userId);
|
||||
return sysUserRoleMapper.selectList(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增用户角色关联。
|
||||
*
|
||||
* @param userRoleList 用户角色关系数据列表。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void addUserRoleList(List<SysUserRole> userRoleList) {
|
||||
for (SysUserRole userRole : userRoleList) {
|
||||
sysUserRoleMapper.insert(userRole);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除指定用户和指定角色的关联关系。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param userId 用户主键Id。
|
||||
* @return 移除成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeUserRole(Long roleId, Long userId) {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setRoleId(roleId);
|
||||
userRole.setUserId(userId);
|
||||
return sysUserRoleMapper.delete(new QueryWrapper<>(userRole)) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证角色对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysRole 当前操作的对象。
|
||||
* @param originalSysRole 原有对象。
|
||||
* @param menuIdListString 逗号分隔的menuId列表。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(SysRole sysRole, SysRole originalSysRole, String menuIdListString) {
|
||||
JSONObject jsonObject = null;
|
||||
if (StringUtils.isNotBlank(menuIdListString)) {
|
||||
Set<Long> menuIdSet = Arrays.stream(
|
||||
menuIdListString.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysMenuService.existAllPrimaryKeys(menuIdSet)) {
|
||||
return CallResult.error("数据验证失败,存在不合法的菜单权限,请刷新后重试!");
|
||||
}
|
||||
jsonObject = new JSONObject();
|
||||
jsonObject.put("menuIdSet", menuIdSet);
|
||||
}
|
||||
return CallResult.ok(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 包含从角色到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysPermListWithDetail(Long roleId, String url) {
|
||||
return sysRoleMapper.getSysPermListWithDetail(roleId, url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询角色的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param roleId 角色Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 包含从角色到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysPermCodeListWithDetail(Long roleId, String permCode) {
|
||||
return sysRoleMapper.getSysPermCodeListWithDetail(roleId, permCode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
package com.orangeforms.upmsservice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orangeforms.upmsservice.service.*;
|
||||
import com.orangeforms.upmsservice.dao.*;
|
||||
import com.orangeforms.upmsservice.model.*;
|
||||
import com.orangeforms.common.core.util.*;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orangeforms.common.core.base.dao.BaseDaoMapper;
|
||||
import com.orangeforms.common.core.base.service.BaseService;
|
||||
import com.orangeforms.common.sequence.wrapper.IdGeneratorWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.orangeforms.upmsapi.constant.SysUserStatus;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户管理数据操作服务类。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("sysUserService")
|
||||
public class SysUserServiceImpl extends BaseService<SysUser, Long> implements SysUserService {
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private SysUserRoleMapper sysUserRoleMapper;
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private SysDataPermService sysDataPermService;
|
||||
@Autowired
|
||||
private SysDataPermUserMapper sysDataPermUserMapper;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
@Autowired
|
||||
private IdGeneratorWrapper idGenerator;
|
||||
|
||||
/**
|
||||
* 返回当前Service的主表Mapper对象。
|
||||
*
|
||||
* @return 主表Mapper对象。
|
||||
*/
|
||||
@Override
|
||||
protected BaseDaoMapper<SysUser> mapper() {
|
||||
return sysUserMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定登录名的用户对象。
|
||||
*
|
||||
* @param loginName 指定登录用户名。
|
||||
* @return 用户对象。
|
||||
*/
|
||||
@Override
|
||||
public SysUser getSysUserByLoginName(String loginName) {
|
||||
SysUser filter = new SysUser();
|
||||
filter.setLoginName(loginName);
|
||||
return sysUserMapper.selectOne(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增的用户对象。
|
||||
*
|
||||
* @param user 新增的用户对象。
|
||||
* @param roleIdSet 用户角色Id集合。
|
||||
* @param dataPermIdSet 数据权限Id集合。
|
||||
* @return 新增后的用户对象。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public SysUser saveNew(SysUser user, Set<Long> roleIdSet, Set<Long> dataPermIdSet) {
|
||||
user.setUserId(idGenerator.nextLongId());
|
||||
user.setUserStatus(SysUserStatus.STATUS_NORMAL);
|
||||
user.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||
MyModelUtil.fillCommonsForInsert(user);
|
||||
sysUserMapper.insert(user);
|
||||
if (CollectionUtils.isNotEmpty(roleIdSet)) {
|
||||
for (Long roleId : roleIdSet) {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
sysUserRoleMapper.insert(userRole);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(dataPermIdSet)) {
|
||||
for (Long dataPermId : dataPermIdSet) {
|
||||
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||
dataPermUser.setDataPermId(dataPermId);
|
||||
dataPermUser.setUserId(user.getUserId());
|
||||
sysDataPermUserMapper.insert(dataPermUser);
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户对象。
|
||||
*
|
||||
* @param user 更新的用户对象。
|
||||
* @param originalUser 原有的用户对象。
|
||||
* @param roleIdSet 用户角色Id列表。
|
||||
* @param dataPermIdSet 数据权限Id集合。
|
||||
* @return 更新成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean update(SysUser user, SysUser originalUser, Set<Long> roleIdSet, Set<Long> dataPermIdSet) {
|
||||
user.setLoginName(originalUser.getLoginName());
|
||||
MyModelUtil.fillCommonsForUpdate(user, originalUser);
|
||||
UpdateWrapper<SysUser> uw = this.createUpdateQueryForNullValue(user, user.getUserId());
|
||||
if (sysUserMapper.update(user, uw) != 1) {
|
||||
return false;
|
||||
}
|
||||
// 先删除原有的User-Role关联关系,再重新插入新的关联关系
|
||||
SysUserRole deletedUserRole = new SysUserRole();
|
||||
deletedUserRole.setUserId(user.getUserId());
|
||||
sysUserRoleMapper.delete(new QueryWrapper<>(deletedUserRole));
|
||||
if (CollectionUtils.isNotEmpty(roleIdSet)) {
|
||||
for (Long roleId : roleIdSet) {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(user.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
sysUserRoleMapper.insert(userRole);
|
||||
}
|
||||
}
|
||||
// 先删除原有的DataPerm-User关联关系,在重新插入新的关联关系
|
||||
SysDataPermUser deletedDataPermUser = new SysDataPermUser();
|
||||
deletedDataPermUser.setUserId(user.getUserId());
|
||||
sysDataPermUserMapper.delete(new QueryWrapper<>(deletedDataPermUser));
|
||||
if (CollectionUtils.isNotEmpty(dataPermIdSet)) {
|
||||
for (Long dataPermId : dataPermIdSet) {
|
||||
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||
dataPermUser.setDataPermId(dataPermId);
|
||||
dataPermUser.setUserId(user.getUserId());
|
||||
sysDataPermUserMapper.insert(dataPermUser);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定数据。
|
||||
*
|
||||
* @param userId 主键Id。
|
||||
* @return 成功返回true,否则false。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(Long userId) {
|
||||
if (sysUserMapper.deleteById(userId) == 0) {
|
||||
return false;
|
||||
}
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(userId);
|
||||
sysUserRoleMapper.delete(new QueryWrapper<>(userRole));
|
||||
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||
dataPermUser.setUserId(userId);
|
||||
sysDataPermUserMapper.delete(new QueryWrapper<>(dataPermUser));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysUserListWithRelation)方法。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getSysUserList(SysUser filter, String orderBy) {
|
||||
return sysUserMapper.getSysUserList(null, null, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||
* 如果需要同时获取关联数据,请移步(getSysUserListWithRelation)方法。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public <M> List<SysUser> getSysUserList(
|
||||
String inFilterField, Set<M> inFilterValues, SysUser filter, String orderBy) {
|
||||
String inFilterColumn = MyModelUtil.mapToColumnName(inFilterField, SysUser.class);
|
||||
return sysUserMapper.getSysUserList(inFilterColumn, inFilterValues, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysUserList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getSysUserListWithRelation(SysUser filter, String orderBy) {
|
||||
List<SysUser> resultList = sysUserMapper.getSysUserList(null, null, filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||
* 同时还包含主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||
* 如果仅仅需要获取主表数据,请移步(getSysUserList),以便获取更好的查询性能。
|
||||
*
|
||||
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||
* @param filter 主表过滤对象。
|
||||
* @param orderBy 排序对象。
|
||||
* @return 查询结果集。
|
||||
*/
|
||||
@Override
|
||||
public <M> List<SysUser> getSysUserListWithRelation(
|
||||
String inFilterField, Set<M> inFilterValues, SysUser filter, String orderBy) {
|
||||
String inFilterColumn = MyModelUtil.mapToColumnName(inFilterField, SysUser.class);
|
||||
List<SysUser> resultList =
|
||||
sysUserMapper.getSysUserList(inFilterColumn, inFilterValues, filter, orderBy);
|
||||
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly(), batchSize);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定角色的用户列表。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getSysUserListByRoleId(Long roleId, SysUser filter, String orderBy) {
|
||||
return sysUserMapper.getSysUserListByRoleId(roleId, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取不属于指定角色的用户列表。
|
||||
*
|
||||
* @param roleId 角色主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getNotInSysUserListByRoleId(Long roleId, SysUser filter, String orderBy) {
|
||||
return sysUserMapper.getNotInSysUserListByRoleId(roleId, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定数据权限的用户列表。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getSysUserListByDataPermId(Long dataPermId, SysUser filter, String orderBy) {
|
||||
return sysUserMapper.getSysUserListByDataPermId(dataPermId, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取不属于指定数据权限的用户列表。
|
||||
*
|
||||
* @param dataPermId 数据权限主键Id。
|
||||
* @param filter 用户过滤对象。
|
||||
* @param orderBy 排序参数。
|
||||
* @return 用户列表。
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> getNotInSysUserListByDataPermId(Long dataPermId, SysUser filter, String orderBy) {
|
||||
return sysUserMapper.getNotInSysUserListByDataPermId(dataPermId, filter, orderBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的权限资源地址列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param url url过滤条件。
|
||||
* @return 包含从用户到权限资源的完整权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysPermListWithDetail(Long userId, String url) {
|
||||
return sysUserMapper.getSysPermListWithDetail(userId, url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的权限字列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param permCode 权限字名称过滤条件。
|
||||
* @return 包含从用户到权限字的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysPermCodeListWithDetail(Long userId, String permCode) {
|
||||
return sysUserMapper.getSysPermCodeListWithDetail(userId, permCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的菜单列表。同时返回详细的分配路径。
|
||||
*
|
||||
* @param userId 用户Id。
|
||||
* @param menuName 菜单名称过滤条件。
|
||||
* @return 包含从用户到菜单的权限分配路径信息的查询结果列表。
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getSysMenuListWithDetail(Long userId, String menuName) {
|
||||
return sysUserMapper.getSysMenuListWithDetail(userId, menuName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户对象关联的数据是否都合法。
|
||||
*
|
||||
* @param sysUser 当前操作的对象。
|
||||
* @param originalSysUser 原有对象。
|
||||
* @param roleIds 逗号分隔的角色Id列表字符串。
|
||||
* @param dataPermIds 逗号分隔的数据权限Id列表字符串。
|
||||
* @return 验证结果。
|
||||
*/
|
||||
@Override
|
||||
public CallResult verifyRelatedData(
|
||||
SysUser sysUser, SysUser originalSysUser, String roleIds, String dataPermIds) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if (StringUtils.isBlank(roleIds)) {
|
||||
return CallResult.error("数据验证失败,用户的角色数据不能为空!");
|
||||
}
|
||||
Set<Long> roleIdSet = Arrays.stream(
|
||||
roleIds.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysRoleService.existAllPrimaryKeys(roleIdSet)) {
|
||||
return CallResult.error("数据验证失败,存在不合法的用户角色,请刷新后重试!");
|
||||
}
|
||||
jsonObject.put("roleIdSet", roleIdSet);
|
||||
if (StringUtils.isBlank(dataPermIds)) {
|
||||
return CallResult.error("数据验证失败,用户的数据权限不能为空!");
|
||||
}
|
||||
Set<Long> dataPermIdSet = Arrays.stream(
|
||||
dataPermIds.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||
if (!sysDataPermService.existAllPrimaryKeys(dataPermIdSet)) {
|
||||
return CallResult.error("数据验证失败,存在不合法的数据权限,请刷新后重试!");
|
||||
}
|
||||
jsonObject.put("dataPermIdSet", dataPermIdSet);
|
||||
if (this.needToVerify(sysUser, originalSysUser, SysUser::getDeptId)
|
||||
&& !sysDeptService.existId(sysUser.getDeptId())) {
|
||||
return CallResult.error("数据验证失败,关联的用户部门Id并不存在,请刷新后重试!");
|
||||
}
|
||||
return CallResult.ok(jsonObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
spring:
|
||||
application:
|
||||
name: upms
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: localhost:8848
|
||||
config:
|
||||
server-addr: localhost:8848
|
||||
file-extension: yaml
|
||||
# 共享配置文件,排序越高后,优先级越高。
|
||||
shared-configs:
|
||||
- data-id: application-dev.yaml
|
||||
group: DEFAULT_GROUP
|
||||
refresh: true
|
||||
sentinel:
|
||||
eager: true
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: localhost:8848
|
||||
data-id: ${spring.application.name}-dev-sentinel
|
||||
group-id: DEFAULT_GROUP
|
||||
data-type: json
|
||||
# 如果是降级服务,需要改为degrade
|
||||
rule-type: flow
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- 本项目全部使用log4j2性能上有很大提升 -->
|
||||
|
||||
<!--monitorInterval="60" 自动检测配置文件更改时间 单位为秒 最小值为5 -->
|
||||
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出。 -->
|
||||
<configuration monitorInterval="20" status="OFF">
|
||||
<!--日志变量 -->
|
||||
<properties>
|
||||
<!-- 日志主目录 ,需要保存到文件时请自己配置-->
|
||||
<property name="LOG_HOME">./zzlogs/upms</property>
|
||||
<!-- 日志备份目录 -->
|
||||
<property name="BACKUP_HOME">./zzlogs/upms/backup</property>
|
||||
<!-- 日志输出级别 -->
|
||||
<property name="OUTPUT_LOG_LEVEL">info</property>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="LOG_PATTERN">
|
||||
<!-- 输出格式%d{HH:mm:ss}时间24小时制 -->
|
||||
<!-- %-5p日志级别 5位左对齐 [%t]线程名 [%c]类名 -->
|
||||
<!--%l:输出日志事件的发生位置,相当于%c.%M(%F:%L)的组合,包括类全名、方法、文件名以及在代码中的行数。例如:test.TestLog4j.main(TestLog4j.java:10)。 -->
|
||||
<!-- 另一种输出风格<PatternLayout pattern="级别%-5p [%d{YYYY-MM-dd HH:mm:ss}] [%t] 位置[%l] - 信息:%msg%n" /> -->
|
||||
<!-- [%-5p][%d{yy-MM-dd HH:mm:ss}][%t]==>%m==>%c==>%L%n -->
|
||||
[%-5p] [%d{YYYY-MM-dd HH:mm:ss}] [%t] ==> %msg%n
|
||||
</property>
|
||||
<property name="LOG_PATTERN_EX">
|
||||
<!-- 下面注释中 %traceid 为SkyWalking 中的traceid -->
|
||||
[%-5p] [%d{YYYY-MM-dd HH:mm:ss}] T:[%X{traceId}] S:[%X{sessionId}] U:[%X{userId}] [%t] ==> [%traceId] %msg%n
|
||||
</property>
|
||||
<!-- 日志保留天数 -->
|
||||
<property name="EVERY_FILE_COUNT">31</property>
|
||||
<!-- 日志切割的最小单位 -->
|
||||
<property name="EVERY_FILE_SIZE">20M</property>
|
||||
</properties>
|
||||
|
||||
<appenders>
|
||||
<!--Kafka输出 -->
|
||||
<Kafka name="kafka_log" topic="zz-log-topic" syncSend="false" ignoreExceptions="false">
|
||||
<PatternLayout pattern="${LOG_PATTERN_EX}"/>
|
||||
<Property name="bootstrap.servers">localhost:9092</Property>
|
||||
<Property name="max.block.ms">10000</Property>
|
||||
</Kafka>
|
||||
<!--控制台输出 -->
|
||||
<console name="console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||
</console>
|
||||
<!--每次大小超过size,则这size大小的日志会自动进行压缩,作为存档 -->
|
||||
<rollingFile name="file_log" fileName="${LOG_HOME}/upms.log"
|
||||
filePattern="${LOG_HOME}/upms-%d{yyyy-MM-dd}-%i.log.gz">
|
||||
<PatternLayout charset="UTF-8" pattern="${LOG_PATTERN_EX}"/>
|
||||
<!-- 日志切割的最小单位 -->
|
||||
<SizeBasedTriggeringPolicy size="${EVERY_FILE_SIZE}"/>
|
||||
<!-- 默认的日志文件数量 -->
|
||||
<DefaultRolloverStrategy max="${EVERY_FILE_COUNT}"/>
|
||||
</rollingFile>
|
||||
</appenders>
|
||||
|
||||
<!-- 然后定义logger,只有定义了logger并引入的appender,appender才会生效 -->
|
||||
<!-- 这里我们把输出到控制台appender的日志级别设置为DEBUG,便于调试。但是输出文件我们缺省为INFO,两者均可随时修改。-->
|
||||
<Loggers>
|
||||
<Root level="${OUTPUT_LOG_LEVEL}">
|
||||
<AppenderRef ref="console"/>
|
||||
</Root>
|
||||
<Logger name="springfox.documentation" additivity="false" level="error">
|
||||
<AppenderRef ref="console"/>
|
||||
</Logger>
|
||||
<!-- AsyncLogger 是基于Disruptor的全量异步队列,性能极高,队列默认大小4096。-->
|
||||
<!-- 队列默认值可通过JVM参数设置,参考博客:https://www.jianshu.com/p/82469047acbf -->
|
||||
<AsyncLogger name="com.orangeforms" additivity="false" level="info">
|
||||
<AppenderRef ref="console"/>
|
||||
<AppenderRef ref="kafka_log"/>
|
||||
<AppenderRef ref="file_log"/>
|
||||
</AsyncLogger>
|
||||
<!-- 这里将dao的日志级别设置为DEBUG,是为了SQL语句的输出 -->
|
||||
<AsyncLogger name="com.orangeforms.upmsservice.dao" additivity="false" level="debug">
|
||||
<AppenderRef ref="console"/>
|
||||
<AppenderRef ref="kafka_log"/>
|
||||
<AppenderRef ref="file_log"/>
|
||||
</AsyncLogger>
|
||||
<AsyncLogger name="com.orangeforms.common.log.dao" additivity="false" level="debug">
|
||||
<AppenderRef ref="console"/>
|
||||
<AppenderRef ref="kafka_log"/>
|
||||
<AppenderRef ref="file_log"/>
|
||||
</AsyncLogger>
|
||||
</Loggers>
|
||||
</configuration>
|
||||
@@ -0,0 +1,296 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
<webroots />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="upms-api" />
|
||||
<orderEntry type="module" module-name="common-core" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.45" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.45" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-jre" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-csv:1.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.6.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.76" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.8.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.jimmyshi:bean-query:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-all:1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||
<orderEntry type="module" module-name="common-datafilter" />
|
||||
<orderEntry type="module" module-name="application-common" />
|
||||
<orderEntry type="module" module-name="common-swagger" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-micro-spring-boot-starter:2.0.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring:2.0.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-annotations:2.0.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-core:2.0.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.25.0-GA" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.classgraph:classgraph:4.1.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:2.10.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-webmvc:2.10.5" level="project" />
|
||||
<orderEntry type="module" module-name="common-log" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.5.12.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="module" module-name="common-redis" />
|
||||
<orderEntry type="library" name="Maven: org.redisson:redisson:3.15.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-resolver-dns:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-codec-dns:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.63.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.cache:cache-api:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.16.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.reactivex.rxjava3:rxjava:3.0.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling-river:2.0.11.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling:2.0.11.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jodd:jodd-bean:5.1.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jodd:jodd-core:5.1.6" level="project" />
|
||||
<orderEntry type="module" module-name="common-sequence" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-commons:2.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:1.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-common:1.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-api:1.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.3.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon:2.3.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.ribbon:ribbon-transport:2.3.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-contexts:0.4.9" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-servo:0.4.9" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.inject:javax.inject:1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty:0.4.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-core:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-httpclient:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-client:1.19.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-core:1.19.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey.contribs:jersey-apache-client4:1.19.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.servo:servo-core:0.12.21" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-commons-util:0.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-loadbalancer:2.3.0" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-statistics:0.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.reactivex:rxjava:1.3.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel:2.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-transport-simple-http:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-transport-common:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-annotation-aspectj:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-core:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.9.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-circuitbreaker-sentinel:2.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-reactor-adapter:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-spring-webflux-adapter:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-spring-webmvc-adapter:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-parameter-flow-control:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-cluster-server-default:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-cluster-common-default:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-cluster-client-default:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-sentinel-datasource:2.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-datasource-nacos:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-datasource-extension:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-freemarker:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-log4j2:2.6.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.15.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-jul:2.15.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.15.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.15.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.12" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-starter-client:2.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-client:2.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.59" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.59" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:10.10.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:10.10.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-hystrix:10.10.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.archaius:archaius-core:0.7.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.github.openfeign:feign-httpclient:10.10.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-core:1.5.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-serialization:1.5.18" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: com.fasterxml.jackson.module:jackson-module-afterburner:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-metrics-event-stream:1.5.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-javanica:1.5.18" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.reactivex:rxjava-reactive-streams:1.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.4.2.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mapstruct:mapstruct-processor:1.4.2.Final" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:4.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.curator:curator-framework:4.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.curator:curator-client:4.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.5.3-beta" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-cli:commons-cli:1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.3-1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.12.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.lmax:disruptor:3.4.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.skywalking:apm-toolkit-log4j-2.x:7.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user