mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
重命名 orange-demo-uaa 为 orange-demo-multi-uaa
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?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>application</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>upms</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>upms-api</module>
|
||||
<module>upms-service</module>
|
||||
</modules>
|
||||
</project>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>upms-api</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>common-datafilter</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- 通用业务依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>application-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- knife4j 接口文档框架 -->
|
||||
<dependency>
|
||||
<groupId>com.orangeforms</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.orangeforms.upmsapi.client;
|
||||
|
||||
import com.orangeforms.common.core.base.client.BaseFallbackFactory;
|
||||
import com.orangeforms.common.core.config.FeignConfig;
|
||||
import com.orangeforms.common.core.base.client.BaseClient;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.upmsapi.dto.SysDeptDto;
|
||||
import com.orangeforms.upmsapi.vo.SysDeptVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门管理服务远程数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(
|
||||
name = "upms",
|
||||
configuration = FeignConfig.class,
|
||||
fallbackFactory = SysDeptClient.SysDeptClientFallbackFactory.class)
|
||||
public interface SysDeptClient extends BaseClient<SysDeptDto, SysDeptVo, Long> {
|
||||
|
||||
/**
|
||||
* 基于主键的(In-list)条件获取远程数据接口。
|
||||
*
|
||||
* @param deptIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象的数据集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/listByIds")
|
||||
ResponseResult<List<SysDeptVo>> listByIds(
|
||||
@RequestParam("deptIds") Set<Long> deptIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 基于主键Id,获取远程对象。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/getById")
|
||||
ResponseResult<SysDeptVo> getById(
|
||||
@RequestParam("deptId") Long deptId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否都存在。
|
||||
*
|
||||
* @param deptIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/existIds")
|
||||
ResponseResult<Boolean> existIds(@RequestParam("deptIds") Set<Long> deptIds);
|
||||
|
||||
/**
|
||||
* 判断主键Id是否存在。
|
||||
*
|
||||
* @param deptId 参数主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("deptId") Long deptId);
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象列表的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param data 数据对象。
|
||||
* 主键有值是视为更新操作的数据比对,因此仅当关联Id变化时才会验证。
|
||||
* 主键为空视为新增操作的数据比对,所有关联Id都会被验证。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/verifyRelatedData")
|
||||
ResponseResult<Void> verifyRelatedData(@RequestBody SysDeptDto data);
|
||||
|
||||
/**
|
||||
* 根据最新对象列表和原有对象列表的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param dataList 数据对象列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/verifyRelatedDataList")
|
||||
ResponseResult<Void> verifyRelatedDataList(@RequestBody List<SysDeptDto> dataList);
|
||||
|
||||
/**
|
||||
* 删除主键Id关联的对象。
|
||||
*
|
||||
* @param deptId 主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/deleteById")
|
||||
ResponseResult<Integer> deleteById(@RequestParam("deptId") Long deptId);
|
||||
|
||||
/**
|
||||
* 删除符合过滤条件的数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 应答结果对象,包含删除数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/deleteBy")
|
||||
ResponseResult<Integer> deleteBy(@RequestBody SysDeptDto filter);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/listBy")
|
||||
ResponseResult<MyPageData<SysDeptVo>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/getBy")
|
||||
ResponseResult<SysDeptVo> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
* 和listBy接口相比,以Map列表的方式返回的主要目的是,降低服务之间的耦合度。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/listMapBy")
|
||||
ResponseResult<MyPageData<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/countBy")
|
||||
ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysDept/aggregateBy")
|
||||
ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam);
|
||||
|
||||
@Component("UpmsSysDeptClientFallbackFactory")
|
||||
@Slf4j
|
||||
class SysDeptClientFallbackFactory
|
||||
extends BaseFallbackFactory<SysDeptDto, SysDeptVo, Long, SysDeptClient> implements SysDeptClient {
|
||||
|
||||
@Override
|
||||
public SysDeptClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new SysDeptClientFallbackFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.orangeforms.upmsapi.client;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orangeforms.common.core.base.client.BaseFallbackFactory;
|
||||
import com.orangeforms.common.core.config.FeignConfig;
|
||||
import com.orangeforms.common.core.base.client.BaseClient;
|
||||
import com.orangeforms.common.core.constant.ErrorCodeEnum;
|
||||
import com.orangeforms.common.core.object.*;
|
||||
import com.orangeforms.upmsapi.dto.SysUserDto;
|
||||
import com.orangeforms.upmsapi.vo.SysUserVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户管理服务远程数据操作访问接口。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@FeignClient(
|
||||
name = "upms",
|
||||
configuration = FeignConfig.class,
|
||||
fallbackFactory = SysUserClient.SysUserClientFallbackFactory.class)
|
||||
public interface SysUserClient extends BaseClient<SysUserDto, SysUserVo, Long> {
|
||||
|
||||
/**
|
||||
* 基于主键的(In-list)条件获取远程数据接口。
|
||||
*
|
||||
* @param userIds 主键Id集合。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象的数据集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/listByIds")
|
||||
ResponseResult<List<SysUserVo>> listByIds(
|
||||
@RequestParam("userIds") Set<Long> userIds,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 基于主键Id,获取远程对象。
|
||||
*
|
||||
* @param userId 主键Id。
|
||||
* @param withDict 是否包含字典关联。
|
||||
* @return 应答结果对象,包含主对象数据。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/getById")
|
||||
ResponseResult<SysUserVo> getById(
|
||||
@RequestParam("userId") Long userId,
|
||||
@RequestParam("withDict") Boolean withDict);
|
||||
|
||||
/**
|
||||
* 判断参数列表中指定的主键Id,是否都存在。
|
||||
*
|
||||
* @param userIds 主键Id集合。
|
||||
* @return 应答结果对象,包含true全部存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/existIds")
|
||||
ResponseResult<Boolean> existIds(@RequestParam("userIds") Set<Long> userIds);
|
||||
|
||||
/**
|
||||
* 判断主键Id是否存在。
|
||||
*
|
||||
* @param userId 参数主键Id。
|
||||
* @return 应答结果对象,包含true表示存在,否则false。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/existId")
|
||||
ResponseResult<Boolean> existId(@RequestParam("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 根据最新对象和原有对象列表的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param data 数据对象。
|
||||
* 主键有值是视为更新操作的数据比对,因此仅当关联Id变化时才会验证。
|
||||
* 主键为空视为新增操作的数据比对,所有关联Id都会被验证。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/verifyRelatedData")
|
||||
ResponseResult<Void> verifyRelatedData(@RequestBody SysUserDto data);
|
||||
|
||||
/**
|
||||
* 根据最新对象列表和原有对象列表的数据对比,判断关联的字典数据和多对一主表数据是否都是合法数据。
|
||||
*
|
||||
* @param dataList 数据对象列表。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/verifyRelatedDataList")
|
||||
ResponseResult<Void> verifyRelatedDataList(@RequestBody List<SysUserDto> dataList);
|
||||
|
||||
/**
|
||||
* 删除主键Id关联的对象。
|
||||
*
|
||||
* @param userId 主键Id。
|
||||
* @return 应答结果对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/deleteById")
|
||||
ResponseResult<Integer> deleteById(@RequestParam("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 删除符合过滤条件的数据。
|
||||
*
|
||||
* @param filter 过滤对象。
|
||||
* @return 应答结果对象,包含删除数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/deleteBy")
|
||||
ResponseResult<Integer> deleteBy(@RequestBody SysUserDto filter);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/listBy")
|
||||
ResponseResult<MyPageData<SysUserVo>> listBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含实体对象。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/getBy")
|
||||
ResponseResult<SysUserVo> getBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据列表。
|
||||
* 和listBy接口相比,以Map列表的方式返回的主要目的是,降低服务之间的耦合度。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含主对象集合。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/listMapBy")
|
||||
ResponseResult<MyPageData<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程主对象中符合查询条件的数据数量。
|
||||
*
|
||||
* @param queryParam 查询参数。
|
||||
* @return 应答结果对象,包含结果数量。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/countBy")
|
||||
ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||
*
|
||||
* @param aggregationParam 聚合参数。
|
||||
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||
*/
|
||||
@Override
|
||||
@PostMapping("/sysUser/aggregateBy")
|
||||
ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam);
|
||||
|
||||
/**
|
||||
* 获取指定角色Id集合的用户数据集合。
|
||||
* @param roleIds 角色Id集合。
|
||||
* @return 应该结果对象,包含查询后的用户列表。
|
||||
*/
|
||||
@GetMapping("/sysUser/getSysUserListByRoleIds")
|
||||
ResponseResult<List<SysUserVo>> getSysUserListByRoleIds(@RequestParam("roleIds") Set<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 获取指定部门Id集合的用户数据集合。
|
||||
* @param deptIds 部门Id集合。
|
||||
* @return 应该结果对象,包含查询后的用户列表。
|
||||
*/
|
||||
@GetMapping("/sysUser/getSysUserListByDeptIds")
|
||||
ResponseResult<List<SysUserVo>> getSysUserListByDeptIds(@RequestParam("deptIds") Set<Long> deptIds);
|
||||
|
||||
@Component("UpmsSysUserClientFallbackFactory")
|
||||
@Slf4j
|
||||
class SysUserClientFallbackFactory
|
||||
extends BaseFallbackFactory<SysUserDto, SysUserVo, Long, SysUserClient> implements SysUserClient {
|
||||
|
||||
@Override
|
||||
public SysUserClient create(Throwable throwable) {
|
||||
log.error("Exception For Feign Remote Call.", throwable);
|
||||
return new SysUserClientFallbackFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<SysUserVo>> getSysUserListByRoleIds(Set<Long> roleIds) {
|
||||
log.error("Failed to Feign Remote call [getSysUserListByRoleIds] for roleIds {}",
|
||||
JSON.toJSONString(roleIds));
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult<List<SysUserVo>> getSysUserListByDeptIds(Set<Long> deptIds) {
|
||||
log.error("Failed to Feign Remote call [getSysUserListByDeptIds] for deptIds {}",
|
||||
JSON.toJSONString(deptIds));
|
||||
return ResponseResult.error(ErrorCodeEnum.RPC_DATA_ACCESS_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.orangeforms.upmsapi.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单类型常量对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public final class SysMenuType {
|
||||
|
||||
/**
|
||||
* 目录菜单。
|
||||
*/
|
||||
public static final int TYPE_DIRECTORY = 0;
|
||||
/**
|
||||
* 普通菜单。
|
||||
*/
|
||||
public static final int TYPE_MENU = 1;
|
||||
/**
|
||||
* 表单片段类型。
|
||||
*/
|
||||
public static final int TYPE_UI_FRAGMENT = 2;
|
||||
/**
|
||||
* 按钮类型。
|
||||
*/
|
||||
public static final int TYPE_BUTTON = 3;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(4);
|
||||
static {
|
||||
DICT_MAP.put(TYPE_DIRECTORY, "目录菜单");
|
||||
DICT_MAP.put(TYPE_MENU, "普通菜单");
|
||||
DICT_MAP.put(TYPE_UI_FRAGMENT, "表单片段类型");
|
||||
DICT_MAP.put(TYPE_BUTTON, "按钮类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private SysMenuType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orangeforms.upmsapi.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单关联在线表单的控制权限类型。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public final class SysOnlineMenuPermType {
|
||||
|
||||
/**
|
||||
* 查看。
|
||||
*/
|
||||
public static final int TYPE_VIEW = 0;
|
||||
/**
|
||||
* 编辑。
|
||||
*/
|
||||
public static final int TYPE_EDIT = 1;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(4);
|
||||
static {
|
||||
DICT_MAP.put(TYPE_VIEW, "查看");
|
||||
DICT_MAP.put(TYPE_EDIT, "编辑");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private SysOnlineMenuPermType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orangeforms.upmsapi.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 权限字类型常量对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public final class SysPermCodeType {
|
||||
|
||||
/**
|
||||
* 表单权限字。
|
||||
*/
|
||||
public static final int TYPE_FORM = 0;
|
||||
/**
|
||||
* 表单片段布局权限字。
|
||||
*/
|
||||
public static final int TYPE_FRAGMENT = 1;
|
||||
/**
|
||||
* 操作权限字。
|
||||
*/
|
||||
public static final int TYPE_OPERATION = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(TYPE_FORM, "表单权限字");
|
||||
DICT_MAP.put(TYPE_FRAGMENT, "表单片段布局权限字");
|
||||
DICT_MAP.put(TYPE_OPERATION, "操作权限字");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private SysPermCodeType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orangeforms.upmsapi.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 权限资源模块类型常量对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public final class SysPermModuleType {
|
||||
|
||||
/**
|
||||
* 普通模块。
|
||||
*/
|
||||
public static final int TYPE_NORMAL = 0;
|
||||
/**
|
||||
* controller接口模块。
|
||||
*/
|
||||
public static final int TYPE_CONTROLLER = 1;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
|
||||
static {
|
||||
DICT_MAP.put(TYPE_NORMAL, "普通模块");
|
||||
DICT_MAP.put(TYPE_CONTROLLER, "controller接口模块");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private SysPermModuleType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orangeforms.upmsapi.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户状态常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public final class SysUserStatus {
|
||||
|
||||
/**
|
||||
* 正常状态。
|
||||
*/
|
||||
public static final int STATUS_NORMAL = 0;
|
||||
/**
|
||||
* 锁定状态。
|
||||
*/
|
||||
public static final int STATUS_LOCKED = 1;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(2);
|
||||
static {
|
||||
DICT_MAP.put(STATUS_NORMAL, "正常状态");
|
||||
DICT_MAP.put(STATUS_LOCKED, "锁定状态");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private SysUserStatus() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orangeforms.upmsapi.constant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户类型常量字典对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public final class SysUserType {
|
||||
|
||||
/**
|
||||
* 管理员。
|
||||
*/
|
||||
public static final int TYPE_ADMIN = 0;
|
||||
/**
|
||||
* 系统操作员。
|
||||
*/
|
||||
public static final int TYPE_SYSTEM = 1;
|
||||
/**
|
||||
* 普通操作员。
|
||||
*/
|
||||
public static final int TYPE_OPERATOR = 2;
|
||||
|
||||
private static final Map<Object, String> DICT_MAP = new HashMap<>(3);
|
||||
static {
|
||||
DICT_MAP.put(TYPE_ADMIN, "管理员");
|
||||
DICT_MAP.put(TYPE_SYSTEM, "系统操作员");
|
||||
DICT_MAP.put(TYPE_OPERATOR, "普通操作员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断参数是否为当前常量字典的合法值。
|
||||
*
|
||||
* @param value 待验证的参数值。
|
||||
* @return 合法返回true,否则false。
|
||||
*/
|
||||
public static boolean isValid(Integer value) {
|
||||
return value != null && DICT_MAP.containsKey(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私有构造函数,明确标识该常量类的作用。
|
||||
*/
|
||||
private SysUserType() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据权限与部门关联Dto。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("数据权限与部门关联Dto")
|
||||
@Data
|
||||
public class SysDataPermDeptDto {
|
||||
|
||||
/**
|
||||
* 数据权限Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "数据权限Id", required = true)
|
||||
private Long dataPermId;
|
||||
|
||||
/**
|
||||
* 关联部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "关联部门Id", required = true)
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.core.validator.ConstDictRef;
|
||||
import com.orangeforms.common.datafilter.constant.DataPermRuleType;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 数据权限Dto。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("数据权限Dto")
|
||||
@Data
|
||||
public class SysDataPermDto {
|
||||
|
||||
/**
|
||||
* 数据权限Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "数据权限Id", required = true)
|
||||
@NotNull(message = "数据权限Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long dataPermId;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示名称", required = true)
|
||||
@NotBlank(message = "数据权限名称不能为空!")
|
||||
private String dataPermName;
|
||||
|
||||
/**
|
||||
* 数据权限规则类型(0: 全部可见 1: 只看自己 2: 只看本部门 3: 本部门及子部门 4: 多部门及子部门 5: 自定义部门列表)。
|
||||
*/
|
||||
@ApiModelProperty(value = "数据权限规则类型", required = true)
|
||||
@NotNull(message = "数据权限规则类型不能为空!")
|
||||
@ConstDictRef(constDictClass = DataPermRuleType.class)
|
||||
private Integer ruleType;
|
||||
|
||||
/**
|
||||
* 部门Id列表(逗号分隔)。
|
||||
*/
|
||||
@ApiModelProperty(hidden = true)
|
||||
private String deptIdListString;
|
||||
|
||||
/**
|
||||
* 搜索字符串。
|
||||
*/
|
||||
@ApiModelProperty(value = "LIKE 模糊搜索字符串")
|
||||
private String searchString;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* SysDeptDto对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("SysDeptDto对象")
|
||||
@Data
|
||||
public class SysDeptDto {
|
||||
|
||||
/**
|
||||
* 部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "部门Id", required = true)
|
||||
@NotNull(message = "数据验证失败,部门Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 部门名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "部门名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,部门名称不能为空!")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 显示顺序。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序", required = true)
|
||||
@NotNull(message = "数据验证失败,显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 父部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "父部门Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.core.validator.ConstDictRef;
|
||||
import com.orangeforms.upmsapi.constant.SysMenuType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 菜单Dto。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("菜单Dto")
|
||||
@Data
|
||||
public class SysMenuDto {
|
||||
|
||||
/**
|
||||
* 菜单Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单Id", required = true)
|
||||
@NotNull(message = "菜单Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 父菜单Id,目录菜单的父菜单为null
|
||||
*/
|
||||
@ApiModelProperty(value = "父菜单Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示名称", required = true)
|
||||
@NotBlank(message = "菜单显示名称不能为空!")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单类型 (0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单类型", required = true)
|
||||
@NotNull(message = "菜单类型不能为空!")
|
||||
@ConstDictRef(constDictClass = SysMenuType.class, message = "数据验证失败,菜单类型为无效值!")
|
||||
private Integer menuType;
|
||||
|
||||
/**
|
||||
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
||||
*/
|
||||
@ApiModelProperty(value = "前端表单路由名称")
|
||||
private String formRouterName;
|
||||
|
||||
/**
|
||||
* 在线表单主键Id,仅用于在线表单绑定的菜单。
|
||||
*/
|
||||
@ApiModelProperty(value = "在线表单主键Id")
|
||||
private Long onlineFormId;
|
||||
|
||||
/**
|
||||
* 菜单显示顺序 (值越小,排序越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序", required = true)
|
||||
@NotNull(message = "菜单显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 菜单图标。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序")
|
||||
private String icon;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 操作日志记录表
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("操作日志Dto")
|
||||
@Data
|
||||
public class SysOperationLogDto {
|
||||
|
||||
/**
|
||||
* 主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "主键Id")
|
||||
private Long logId;
|
||||
|
||||
/**
|
||||
* 操作类型。
|
||||
* 常量值定义可参考SysOperationLogType对象。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作类型")
|
||||
private Integer operationType;
|
||||
|
||||
/**
|
||||
* 每次请求的Id。
|
||||
* 对于微服务之间的调用,在同一个请求的调用链中,该值是相同的。
|
||||
*/
|
||||
@ApiModelProperty(value = "每次请求的Id")
|
||||
private String traceId;
|
||||
|
||||
/**
|
||||
* HTTP 请求地址。
|
||||
*/
|
||||
@ApiModelProperty(value = "HTTP 请求地址")
|
||||
private String requestUrl;
|
||||
|
||||
/**
|
||||
* 应答状态。
|
||||
*/
|
||||
@ApiModelProperty(value = "应答状态")
|
||||
private Boolean success;
|
||||
|
||||
/**
|
||||
* 操作员名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作员名称")
|
||||
private String operatorName;
|
||||
|
||||
/**
|
||||
* 调用时长最小值。
|
||||
*/
|
||||
@ApiModelProperty(value = "调用时长最小值")
|
||||
private Long elapseMin;
|
||||
|
||||
/**
|
||||
* 调用时长最大值。
|
||||
*/
|
||||
@ApiModelProperty(value = "调用时长最大值")
|
||||
private Long elapseMax;
|
||||
|
||||
/**
|
||||
* 操作开始时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作开始时间")
|
||||
private String operationTimeStart;
|
||||
|
||||
/**
|
||||
* 操作开始时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作开始时间")
|
||||
private String operationTimeEnd;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.ConstDictRef;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.upmsapi.constant.SysPermCodeType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 权限字Dto。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("权限字Dto")
|
||||
@Data
|
||||
public class SysPermCodeDto {
|
||||
|
||||
/**
|
||||
* 权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字Id", required = true)
|
||||
@NotNull(message = "权限字Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 权限字标识(一般为有含义的英文字符串)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字标识", required = true)
|
||||
@NotBlank(message = "权限字编码不能为空!")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 上级权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限字Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限字类型(0: 表单 1: UI片段 2: 操作)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字类型", required = true)
|
||||
@NotNull(message = "权限字类型不能为空!")
|
||||
@ConstDictRef(constDictClass = SysPermCodeType.class, message = "数据验证失败,权限类型为无效值!")
|
||||
private Integer permCodeType;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示名称", required = true)
|
||||
@NotBlank(message = "权限字显示名称不能为空!")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 显示顺序(数值越小,越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序", required = true)
|
||||
@NotNull(message = "权限字显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 权限资源Dto。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("权限资源Dto")
|
||||
@Data
|
||||
public class SysPermDto {
|
||||
|
||||
/**
|
||||
* 权限资源Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源Id", required = true)
|
||||
@NotNull(message = "权限Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long permId;
|
||||
|
||||
/**
|
||||
* 权限资源名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源名称", required = true)
|
||||
@NotBlank(message = "权限资源名称不能为空!")
|
||||
private String permName;
|
||||
|
||||
/**
|
||||
* shiro格式的权限字,如(upms:sysUser:add)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 权限所在的权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限所在的权限模块Id")
|
||||
@NotNull(message = "权限模块Id不能为空!")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 关联的URL。
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的URL", required = true)
|
||||
@NotBlank(message = "权限关联的url不能为空!")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 权限在当前模块下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序", required = true)
|
||||
@NotNull(message = "权限显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.ConstDictRef;
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.upmsapi.constant.SysPermModuleType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 权限资源模块Dto。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("权限资源模块Dto")
|
||||
@Data
|
||||
public class SysPermModuleDto {
|
||||
|
||||
/**
|
||||
* 权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块Id", required = true)
|
||||
@NotNull(message = "权限模块Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 权限模块名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块名称", required = true)
|
||||
@NotBlank(message = "权限模块名称不能为空!")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 上级权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限模块Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块类型", required = true)
|
||||
@NotNull(message = "模块类型不能为空!")
|
||||
@ConstDictRef(constDictClass = SysPermModuleType.class, message = "数据验证失败,权限模块类型为无效值!")
|
||||
private Integer moduleType;
|
||||
|
||||
/**
|
||||
* 权限模块在当前层级下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序", required = true)
|
||||
@NotNull(message = "权限模块显示顺序不能为空!")
|
||||
private Integer showOrder;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 角色Dto。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("角色Dto")
|
||||
@Data
|
||||
public class SysRoleDto {
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色Id", required = true)
|
||||
@NotNull(message = "角色Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色名称", required = true)
|
||||
@NotBlank(message = "角色名称不能为空!")
|
||||
private String roleName;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.orangeforms.upmsapi.dto;
|
||||
|
||||
import com.orangeforms.common.core.validator.UpdateGroup;
|
||||
import com.orangeforms.common.core.validator.ConstDictRef;
|
||||
import com.orangeforms.upmsapi.constant.SysUserType;
|
||||
import com.orangeforms.upmsapi.constant.SysUserStatus;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* SysUserDto对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("SysUserDto对象")
|
||||
@Data
|
||||
public class SysUserDto {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户Id", required = true)
|
||||
@NotNull(message = "数据验证失败,用户Id不能为空!", groups = {UpdateGroup.class})
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 登录用户名。
|
||||
*/
|
||||
@ApiModelProperty(value = "登录用户名", required = true)
|
||||
@NotBlank(message = "数据验证失败,登录用户名不能为空!")
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* 用户显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户显示名称", required = true)
|
||||
@NotBlank(message = "数据验证失败,用户显示名称不能为空!")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 用户部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户部门Id", required = true)
|
||||
@NotNull(message = "数据验证失败,用户部门Id不能为空!")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)", required = true)
|
||||
@NotNull(message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)不能为空!")
|
||||
@ConstDictRef(constDictClass = SysUserType.class, message = "数据验证失败,用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)为无效值!")
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 用户头像的Url。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户头像的Url")
|
||||
private String headImageUrl;
|
||||
|
||||
/**
|
||||
* 用户状态(0: 正常 1: 锁定)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户状态(0: 正常 1: 锁定)", required = true)
|
||||
@NotNull(message = "数据验证失败,用户状态(0: 正常 1: 锁定)不能为空!")
|
||||
@ConstDictRef(constDictClass = SysUserStatus.class, message = "数据验证失败,用户状态(0: 正常 1: 锁定)为无效值!")
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建用户Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤起始值(>=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤起始值(>=)")
|
||||
private String createTimeStart;
|
||||
|
||||
/**
|
||||
* createTime 范围过滤结束值(<=)。
|
||||
*/
|
||||
@ApiModelProperty(value = "createTime 范围过滤结束值(<=)")
|
||||
private String createTimeEnd;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据权限与部门关联VO。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("数据权限与部门关联VO")
|
||||
@Data
|
||||
public class SysDataPermDeptVo {
|
||||
|
||||
/**
|
||||
* 数据权限Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "数据权限Id")
|
||||
private Long dataPermId;
|
||||
|
||||
/**
|
||||
* 关联部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "关联部门Id")
|
||||
private Long deptId;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 数据权限VO。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("数据权限VO")
|
||||
@Data
|
||||
public class SysDataPermVo {
|
||||
|
||||
/**
|
||||
* 数据权限Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "数据权限Id")
|
||||
private Long dataPermId;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示名称")
|
||||
private String dataPermName;
|
||||
|
||||
/**
|
||||
* 数据权限规则类型(0: 全部可见 1: 只看自己 2: 只看本部门 3: 本部门及子部门 4: 多部门及子部门 5: 自定义部门列表)。
|
||||
*/
|
||||
@ApiModelProperty(value = "数据权限规则类型")
|
||||
private Integer ruleType;
|
||||
|
||||
/**
|
||||
* 部门Id列表(逗号分隔)。
|
||||
*/
|
||||
@ApiModelProperty(value = "部门Id列表")
|
||||
private String deptIdListString;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 数据权限与部门关联对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "数据权限与部门关联对象列表")
|
||||
private List<Map<String, Object>> dataPermDeptList;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* SysDeptVO视图对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("SysDeptVO视图对象")
|
||||
@Data
|
||||
public class SysDeptVo {
|
||||
|
||||
/**
|
||||
* 部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "部门Id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 部门名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 显示顺序。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 父部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "父部门Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单VO。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("菜单VO")
|
||||
@Data
|
||||
public class SysMenuVo {
|
||||
|
||||
/**
|
||||
* 菜单Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单Id")
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 父菜单Id,目录菜单的父菜单为null
|
||||
*/
|
||||
@ApiModelProperty(value = "父菜单Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示名称")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单类型 (0: 目录 1: 菜单 2: 按钮 3: UI片段)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单类型")
|
||||
private Integer menuType;
|
||||
|
||||
/**
|
||||
* 前端表单路由名称,仅用于menu_type为1的菜单类型。
|
||||
*/
|
||||
@ApiModelProperty(value = "前端表单路由名称")
|
||||
private String formRouterName;
|
||||
|
||||
/**
|
||||
* 在线表单主键Id,仅用于在线表单绑定的菜单。
|
||||
*/
|
||||
@ApiModelProperty(value = "在线表单主键Id")
|
||||
private Long onlineFormId;
|
||||
|
||||
/**
|
||||
* 在线表单菜单的权限控制类型,具体值可参考SysOnlineMenuPermType常量对象。
|
||||
*/
|
||||
@ApiModelProperty(value = "在线表单菜单的权限控制类型")
|
||||
private Integer onlineMenuPermType;
|
||||
|
||||
/**
|
||||
* 菜单显示顺序 (值越小,排序越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 菜单图标。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单显示顺序")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 菜单与权限字关联对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单与权限字关联对象列表")
|
||||
private List<Map<String, Object>> sysMenuPermCodeList;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 操作日志记录表
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("操作日志VO")
|
||||
@Data
|
||||
public class SysOperationLogVo {
|
||||
|
||||
/**
|
||||
* 操作日志主键Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作日志主键Id")
|
||||
private Long logId;
|
||||
|
||||
/**
|
||||
* 日志描述。
|
||||
*/
|
||||
@ApiModelProperty(value = "日志描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 操作类型。
|
||||
* 常量值定义可参考SysOperationLogType对象。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作类型")
|
||||
private Integer operationType;
|
||||
|
||||
/**
|
||||
* 接口所在服务名称。
|
||||
* 通常为spring.application.name配置项的值。
|
||||
*/
|
||||
@ApiModelProperty(value = "接口所在服务名称")
|
||||
private String serviceName;
|
||||
|
||||
/**
|
||||
* 调用的controller全类名。
|
||||
* 之所以为独立字段,是为了便于查询和统计接口的调用频度。
|
||||
*/
|
||||
@ApiModelProperty(value = "调用的controller全类名")
|
||||
private String apiClass;
|
||||
|
||||
/**
|
||||
* 调用的controller中的方法。
|
||||
* 格式为:接口类名 + "." + 方法名。
|
||||
*/
|
||||
@ApiModelProperty(value = "调用的controller中的方法")
|
||||
private String apiMethod;
|
||||
|
||||
/**
|
||||
* 用户会话sessionId。
|
||||
* 主要是为了便于统计,以及跟踪查询定位问题。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户会话sessionId")
|
||||
private String sessionId;
|
||||
|
||||
/**
|
||||
* 每次请求的Id。
|
||||
* 对于微服务之间的调用,在同一个请求的调用链中,该值是相同的。
|
||||
*/
|
||||
@ApiModelProperty(value = "每次请求的Id")
|
||||
private String traceId;
|
||||
|
||||
/**
|
||||
* 调用时长。
|
||||
*/
|
||||
@ApiModelProperty(value = "调用时长")
|
||||
private Long elapse;
|
||||
|
||||
/**
|
||||
* HTTP 请求方法,如GET。
|
||||
*/
|
||||
@ApiModelProperty(value = "HTTP 请求方法")
|
||||
private String requestMethod;
|
||||
|
||||
/**
|
||||
* HTTP 请求地址。
|
||||
*/
|
||||
@ApiModelProperty(value = "HTTP 请求地址")
|
||||
private String requestUrl;
|
||||
|
||||
/**
|
||||
* controller接口参数。
|
||||
*/
|
||||
@ApiModelProperty(value = "controller接口参数")
|
||||
private String requestArguments;
|
||||
|
||||
/**
|
||||
* controller应答结果。
|
||||
*/
|
||||
@ApiModelProperty(value = "controller应答结果")
|
||||
private String responseResult;
|
||||
|
||||
/**
|
||||
* 请求IP。
|
||||
*/
|
||||
@ApiModelProperty(value = "请求IP")
|
||||
private String requestIp;
|
||||
|
||||
/**
|
||||
* 应答状态。
|
||||
*/
|
||||
@ApiModelProperty(value = "应答状态")
|
||||
private Boolean success;
|
||||
|
||||
/**
|
||||
* 错误信息。
|
||||
*/
|
||||
@ApiModelProperty(value = "错误信息")
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 租户Id。
|
||||
* 仅用于多租户系统,是便于进行对租户的操作查询和统计分析。
|
||||
*/
|
||||
@ApiModelProperty(value = "租户Id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 操作员Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作员Id")
|
||||
private Long operatorId;
|
||||
|
||||
/**
|
||||
* 操作员名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作员名称")
|
||||
private String operatorName;
|
||||
|
||||
/**
|
||||
* 操作时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "操作时间")
|
||||
private Date operationTime;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限字VO。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("权限字VO")
|
||||
@Data
|
||||
public class SysPermCodeVo {
|
||||
|
||||
/**
|
||||
* 权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字Id")
|
||||
private Long permCodeId;
|
||||
|
||||
/**
|
||||
* 权限字标识(一般为有含义的英文字符串)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字标识")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 上级权限字Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限字Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限字类型(0: 表单 1: UI片段 2: 操作)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字类型")
|
||||
private Integer permCodeType;
|
||||
|
||||
/**
|
||||
* 显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示名称")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 显示顺序(数值越小,越靠前)。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 权限字与权限资源关联对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字与权限资源关联对象列表")
|
||||
private List<Map<String, Object>> sysPermCodePermList;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限资源模块VO。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("权限资源模块VO")
|
||||
@Data
|
||||
public class SysPermModuleVo {
|
||||
|
||||
/**
|
||||
* 权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块Id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 权限模块名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块名称")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 上级权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "上级权限模块Id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 权限模块类型(0: 普通模块 1: Controller模块)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限模块类型")
|
||||
private Integer moduleType;
|
||||
|
||||
/**
|
||||
* 权限模块在当前层级下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 权限资源对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源对象列表")
|
||||
private List<SysPermVo> sysPermList;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限资源VO。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("权限资源VO")
|
||||
@Data
|
||||
public class SysPermVo {
|
||||
|
||||
/**
|
||||
* 权限资源Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源Id")
|
||||
private Long permId;
|
||||
|
||||
/**
|
||||
* 权限资源名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限资源名称")
|
||||
private String permName;
|
||||
|
||||
/**
|
||||
* shiro格式的权限字,如(upms:sysUser:add)。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限字")
|
||||
private String permCode;
|
||||
|
||||
/**
|
||||
* 权限所在的权限模块Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "权限所在的权限模块Id")
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 关联的URL。
|
||||
*/
|
||||
@ApiModelProperty(value = "关联的URL")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 权限在当前模块下的顺序,由小到大。
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Integer showOrder;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 模块Id的字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "模块Id的字典关联数据")
|
||||
private Map<String, Object> moduleIdDictMap;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色VO。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("角色VO")
|
||||
@Data
|
||||
public class SysRoleVo {
|
||||
|
||||
/**
|
||||
* 角色Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色Id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 角色与菜单关联对象列表。
|
||||
*/
|
||||
@ApiModelProperty(value = "角色与菜单关联对象列表")
|
||||
private List<Map<String, Object>> sysRoleMenuList;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.orangeforms.upmsapi.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SysUserVO视图对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@ApiModel("SysUserVO视图对象")
|
||||
@Data
|
||||
public class SysUserVo {
|
||||
|
||||
/**
|
||||
* 用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户Id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 登录用户名。
|
||||
*/
|
||||
@ApiModelProperty(value = "登录用户名")
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* 用户显示名称。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户显示名称")
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 用户部门Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户部门Id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户类型(0: 管理员 1: 系统管理用户 2: 系统业务用户)")
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 用户头像的Url。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户头像的Url")
|
||||
private String headImageUrl;
|
||||
|
||||
/**
|
||||
* 用户状态(0: 正常 1: 锁定)。
|
||||
*/
|
||||
@ApiModelProperty(value = "用户状态(0: 正常 1: 锁定)")
|
||||
private Integer userStatus;
|
||||
|
||||
/**
|
||||
* 创建用户Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建用户Id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者Id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 多对多用户角色数据集合。
|
||||
*/
|
||||
@ApiModelProperty(value = "多对多用户角色数据集合")
|
||||
private List<Map<String, Object>> sysUserRoleList;
|
||||
|
||||
/**
|
||||
* 多对多用户数据权限数据集合。
|
||||
*/
|
||||
@ApiModelProperty(value = "多对多用户数据权限数据集合")
|
||||
private List<Map<String, Object>> sysDataPermUserList;
|
||||
|
||||
/**
|
||||
* deptId 字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "deptId 字典关联数据")
|
||||
private Map<String, Object> deptIdDictMap;
|
||||
|
||||
/**
|
||||
* userType 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "userType 常量字典关联数据")
|
||||
private Map<String, Object> userTypeDictMap;
|
||||
|
||||
/**
|
||||
* userStatus 常量字典关联数据。
|
||||
*/
|
||||
@ApiModelProperty(value = "userStatus 常量字典关联数据")
|
||||
private Map<String, Object> userStatusDictMap;
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
<?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$/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="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.fasterxml.jackson.core:jackson-databind:2.11.4" 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: commons-collections:commons-collections:3.2.2" 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: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" 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: org.springframework:spring-tx: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="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-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: 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: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.4" 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="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="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: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" 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" 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: io.netty:netty-handler: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: 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: 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" name="Maven: net.bytebuddy:byte-buddy:1.10.22" 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>
|
||||
@@ -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);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user