权限注解
This commit is contained in:
@@ -0,0 +1,118 @@
|
|||||||
|
package org.xyzh.api.system.service;
|
||||||
|
|
||||||
|
import org.xyzh.api.system.vo.AclVO;
|
||||||
|
import org.xyzh.common.core.domain.ResultDomain;
|
||||||
|
import org.xyzh.common.core.page.PageRequest;
|
||||||
|
import org.xyzh.common.dto.sys.TbSysAclDTO;
|
||||||
|
import org.xyzh.common.dto.sys.TbSysAclPolicyDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 访问控制列表服务接口
|
||||||
|
* @filename AclService.java
|
||||||
|
* @author yslg
|
||||||
|
* @copyright yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
public interface AclService {
|
||||||
|
|
||||||
|
// ================= ACL 管理 =================
|
||||||
|
/**
|
||||||
|
* @description 插入访问控制列表
|
||||||
|
* @param aclDTO 访问控制列表DTO
|
||||||
|
* @return ResultDomain<TbSysAclDTO> 插入结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<TbSysAclDTO> insertAcl(TbSysAclDTO aclDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 更新访问控制列表
|
||||||
|
* @param aclDTO 访问控制列表DTO
|
||||||
|
* @return ResultDomain<TbSysAclDTO> 更新结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<TbSysAclDTO> updateAcl(TbSysAclDTO aclDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 删除访问控制列表
|
||||||
|
* @param aclDTO 访问控制列表DTO
|
||||||
|
* @return ResultDomain<Boolean> 删除结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<Boolean> deleteAcl(TbSysAclDTO aclDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据条件查询访问控制列表分页数据
|
||||||
|
* @param pageRequest 分页请求
|
||||||
|
* @return ResultDomain<AclVO> 分页结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<AclVO> getAclPage(PageRequest<AclVO> pageRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据条件查询访问控制列表
|
||||||
|
* @param filter 过滤条件
|
||||||
|
* @return ResultDomain<AclVO> 查询结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<AclVO> getAclList(AclVO filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据对象ID查询访问控制列表
|
||||||
|
* @param objectId 对象ID
|
||||||
|
* @return ResultDomain<AclVO> 查询结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<AclVO> getAclByObjectId(String objectId);
|
||||||
|
|
||||||
|
// ================= ACL Policy 管理 =================
|
||||||
|
/**
|
||||||
|
* @description 插入访问控制策略
|
||||||
|
* @param aclPolicyDTO 访问控制策略DTO
|
||||||
|
* @return ResultDomain<TbSysAclPolicyDTO> 插入结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<TbSysAclPolicyDTO> insertAclPolicy(TbSysAclPolicyDTO aclPolicyDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 更新访问控制策略
|
||||||
|
* @param aclPolicyDTO 访问控制策略DTO
|
||||||
|
* @return ResultDomain<TbSysAclPolicyDTO> 更新结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<TbSysAclPolicyDTO> updateAclPolicy(TbSysAclPolicyDTO aclPolicyDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 删除访问控制策略
|
||||||
|
* @param aclPolicyDTO 访问控制策略DTO
|
||||||
|
* @return ResultDomain<Boolean> 删除结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<Boolean> deleteAclPolicy(TbSysAclPolicyDTO aclPolicyDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据条件查询访问控制策略分页数据
|
||||||
|
* @param pageRequest 分页请求
|
||||||
|
* @return ResultDomain<AclVO> 分页结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<AclVO> getAclPolicyPage(PageRequest<AclVO> pageRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据条件查询访问控制策略列表
|
||||||
|
* @param filter 过滤条件
|
||||||
|
* @return ResultDomain<AclVO> 查询结果
|
||||||
|
* @author yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
ResultDomain<AclVO> getAclPolicyList(AclVO filter);
|
||||||
|
}
|
||||||
@@ -154,60 +154,6 @@ public interface DeptRoleService {
|
|||||||
*/
|
*/
|
||||||
ResultDomain<UserDeptRoleVO> getRoleListByUserId(String userId);
|
ResultDomain<UserDeptRoleVO> getRoleListByUserId(String userId);
|
||||||
|
|
||||||
// ================= 部门角色关联管理 =================
|
|
||||||
/**
|
|
||||||
* @description 插入部门角色关联
|
|
||||||
* @param deptRoleDTO 部门角色DTO
|
|
||||||
* @return ResultDomain<TbSysDeptRoleDTO> 插入结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-05
|
|
||||||
*/
|
|
||||||
ResultDomain<TbSysDeptRoleDTO> insertDeptRole(TbSysDeptRoleDTO deptRoleDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 更新部门角色关联
|
|
||||||
* @param deptRoleDTO 部门角色DTO
|
|
||||||
* @return ResultDomain<TbSysDeptRoleDTO> 更新结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-05
|
|
||||||
*/
|
|
||||||
ResultDomain<TbSysDeptRoleDTO> updateDeptRole(TbSysDeptRoleDTO deptRoleDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据ID删除部门角色关联
|
|
||||||
* @param deptRoleDTO 部门角色DTO
|
|
||||||
* @return ResultDomain<Boolean> 删除结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-05
|
|
||||||
*/
|
|
||||||
ResultDomain<Boolean> deleteDeptRole(TbSysDeptRoleDTO deptRoleDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据ID查询部门角色关联
|
|
||||||
* @param filter 部门角色VO
|
|
||||||
* @return ResultDomain<UserDeptRoleVO> 查询结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-05
|
|
||||||
*/
|
|
||||||
ResultDomain<UserDeptRoleVO> getDeptRole(UserDeptRoleVO filter);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据条件查询部门角色关联列表
|
|
||||||
* @param filter 部门角色VO
|
|
||||||
* @return ResultDomain<UserDeptRoleVO> 查询结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-05
|
|
||||||
*/
|
|
||||||
ResultDomain<UserDeptRoleVO> getDeptRoleList(UserDeptRoleVO filter);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据条件查询部门角色关联分页列表
|
|
||||||
* @param pageRequest 部门角色VO
|
|
||||||
* @return ResultDomain<UserDeptRoleVO> 查询结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-05
|
|
||||||
*/
|
|
||||||
ResultDomain<UserDeptRoleVO> getDeptRolePage(PageRequest<UserDeptRoleVO> pageRequest);
|
|
||||||
|
|
||||||
// ==================== 角色权限关联 ================================
|
// ==================== 角色权限关联 ================================
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import org.xyzh.api.system.vo.PermissionVO;
|
|||||||
import org.xyzh.common.core.domain.ResultDomain;
|
import org.xyzh.common.core.domain.ResultDomain;
|
||||||
import org.xyzh.common.dto.sys.TbSysModuleDTO;
|
import org.xyzh.common.dto.sys.TbSysModuleDTO;
|
||||||
import org.xyzh.common.dto.sys.TbSysPermissionDTO;
|
import org.xyzh.common.dto.sys.TbSysPermissionDTO;
|
||||||
import org.xyzh.common.dto.sys.TbSysRolePermissionDTO;
|
|
||||||
import org.xyzh.common.core.page.PageRequest;
|
import org.xyzh.common.core.page.PageRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ public class UserDeptRoleVO extends BaseVO {
|
|||||||
@Schema(description = "用户ID")
|
@Schema(description = "用户ID")
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
@Schema(description = "用户名")
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@Schema(description = "密码")
|
@Schema(description = "密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@@ -49,18 +46,12 @@ public class UserDeptRoleVO extends BaseVO {
|
|||||||
@Schema(description = "头像")
|
@Schema(description = "头像")
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
|
@Schema(description = "用户名")
|
||||||
|
private String username;
|
||||||
|
|
||||||
@Schema(description = "性别")
|
@Schema(description = "性别")
|
||||||
private Integer gender;
|
private Integer gender;
|
||||||
|
|
||||||
@Schema(description = "姓")
|
|
||||||
private String familyName;
|
|
||||||
|
|
||||||
@Schema(description = "名")
|
|
||||||
private String givenName;
|
|
||||||
|
|
||||||
@Schema(description = "全名")
|
|
||||||
private String fullName;
|
|
||||||
|
|
||||||
@Schema(description = "等级")
|
@Schema(description = "等级")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.xyzh.system.controller;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -36,6 +37,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping("/dept")
|
@PostMapping("/dept")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:create')")
|
||||||
public ResultDomain<TbSysDeptDTO> createDept(@RequestBody TbSysDeptDTO deptDTO) {
|
public ResultDomain<TbSysDeptDTO> createDept(@RequestBody TbSysDeptDTO deptDTO) {
|
||||||
return deptRoleService.insertDept(deptDTO);
|
return deptRoleService.insertDept(deptDTO);
|
||||||
}
|
}
|
||||||
@@ -49,6 +51,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PutMapping("/dept")
|
@PutMapping("/dept")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||||
public ResultDomain<TbSysDeptDTO> updateDept(@RequestBody TbSysDeptDTO deptDTO) {
|
public ResultDomain<TbSysDeptDTO> updateDept(@RequestBody TbSysDeptDTO deptDTO) {
|
||||||
return deptRoleService.updateDept(deptDTO);
|
return deptRoleService.updateDept(deptDTO);
|
||||||
}
|
}
|
||||||
@@ -61,6 +64,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/dept")
|
@DeleteMapping("/dept")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:delete')")
|
||||||
public ResultDomain<Boolean> deleteDept(@RequestBody TbSysDeptDTO deptDTO) {
|
public ResultDomain<Boolean> deleteDept(@RequestBody TbSysDeptDTO deptDTO) {
|
||||||
return deptRoleService.deleteDept(deptDTO);
|
return deptRoleService.deleteDept(deptDTO);
|
||||||
}
|
}
|
||||||
@@ -73,6 +77,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@GetMapping("/dept/page")
|
@GetMapping("/dept/page")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:view')")
|
||||||
public ResultDomain<UserDeptRoleVO> getDeptPage(@RequestBody PageRequest<UserDeptRoleVO> pageRequest) {
|
public ResultDomain<UserDeptRoleVO> getDeptPage(@RequestBody PageRequest<UserDeptRoleVO> pageRequest) {
|
||||||
return deptRoleService.getDeptPage(pageRequest);
|
return deptRoleService.getDeptPage(pageRequest);
|
||||||
}
|
}
|
||||||
@@ -85,6 +90,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@GetMapping("/dept/list")
|
@GetMapping("/dept/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dept:view')")
|
||||||
public ResultDomain<UserDeptRoleVO> getDeptList(@RequestBody UserDeptRoleVO filter) {
|
public ResultDomain<UserDeptRoleVO> getDeptList(@RequestBody UserDeptRoleVO filter) {
|
||||||
return deptRoleService.getDeptList(filter);
|
return deptRoleService.getDeptList(filter);
|
||||||
}
|
}
|
||||||
@@ -98,6 +104,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping("/role")
|
@PostMapping("/role")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:create')")
|
||||||
public ResultDomain<TbSysRoleDTO> createRole(@RequestBody TbSysRoleDTO roleDTO) {
|
public ResultDomain<TbSysRoleDTO> createRole(@RequestBody TbSysRoleDTO roleDTO) {
|
||||||
return deptRoleService.insertRole(roleDTO);
|
return deptRoleService.insertRole(roleDTO);
|
||||||
}
|
}
|
||||||
@@ -110,6 +117,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PutMapping("/role")
|
@PutMapping("/role")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||||
public ResultDomain<TbSysRoleDTO> updateRole(@RequestBody TbSysRoleDTO roleDTO) {
|
public ResultDomain<TbSysRoleDTO> updateRole(@RequestBody TbSysRoleDTO roleDTO) {
|
||||||
return deptRoleService.updateRole(roleDTO);
|
return deptRoleService.updateRole(roleDTO);
|
||||||
}
|
}
|
||||||
@@ -122,6 +130,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/role")
|
@DeleteMapping("/role")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:delete')")
|
||||||
public ResultDomain<Boolean> deleteRole(@RequestBody TbSysRoleDTO roleDTO) {
|
public ResultDomain<Boolean> deleteRole(@RequestBody TbSysRoleDTO roleDTO) {
|
||||||
return deptRoleService.deleteRole(roleDTO);
|
return deptRoleService.deleteRole(roleDTO);
|
||||||
}
|
}
|
||||||
@@ -134,6 +143,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@GetMapping("/role/page")
|
@GetMapping("/role/page")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:view')")
|
||||||
public ResultDomain<UserDeptRoleVO> getRolePage(@RequestBody PageRequest<UserDeptRoleVO> pageRequest) {
|
public ResultDomain<UserDeptRoleVO> getRolePage(@RequestBody PageRequest<UserDeptRoleVO> pageRequest) {
|
||||||
return deptRoleService.getRolePage(pageRequest);
|
return deptRoleService.getRolePage(pageRequest);
|
||||||
}
|
}
|
||||||
@@ -146,35 +156,11 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@GetMapping("/role/list")
|
@GetMapping("/role/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:role:view')")
|
||||||
public ResultDomain<UserDeptRoleVO> getRoleList(@RequestBody UserDeptRoleVO filter) {
|
public ResultDomain<UserDeptRoleVO> getRoleList(@RequestBody UserDeptRoleVO filter) {
|
||||||
return deptRoleService.getRoleList(filter);
|
return deptRoleService.getRoleList(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================= 部门角色信息相关接口 ==================
|
|
||||||
/**
|
|
||||||
* @description 根据条件查询部门角色关联分页列表
|
|
||||||
* @param PageRequest<UserDeptRoleVO> pageRequest 分页请求
|
|
||||||
* @return ResultDomain<UserDeptRoleVO> 分页列表
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-10
|
|
||||||
*/
|
|
||||||
@GetMapping("/deptRole/page")
|
|
||||||
public ResultDomain<UserDeptRoleVO> getDeptRolePage(@RequestBody PageRequest<UserDeptRoleVO> pageRequest) {
|
|
||||||
return deptRoleService.getDeptRolePage(pageRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据条件查询部门角色关联列表
|
|
||||||
* @param filter 部门角色VO
|
|
||||||
* @return ResultDomain<UserDeptRoleVO> 部门角色关联列表
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-10
|
|
||||||
*/
|
|
||||||
@GetMapping("/deptRole/list")
|
|
||||||
public ResultDomain<UserDeptRoleVO> getDeptRoleList(@RequestBody UserDeptRoleVO filter) {
|
|
||||||
return deptRoleService.getDeptRoleList(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ================== 角色权限相关接口 ==================
|
// ================== 角色权限相关接口 ==================
|
||||||
/**
|
/**
|
||||||
* @description 给一个角色设置权限
|
* @description 给一个角色设置权限
|
||||||
@@ -184,6 +170,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-11
|
* @since 2025-11-11
|
||||||
*/
|
*/
|
||||||
@PostMapping("/rolePermission/bind")
|
@PostMapping("/rolePermission/bind")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<PermissionVO> getRolePermission(@RequestBody PermissionVO permissionVO) {
|
public ResultDomain<PermissionVO> getRolePermission(@RequestBody PermissionVO permissionVO) {
|
||||||
return deptRoleService.setRolePermission(permissionVO);
|
return deptRoleService.setRolePermission(permissionVO);
|
||||||
}
|
}
|
||||||
@@ -196,6 +183,7 @@ public class DeptRoleController {
|
|||||||
* @since 2025-11-11
|
* @since 2025-11-11
|
||||||
*/
|
*/
|
||||||
@PostMapping("/rolePermission/list")
|
@PostMapping("/rolePermission/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getRolePermissionList(@RequestBody PermissionVO permissionVO) {
|
public ResultDomain<PermissionVO> getRolePermissionList(@RequestBody PermissionVO permissionVO) {
|
||||||
return deptRoleService.getRolePermissionList(permissionVO);
|
return deptRoleService.getRolePermissionList(permissionVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.xyzh.system.controller;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@@ -35,6 +36,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping("/module")
|
@PostMapping("/module")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<TbSysModuleDTO> createModule(@RequestBody TbSysModuleDTO moduleDTO) {
|
public ResultDomain<TbSysModuleDTO> createModule(@RequestBody TbSysModuleDTO moduleDTO) {
|
||||||
return modulePermissionService.insertModule(moduleDTO);
|
return modulePermissionService.insertModule(moduleDTO);
|
||||||
}
|
}
|
||||||
@@ -47,6 +49,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PutMapping("/moudule")
|
@PutMapping("/moudule")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<TbSysModuleDTO> updateModule(@RequestBody TbSysModuleDTO moduleDTO) {
|
public ResultDomain<TbSysModuleDTO> updateModule(@RequestBody TbSysModuleDTO moduleDTO) {
|
||||||
return modulePermissionService.updateModule(moduleDTO);
|
return modulePermissionService.updateModule(moduleDTO);
|
||||||
}
|
}
|
||||||
@@ -59,6 +62,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/module")
|
@DeleteMapping("/module")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<Boolean> deleteModule(@RequestBody TbSysModuleDTO moduleDTO) {
|
public ResultDomain<Boolean> deleteModule(@RequestBody TbSysModuleDTO moduleDTO) {
|
||||||
return modulePermissionService.deleteModule(moduleDTO);
|
return modulePermissionService.deleteModule(moduleDTO);
|
||||||
}
|
}
|
||||||
@@ -71,6 +75,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping("/module/page")
|
@PostMapping("/module/page")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getModulePage(@RequestBody PageRequest<PermissionVO> pageRequest) {
|
public ResultDomain<PermissionVO> getModulePage(@RequestBody PageRequest<PermissionVO> pageRequest) {
|
||||||
return modulePermissionService.getModulePage(pageRequest);
|
return modulePermissionService.getModulePage(pageRequest);
|
||||||
}
|
}
|
||||||
@@ -83,6 +88,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping("/module/list")
|
@PostMapping("/module/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getModuleList(@RequestBody PermissionVO filter) {
|
public ResultDomain<PermissionVO> getModuleList(@RequestBody PermissionVO filter) {
|
||||||
return modulePermissionService.getModuleList(filter);
|
return modulePermissionService.getModuleList(filter);
|
||||||
}
|
}
|
||||||
@@ -96,6 +102,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<TbSysPermissionDTO> createPermission(@RequestBody TbSysPermissionDTO permissionDTO) {
|
public ResultDomain<TbSysPermissionDTO> createPermission(@RequestBody TbSysPermissionDTO permissionDTO) {
|
||||||
return modulePermissionService.insertPermission(permissionDTO);
|
return modulePermissionService.insertPermission(permissionDTO);
|
||||||
}
|
}
|
||||||
@@ -108,6 +115,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<TbSysPermissionDTO> updatePermission(@RequestBody TbSysPermissionDTO permissionDTO) {
|
public ResultDomain<TbSysPermissionDTO> updatePermission(@RequestBody TbSysPermissionDTO permissionDTO) {
|
||||||
return modulePermissionService.updatePermission(permissionDTO);
|
return modulePermissionService.updatePermission(permissionDTO);
|
||||||
}
|
}
|
||||||
@@ -120,6 +128,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<Boolean> deletePermission(@RequestBody TbSysPermissionDTO permissionDTO) {
|
public ResultDomain<Boolean> deletePermission(@RequestBody TbSysPermissionDTO permissionDTO) {
|
||||||
return modulePermissionService.deletePermission(permissionDTO);
|
return modulePermissionService.deletePermission(permissionDTO);
|
||||||
}
|
}
|
||||||
@@ -132,6 +141,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getModulePermissionPage(@RequestBody PageRequest<PermissionVO> pageRequest) {
|
public ResultDomain<PermissionVO> getModulePermissionPage(@RequestBody PageRequest<PermissionVO> pageRequest) {
|
||||||
return modulePermissionService.getModulePermissionPage(pageRequest);
|
return modulePermissionService.getModulePermissionPage(pageRequest);
|
||||||
}
|
}
|
||||||
@@ -144,6 +154,7 @@ public class PermissionController {
|
|||||||
* @since 2025-11-10
|
* @since 2025-11-10
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getModulePermissionList(@RequestBody PermissionVO filter) {
|
public ResultDomain<PermissionVO> getModulePermissionList(@RequestBody PermissionVO filter) {
|
||||||
return modulePermissionService.getModulePermissionList(filter);
|
return modulePermissionService.getModulePermissionList(filter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.xyzh.system.controller;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@@ -28,26 +29,31 @@ public class SysConfigController {
|
|||||||
// ================= 系统配置相关接口 =================
|
// ================= 系统配置相关接口 =================
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('config:config:edit')")
|
||||||
public ResultDomain<TbSysConfigDTO> createConfig(@RequestBody TbSysConfigDTO configDTO) {
|
public ResultDomain<TbSysConfigDTO> createConfig(@RequestBody TbSysConfigDTO configDTO) {
|
||||||
return sysConfigService.insertConfig(configDTO);
|
return sysConfigService.insertConfig(configDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('config:config:edit')")
|
||||||
public ResultDomain<TbSysConfigDTO> updateConfig(@RequestBody TbSysConfigDTO configDTO) {
|
public ResultDomain<TbSysConfigDTO> updateConfig(@RequestBody TbSysConfigDTO configDTO) {
|
||||||
return sysConfigService.updateConfig(configDTO);
|
return sysConfigService.updateConfig(configDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('config:config:edit')")
|
||||||
public ResultDomain<Boolean> deleteConfig(@RequestBody TbSysConfigDTO configDTO) {
|
public ResultDomain<Boolean> deleteConfig(@RequestBody TbSysConfigDTO configDTO) {
|
||||||
return sysConfigService.deleteConfig(configDTO);
|
return sysConfigService.deleteConfig(configDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
|
@PreAuthorize("@ss.hasPermi('config:config:view')")
|
||||||
public ResultDomain<SysConfigVO> getConfigPage(@RequestBody PageRequest<SysConfigVO> pageRequest) {
|
public ResultDomain<SysConfigVO> getConfigPage(@RequestBody PageRequest<SysConfigVO> pageRequest) {
|
||||||
return sysConfigService.getConfigPage(pageRequest);
|
return sysConfigService.getConfigPage(pageRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('config:config:view')")
|
||||||
public ResultDomain<SysConfigVO> getConfigList(@RequestBody SysConfigVO filter) {
|
public ResultDomain<SysConfigVO> getConfigList(@RequestBody SysConfigVO filter) {
|
||||||
return sysConfigService.getConfigList(filter);
|
return sysConfigService.getConfigList(filter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,31 +31,31 @@ public class UserController {
|
|||||||
// ================= 用户相关接口 =================
|
// ================= 用户相关接口 =================
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@PreAuthorize("hasAuthority('system:user:create')")
|
@PreAuthorize("@ss.hasPermi('system:user:create')")
|
||||||
public ResultDomain<TbSysUserDTO> createUser(@RequestBody SysUserVO userVO) {
|
public ResultDomain<TbSysUserDTO> createUser(@RequestBody SysUserVO userVO) {
|
||||||
return sysUserService.insertUser(userVO);
|
return sysUserService.insertUser(userVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@PreAuthorize("hasAuthority('system:user:update')")
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
public ResultDomain<TbSysUserDTO> updateUser(@RequestBody SysUserVO userVO) {
|
public ResultDomain<TbSysUserDTO> updateUser(@RequestBody SysUserVO userVO) {
|
||||||
return sysUserService.updateUser(userVO);
|
return sysUserService.updateUser(userVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@PreAuthorize("hasAuthority('system:user:delete')")
|
@PreAuthorize("@ss.hasPermi('system:user:delete')")
|
||||||
public ResultDomain<Boolean> deleteUser(@RequestBody TbSysUserDTO userDTO) {
|
public ResultDomain<Boolean> deleteUser(@RequestBody TbSysUserDTO userDTO) {
|
||||||
return sysUserService.deleteUser(userDTO);
|
return sysUserService.deleteUser(userDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
@PreAuthorize("hasAuthority('system:user:query')")
|
@PreAuthorize("@ss.hasPermi('system:user:view')")
|
||||||
public ResultDomain<SysUserVO> getUserPage(@RequestBody PageRequest<SysUserVO> pageRequest) {
|
public ResultDomain<SysUserVO> getUserPage(@RequestBody PageRequest<SysUserVO> pageRequest) {
|
||||||
return sysUserService.getUserPage(pageRequest);
|
return sysUserService.getUserPage(pageRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@PreAuthorize("hasAuthority('system:user:query')")
|
@PreAuthorize("@ss.hasPermi('system:user:view')")
|
||||||
public ResultDomain<SysUserVO> getUserList(@RequestBody SysUserVO filter) {
|
public ResultDomain<SysUserVO> getUserList(@RequestBody SysUserVO filter) {
|
||||||
return sysUserService.getUserList(filter);
|
return sysUserService.getUserList(filter);
|
||||||
}
|
}
|
||||||
@@ -63,13 +63,13 @@ public class UserController {
|
|||||||
// ================= 用户信息相关接口 ==================
|
// ================= 用户信息相关接口 ==================
|
||||||
|
|
||||||
@PutMapping("/info")
|
@PutMapping("/info")
|
||||||
@PreAuthorize("hasAuthority('system:userinfo:update')")
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||||
public ResultDomain<TbSysUserInfoDTO> updateUserInfo(@RequestBody TbSysUserInfoDTO userInfoDTO) {
|
public ResultDomain<TbSysUserInfoDTO> updateUserInfo(@RequestBody TbSysUserInfoDTO userInfoDTO) {
|
||||||
return sysUserService.updateUserInfo(userInfoDTO);
|
return sysUserService.updateUserInfo(userInfoDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/info/{userId}")
|
@GetMapping("/info/{userId}")
|
||||||
@PreAuthorize("hasAuthority('system:userinfo:read')")
|
@PreAuthorize("@ss.hasPermi('system:user:view')")
|
||||||
public ResultDomain<SysUserVO> getUserInfo(@PathVariable("userId") String userId) {
|
public ResultDomain<SysUserVO> getUserInfo(@PathVariable("userId") String userId) {
|
||||||
return sysUserService.getUserInfo(userId);
|
return sysUserService.getUserInfo(userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.xyzh.system.controller;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@@ -26,37 +27,44 @@ public class ViewController {
|
|||||||
|
|
||||||
// ================= 视图相关接口 =================
|
// ================= 视图相关接口 =================
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<TbSysViewDTO> createView(@RequestBody TbSysViewDTO viewDTO) {
|
public ResultDomain<TbSysViewDTO> createView(@RequestBody TbSysViewDTO viewDTO) {
|
||||||
return viewService.insertView(viewDTO);
|
return viewService.insertView(viewDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<TbSysViewDTO> updateView(@RequestBody TbSysViewDTO viewDTO) {
|
public ResultDomain<TbSysViewDTO> updateView(@RequestBody TbSysViewDTO viewDTO) {
|
||||||
return viewService.updateView(viewDTO);
|
return viewService.updateView(viewDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<Boolean> deleteView(@RequestBody TbSysViewDTO viewDTO) {
|
public ResultDomain<Boolean> deleteView(@RequestBody TbSysViewDTO viewDTO) {
|
||||||
return viewService.deleteView(viewDTO);
|
return viewService.deleteView(viewDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getViewPage(@RequestBody PageRequest<PermissionVO> pageRequest) {
|
public ResultDomain<PermissionVO> getViewPage(@RequestBody PageRequest<PermissionVO> pageRequest) {
|
||||||
return viewService.getViewPage(pageRequest);
|
return viewService.getViewPage(pageRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getViewList(@RequestBody PermissionVO filter) {
|
public ResultDomain<PermissionVO> getViewList(@RequestBody PermissionVO filter) {
|
||||||
return viewService.getViewList(filter);
|
return viewService.getViewList(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================= 视图权限相关接口 ==================
|
// ================= 视图权限相关接口 ==================
|
||||||
@PostMapping("/permission/bind")
|
@PostMapping("/permission/bind")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:manage')")
|
||||||
public ResultDomain<PermissionVO> bindViewPermission(@RequestBody PermissionVO permissionVO) {
|
public ResultDomain<PermissionVO> bindViewPermission(@RequestBody PermissionVO permissionVO) {
|
||||||
return viewService.setViewPermissions(permissionVO);
|
return viewService.setViewPermissions(permissionVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/permission/list")
|
@PostMapping("/permission/list")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:permission:view')")
|
||||||
public ResultDomain<PermissionVO> getViewPermissions(@RequestBody PermissionVO permissionVO) {
|
public ResultDomain<PermissionVO> getViewPermissions(@RequestBody PermissionVO permissionVO) {
|
||||||
return viewService.getViewPermissionList(permissionVO);
|
return viewService.getViewPermissionList(permissionVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
package org.xyzh.system.mapper.dept;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.xyzh.api.system.vo.PermissionVO;
|
|
||||||
import org.xyzh.common.core.page.PageParam;
|
|
||||||
import org.xyzh.common.dto.sys.TbSysDeptRoleDTO;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 系统部门角色关系Mapper接口
|
|
||||||
* @filename TbSysDeptRoleMapper.java
|
|
||||||
* @author yslg
|
|
||||||
* @copyright yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface TbSysDeptRoleMapper extends BaseMapper<TbSysDeptRoleDTO> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 插入系统部门角色关系
|
|
||||||
* @param deptRoleDTO 系统部门角色关系DTO
|
|
||||||
* @return int 插入结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
int insertDeptRole(TbSysDeptRoleDTO deptRoleDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 更新系统部门角色关系
|
|
||||||
* @param deptRoleDTO 系统部门角色关系DTO
|
|
||||||
* @return int 更新结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
int updateDeptRole(TbSysDeptRoleDTO deptRoleDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 删除系统部门角色关系
|
|
||||||
* @param deptRoleDTO 系统部门角色关系DTO
|
|
||||||
* @return int 删除结果
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
int deleteDeptRole(TbSysDeptRoleDTO deptRoleDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据部门ID查询系统部门角色关系
|
|
||||||
* @param deptId 部门ID
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @return UserDeptRoleVO 用户部门角色VO
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
PermissionVO getDeptRoleByDeptId(String deptId, String roleId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据条件查询系统部门角色关系列表
|
|
||||||
* @param filter 系统部门角色关系DTO
|
|
||||||
* @return List<UserDeptRoleVO> 用户部门角色VO列表
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
List<PermissionVO> getDeptRoleByFilter(@Param("filter") TbSysDeptRoleDTO filter);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据条件查询系统部门角色关系分页列表
|
|
||||||
* @param filter 系统部门角色关系DTO
|
|
||||||
* @param pageParam 分页参数
|
|
||||||
* @return List<UserDeptRoleVO> 用户部门角色VO列表
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
List<PermissionVO> getDeptRolePageByFilter(@Param("filter") TbSysDeptRoleDTO filter, @Param("pageParam") PageParam pageParam);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 根据条件查询系统部门角色关系数量
|
|
||||||
* @param filter 系统部门角色关系DTO
|
|
||||||
* @return int 系统部门角色关系数量
|
|
||||||
* @author yslg
|
|
||||||
* @since 2025-11-07
|
|
||||||
*/
|
|
||||||
int getDeptRoleCount(TbSysDeptRoleDTO filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.xyzh.system.mapper.permission;
|
package org.xyzh.system.mapper.view;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -0,0 +1,281 @@
|
|||||||
|
package org.xyzh.system.service.impl;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.xyzh.api.system.service.AclService;
|
||||||
|
import org.xyzh.api.system.vo.AclVO;
|
||||||
|
import org.xyzh.common.core.domain.ResultDomain;
|
||||||
|
import org.xyzh.common.core.page.PageDomain;
|
||||||
|
import org.xyzh.common.core.page.PageParam;
|
||||||
|
import org.xyzh.common.core.page.PageRequest;
|
||||||
|
import org.xyzh.common.dto.sys.TbSysAclDTO;
|
||||||
|
import org.xyzh.common.dto.sys.TbSysAclPolicyDTO;
|
||||||
|
import org.xyzh.common.utils.IDUtils;
|
||||||
|
import org.xyzh.common.utils.StringUtils;
|
||||||
|
import org.xyzh.system.mapper.acl.TbSysAclMapper;
|
||||||
|
import org.xyzh.system.mapper.acl.TbSysAclPolicyMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 访问控制列表服务实现类
|
||||||
|
* @filename AclServiceImpl.java
|
||||||
|
* @author yslg
|
||||||
|
* @copyright yslg
|
||||||
|
* @since 2025-12-05
|
||||||
|
*/
|
||||||
|
@DubboService(
|
||||||
|
version = "1.0.0",
|
||||||
|
group = "system",
|
||||||
|
timeout = 3000,
|
||||||
|
retries = 0
|
||||||
|
)
|
||||||
|
public class AclServiceImpl implements AclService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(AclServiceImpl.class);
|
||||||
|
private static final String MSG_ACL_PARAM_REQUIRED = "访问控制列表参数不能为空";
|
||||||
|
private static final String MSG_ACL_ID_REQUIRED = "访问控制列表ID不能为空";
|
||||||
|
private static final String MSG_POLICY_PARAM_REQUIRED = "访问控制策略参数不能为空";
|
||||||
|
private static final String MSG_POLICY_ID_REQUIRED = "访问控制策略ID不能为空";
|
||||||
|
private static final String MSG_PAGE_PARAM_REQUIRED = "分页参数不能为空";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TbSysAclMapper aclMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TbSysAclPolicyMapper aclPolicyMapper;
|
||||||
|
|
||||||
|
// ================= ACL 管理 =================
|
||||||
|
@Override
|
||||||
|
public ResultDomain<TbSysAclDTO> insertAcl(TbSysAclDTO aclDTO) {
|
||||||
|
if (aclDTO == null) {
|
||||||
|
return ResultDomain.failure(MSG_ACL_PARAM_REQUIRED);
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(aclDTO.getAclId())) {
|
||||||
|
aclDTO.setAclId(IDUtils.generateID());
|
||||||
|
}
|
||||||
|
if (aclDTO.getCreateTime() == null) {
|
||||||
|
aclDTO.setCreateTime(new Date());
|
||||||
|
}
|
||||||
|
if (aclDTO.getDeleted() == null) {
|
||||||
|
aclDTO.setDeleted(false);
|
||||||
|
}
|
||||||
|
if (aclDTO.getAllow() == null) {
|
||||||
|
aclDTO.setAllow(true);
|
||||||
|
}
|
||||||
|
if (aclDTO.getIncludeDescendants() == null) {
|
||||||
|
aclDTO.setIncludeDescendants(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rows = aclMapper.insertAcl(aclDTO);
|
||||||
|
if (rows > 0) {
|
||||||
|
logger.info("新增访问控制列表成功, aclId={}", aclDTO.getAclId());
|
||||||
|
return ResultDomain.success("新增访问控制列表成功", aclDTO);
|
||||||
|
}
|
||||||
|
logger.warn("新增访问控制列表失败, aclId={}", aclDTO.getAclId());
|
||||||
|
return ResultDomain.failure("新增访问控制列表失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<TbSysAclDTO> updateAcl(TbSysAclDTO aclDTO) {
|
||||||
|
if (aclDTO == null || StringUtils.isBlank(aclDTO.getAclId())) {
|
||||||
|
return ResultDomain.failure(MSG_ACL_ID_REQUIRED);
|
||||||
|
}
|
||||||
|
aclDTO.setUpdateTime(new Date());
|
||||||
|
|
||||||
|
int rows = aclMapper.updateAcl(aclDTO);
|
||||||
|
if (rows > 0) {
|
||||||
|
logger.info("更新访问控制列表成功, aclId={}", aclDTO.getAclId());
|
||||||
|
return ResultDomain.success("更新访问控制列表成功", aclDTO);
|
||||||
|
}
|
||||||
|
logger.warn("更新访问控制列表失败, aclId={}", aclDTO.getAclId());
|
||||||
|
return ResultDomain.failure("更新访问控制列表失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<Boolean> deleteAcl(TbSysAclDTO aclDTO) {
|
||||||
|
if (aclDTO == null || StringUtils.isBlank(aclDTO.getAclId())) {
|
||||||
|
return ResultDomain.failure(MSG_ACL_ID_REQUIRED);
|
||||||
|
}
|
||||||
|
aclDTO.setDeleteTime(new Date());
|
||||||
|
|
||||||
|
int rows = aclMapper.deleteAcl(aclDTO);
|
||||||
|
if (rows > 0) {
|
||||||
|
logger.info("删除访问控制列表成功, aclId={}", aclDTO.getAclId());
|
||||||
|
return ResultDomain.success("删除访问控制列表成功", true);
|
||||||
|
}
|
||||||
|
logger.warn("删除访问控制列表失败, aclId={}", aclDTO.getAclId());
|
||||||
|
return ResultDomain.failure("删除访问控制列表失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<AclVO> getAclPage(PageRequest<AclVO> pageRequest) {
|
||||||
|
if (pageRequest == null) {
|
||||||
|
return ResultDomain.failure(MSG_PAGE_PARAM_REQUIRED);
|
||||||
|
}
|
||||||
|
|
||||||
|
AclVO filter = pageRequest.getFilter();
|
||||||
|
if (filter == null) {
|
||||||
|
filter = new AclVO();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为 DTO
|
||||||
|
TbSysAclDTO aclDTO = new TbSysAclDTO();
|
||||||
|
aclDTO.setAclId(filter.getAclId());
|
||||||
|
aclDTO.setObjectType(filter.getObjectType());
|
||||||
|
aclDTO.setObjectId(filter.getObjectId());
|
||||||
|
aclDTO.setPrincipalType(filter.getPrincipalType());
|
||||||
|
aclDTO.setPrincipalId(filter.getPrincipalId());
|
||||||
|
aclDTO.setPrincipalDeptId(filter.getPrincipalDeptId());
|
||||||
|
|
||||||
|
// 获取总数
|
||||||
|
int total = aclMapper.getAclCount(aclDTO);
|
||||||
|
|
||||||
|
// 分页查询
|
||||||
|
PageParam pageParam = pageRequest.getPageParam();
|
||||||
|
List<AclVO> list = aclMapper.getAclPageByFilter(aclDTO, pageParam);
|
||||||
|
|
||||||
|
pageParam.setTotal(total);
|
||||||
|
PageDomain<AclVO> pageDomain = new PageDomain<>(pageParam, list);
|
||||||
|
return ResultDomain.success("查询成功", pageDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<AclVO> getAclList(AclVO filter) {
|
||||||
|
if (filter == null) {
|
||||||
|
filter = new AclVO();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为 DTO
|
||||||
|
TbSysAclDTO aclDTO = new TbSysAclDTO();
|
||||||
|
aclDTO.setAclId(filter.getAclId());
|
||||||
|
aclDTO.setObjectType(filter.getObjectType());
|
||||||
|
aclDTO.setObjectId(filter.getObjectId());
|
||||||
|
aclDTO.setPrincipalType(filter.getPrincipalType());
|
||||||
|
aclDTO.setPrincipalId(filter.getPrincipalId());
|
||||||
|
aclDTO.setPrincipalDeptId(filter.getPrincipalDeptId());
|
||||||
|
|
||||||
|
List<AclVO> list = aclMapper.getAclByFilter(aclDTO);
|
||||||
|
return ResultDomain.success("查询成功", list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<AclVO> getAclByObjectId(String objectId) {
|
||||||
|
if (StringUtils.isBlank(objectId)) {
|
||||||
|
return ResultDomain.failure("对象ID不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<AclVO> list = aclMapper.getAclByObjectId(objectId);
|
||||||
|
return ResultDomain.success("查询成功", list);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================= ACL Policy 管理 =================
|
||||||
|
@Override
|
||||||
|
public ResultDomain<TbSysAclPolicyDTO> insertAclPolicy(TbSysAclPolicyDTO aclPolicyDTO) {
|
||||||
|
if (aclPolicyDTO == null) {
|
||||||
|
return ResultDomain.failure(MSG_POLICY_PARAM_REQUIRED);
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(aclPolicyDTO.getPolicyId())) {
|
||||||
|
aclPolicyDTO.setPolicyId(IDUtils.generateID());
|
||||||
|
}
|
||||||
|
if (aclPolicyDTO.getCreateTime() == null) {
|
||||||
|
aclPolicyDTO.setCreateTime(new Date());
|
||||||
|
}
|
||||||
|
if (aclPolicyDTO.getDeleted() == null) {
|
||||||
|
aclPolicyDTO.setDeleted(false);
|
||||||
|
}
|
||||||
|
if (aclPolicyDTO.getDefaultAllow() == null) {
|
||||||
|
aclPolicyDTO.setDefaultAllow(true);
|
||||||
|
}
|
||||||
|
if (aclPolicyDTO.getApplyToChildren() == null) {
|
||||||
|
aclPolicyDTO.setApplyToChildren(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rows = aclPolicyMapper.insertAclPolicy(aclPolicyDTO);
|
||||||
|
if (rows > 0) {
|
||||||
|
logger.info("新增访问控制策略成功, policyId={}", aclPolicyDTO.getPolicyId());
|
||||||
|
return ResultDomain.success("新增访问控制策略成功", aclPolicyDTO);
|
||||||
|
}
|
||||||
|
logger.warn("新增访问控制策略失败, policyId={}", aclPolicyDTO.getPolicyId());
|
||||||
|
return ResultDomain.failure("新增访问控制策略失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<TbSysAclPolicyDTO> updateAclPolicy(TbSysAclPolicyDTO aclPolicyDTO) {
|
||||||
|
if (aclPolicyDTO == null || StringUtils.isBlank(aclPolicyDTO.getPolicyId())) {
|
||||||
|
return ResultDomain.failure(MSG_POLICY_ID_REQUIRED);
|
||||||
|
}
|
||||||
|
aclPolicyDTO.setUpdateTime(new Date());
|
||||||
|
|
||||||
|
int rows = aclPolicyMapper.updateAclPolicy(aclPolicyDTO);
|
||||||
|
if (rows > 0) {
|
||||||
|
logger.info("更新访问控制策略成功, policyId={}", aclPolicyDTO.getPolicyId());
|
||||||
|
return ResultDomain.success("更新访问控制策略成功", aclPolicyDTO);
|
||||||
|
}
|
||||||
|
logger.warn("更新访问控制策略失败, policyId={}", aclPolicyDTO.getPolicyId());
|
||||||
|
return ResultDomain.failure("更新访问控制策略失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<Boolean> deleteAclPolicy(TbSysAclPolicyDTO aclPolicyDTO) {
|
||||||
|
if (aclPolicyDTO == null || StringUtils.isBlank(aclPolicyDTO.getPolicyId())) {
|
||||||
|
return ResultDomain.failure(MSG_POLICY_ID_REQUIRED);
|
||||||
|
}
|
||||||
|
aclPolicyDTO.setDeleteTime(new Date());
|
||||||
|
|
||||||
|
int rows = aclPolicyMapper.deleteAclPolicy(aclPolicyDTO);
|
||||||
|
if (rows > 0) {
|
||||||
|
logger.info("删除访问控制策略成功, policyId={}", aclPolicyDTO.getPolicyId());
|
||||||
|
return ResultDomain.success("删除访问控制策略成功", true);
|
||||||
|
}
|
||||||
|
logger.warn("删除访问控制策略失败, policyId={}", aclPolicyDTO.getPolicyId());
|
||||||
|
return ResultDomain.failure("删除访问控制策略失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<AclVO> getAclPolicyPage(PageRequest<AclVO> pageRequest) {
|
||||||
|
if (pageRequest == null) {
|
||||||
|
return ResultDomain.failure(MSG_PAGE_PARAM_REQUIRED);
|
||||||
|
}
|
||||||
|
|
||||||
|
AclVO filter = pageRequest.getFilter();
|
||||||
|
if (filter == null) {
|
||||||
|
filter = new AclVO();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为 DTO
|
||||||
|
TbSysAclPolicyDTO aclPolicyDTO = new TbSysAclPolicyDTO();
|
||||||
|
aclPolicyDTO.setPolicyId(filter.getPolicyId());
|
||||||
|
aclPolicyDTO.setName(filter.getPolicyName());
|
||||||
|
aclPolicyDTO.setObjectType(filter.getPolicyObjectType());
|
||||||
|
|
||||||
|
// 获取总数
|
||||||
|
int total = aclPolicyMapper.getAclPolicyCount(aclPolicyDTO);
|
||||||
|
|
||||||
|
// 分页查询
|
||||||
|
PageParam pageParam = pageRequest.getPageParam();
|
||||||
|
List<AclVO> list = aclPolicyMapper.getAclPolicyPageByFilter(aclPolicyDTO, pageParam);
|
||||||
|
|
||||||
|
pageParam.setTotal(total);
|
||||||
|
PageDomain<AclVO> pageDomain = new PageDomain<>(pageParam, list);
|
||||||
|
return ResultDomain.success("查询成功", pageDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDomain<AclVO> getAclPolicyList(AclVO filter) {
|
||||||
|
if (filter == null) {
|
||||||
|
filter = new AclVO();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为 DTO
|
||||||
|
TbSysAclPolicyDTO aclPolicyDTO = new TbSysAclPolicyDTO();
|
||||||
|
aclPolicyDTO.setPolicyId(filter.getPolicyId());
|
||||||
|
aclPolicyDTO.setName(filter.getPolicyName());
|
||||||
|
aclPolicyDTO.setObjectType(filter.getPolicyObjectType());
|
||||||
|
|
||||||
|
List<AclVO> list = aclPolicyMapper.getAclPolicyByFilter(aclPolicyDTO);
|
||||||
|
return ResultDomain.success("查询成功", list);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,6 @@ import org.xyzh.common.dto.sys.TbSysUserRoleDTO;
|
|||||||
import org.xyzh.common.utils.IDUtils;
|
import org.xyzh.common.utils.IDUtils;
|
||||||
import org.xyzh.common.utils.StringUtils;
|
import org.xyzh.common.utils.StringUtils;
|
||||||
import org.xyzh.system.mapper.dept.TbSysDeptMapper;
|
import org.xyzh.system.mapper.dept.TbSysDeptMapper;
|
||||||
import org.xyzh.system.mapper.dept.TbSysDeptRoleMapper;
|
|
||||||
import org.xyzh.system.mapper.role.TbSysRoleMapper;
|
import org.xyzh.system.mapper.role.TbSysRoleMapper;
|
||||||
import org.xyzh.system.mapper.role.TbSysRolePermissionMapper;
|
import org.xyzh.system.mapper.role.TbSysRolePermissionMapper;
|
||||||
import org.xyzh.system.mapper.user.TbSysUserRoleMapper;
|
import org.xyzh.system.mapper.user.TbSysUserRoleMapper;
|
||||||
@@ -56,9 +55,6 @@ public class DeptRoleServiceImpl implements DeptRoleService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TbSysRoleMapper roleMapper;
|
private TbSysRoleMapper roleMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private TbSysDeptRoleMapper deptRoleMapper;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TbSysUserRoleMapper userRoleMapper;
|
private TbSysUserRoleMapper userRoleMapper;
|
||||||
|
|
||||||
@@ -286,96 +282,6 @@ public class DeptRoleServiceImpl implements DeptRoleService {
|
|||||||
return ResultDomain.success("根据用户获取角色成功", roleList);
|
return ResultDomain.success("根据用户获取角色成功", roleList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultDomain<TbSysDeptRoleDTO> insertDeptRole(TbSysDeptRoleDTO deptRoleDTO) {
|
|
||||||
if (deptRoleDTO == null || StringUtils.isBlank(deptRoleDTO.getDeptId()) || StringUtils.isBlank(deptRoleDTO.getRoleId())) {
|
|
||||||
return ResultDomain.failure(MSG_DEPT_ROLE_ID_REQUIRED);
|
|
||||||
}
|
|
||||||
if (deptRoleDTO.getCreateTime() == null) {
|
|
||||||
deptRoleDTO.setCreateTime(new Date());
|
|
||||||
}
|
|
||||||
if (deptRoleDTO.getDeleted() == null) {
|
|
||||||
deptRoleDTO.setDeleted(false);
|
|
||||||
}
|
|
||||||
int rows = deptRoleMapper.insertDeptRole(deptRoleDTO);
|
|
||||||
if (rows > 0) {
|
|
||||||
logger.info("新增部门角色关联成功, deptId={}, roleId={}", deptRoleDTO.getDeptId(), deptRoleDTO.getRoleId());
|
|
||||||
return ResultDomain.success("新增部门角色关联成功", deptRoleDTO);
|
|
||||||
}
|
|
||||||
logger.warn("新增部门角色关联失败, deptId={}, roleId={}", deptRoleDTO.getDeptId(), deptRoleDTO.getRoleId());
|
|
||||||
return ResultDomain.failure("新增部门角色关联失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultDomain<TbSysDeptRoleDTO> updateDeptRole(TbSysDeptRoleDTO deptRoleDTO) {
|
|
||||||
if (deptRoleDTO == null || StringUtils.isBlank(deptRoleDTO.getDeptId()) || StringUtils.isBlank(deptRoleDTO.getRoleId())) {
|
|
||||||
return ResultDomain.failure(MSG_DEPT_ROLE_ID_REQUIRED);
|
|
||||||
}
|
|
||||||
deptRoleDTO.setUpdateTime(new Date());
|
|
||||||
int rows = deptRoleMapper.updateDeptRole(deptRoleDTO);
|
|
||||||
if (rows > 0) {
|
|
||||||
logger.info("更新部门角色关联成功, deptId={}, roleId={}", deptRoleDTO.getDeptId(), deptRoleDTO.getRoleId());
|
|
||||||
return ResultDomain.success("更新部门角色关联成功", deptRoleDTO);
|
|
||||||
}
|
|
||||||
logger.warn("更新部门角色关联失败, deptId={}, roleId={}", deptRoleDTO.getDeptId(), deptRoleDTO.getRoleId());
|
|
||||||
return ResultDomain.failure("更新部门角色关联失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultDomain<Boolean> deleteDeptRole(TbSysDeptRoleDTO deptRoleDTO) {
|
|
||||||
if (deptRoleDTO == null || StringUtils.isBlank(deptRoleDTO.getDeptId()) || StringUtils.isBlank(deptRoleDTO.getRoleId())) {
|
|
||||||
return ResultDomain.failure(MSG_DEPT_ROLE_ID_REQUIRED);
|
|
||||||
}
|
|
||||||
int rows = deptRoleMapper.deleteDeptRole(deptRoleDTO);
|
|
||||||
if (rows > 0) {
|
|
||||||
logger.info("删除部门角色关联成功, deptId={}, roleId={}", deptRoleDTO.getDeptId(), deptRoleDTO.getRoleId());
|
|
||||||
return ResultDomain.success("删除部门角色关联成功", Boolean.TRUE);
|
|
||||||
}
|
|
||||||
logger.warn("删除部门角色关联失败, deptId={}, roleId={}", deptRoleDTO.getDeptId(), deptRoleDTO.getRoleId());
|
|
||||||
return ResultDomain.failure("删除部门角色关联失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultDomain<UserDeptRoleVO> getDeptRole(UserDeptRoleVO filter) {
|
|
||||||
TbSysDeptRoleDTO dto = UserDeptRoleVO.toDeptRoleDTO(filter);
|
|
||||||
if (dto == null) {
|
|
||||||
return ResultDomain.failure(MSG_QUERY_PARAM_REQUIRED);
|
|
||||||
}
|
|
||||||
List<PermissionVO> permissionList = deptRoleMapper.getDeptRoleByFilter(dto);
|
|
||||||
if (permissionList == null || permissionList.isEmpty()) {
|
|
||||||
return ResultDomain.failure("未找到部门角色关联");
|
|
||||||
}
|
|
||||||
UserDeptRoleVO result = UserDeptRoleVO.fromPermission(permissionList.get(0));
|
|
||||||
return ResultDomain.success("获取部门角色关联成功", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultDomain<UserDeptRoleVO> getDeptRoleList(UserDeptRoleVO filter) {
|
|
||||||
TbSysDeptRoleDTO dto = UserDeptRoleVO.toDeptRoleDTO(filter);
|
|
||||||
List<PermissionVO> permissionList = deptRoleMapper.getDeptRoleByFilter(dto);
|
|
||||||
List<UserDeptRoleVO> result = (permissionList == null || permissionList.isEmpty()) ?
|
|
||||||
java.util.Collections.emptyList() :
|
|
||||||
permissionList.stream().map(UserDeptRoleVO::fromPermission).filter(java.util.Objects::nonNull).toList();
|
|
||||||
return ResultDomain.success("获取部门角色关联列表成功", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultDomain<UserDeptRoleVO> getDeptRolePage(PageRequest<UserDeptRoleVO> pageRequest) {
|
|
||||||
if (pageRequest == null) {
|
|
||||||
return ResultDomain.failure(MSG_PAGE_PARAM_REQUIRED);
|
|
||||||
}
|
|
||||||
PageParam pageParam = pageRequest.getPageParam();
|
|
||||||
TbSysDeptRoleDTO filter = UserDeptRoleVO.toDeptRoleDTO(pageRequest.getFilter());
|
|
||||||
int total = deptRoleMapper.getDeptRoleCount(filter);
|
|
||||||
pageParam.setTotal(total);
|
|
||||||
pageParam.setTotalPages(pageParam.getPageSize() == 0 ? 0 : (int) Math.ceil((double) total / pageParam.getPageSize()));
|
|
||||||
List<PermissionVO> permissionList = deptRoleMapper.getDeptRolePageByFilter(filter, pageParam);
|
|
||||||
List<UserDeptRoleVO> data = (permissionList == null || permissionList.isEmpty()) ?
|
|
||||||
java.util.Collections.emptyList() :
|
|
||||||
permissionList.stream().map(UserDeptRoleVO::fromPermission).filter(java.util.Objects::nonNull).toList();
|
|
||||||
PageDomain<UserDeptRoleVO> pageDomain = new PageDomain<>(pageParam, data);
|
|
||||||
return ResultDomain.success("分页查询部门角色关联成功", pageDomain);
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public ResultDomain<PermissionVO> setRolePermission(PermissionVO permissionVO) {
|
public ResultDomain<PermissionVO> setRolePermission(PermissionVO permissionVO) {
|
||||||
if (permissionVO == null || StringUtils.isBlank(permissionVO.getRoleId())) {
|
if (permissionVO == null || StringUtils.isBlank(permissionVO.getRoleId())) {
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import org.xyzh.common.dto.sys.TbSysViewDTO;
|
|||||||
import org.xyzh.common.dto.sys.TbSysViewPermissionDTO;
|
import org.xyzh.common.dto.sys.TbSysViewPermissionDTO;
|
||||||
import org.xyzh.common.utils.IDUtils;
|
import org.xyzh.common.utils.IDUtils;
|
||||||
import org.xyzh.common.utils.StringUtils;
|
import org.xyzh.common.utils.StringUtils;
|
||||||
import org.xyzh.system.mapper.permission.TbSysViewPermissionMapper;
|
|
||||||
import org.xyzh.system.mapper.view.TbSysViewMapper;
|
import org.xyzh.system.mapper.view.TbSysViewMapper;
|
||||||
|
import org.xyzh.system.mapper.view.TbSysViewPermissionMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 视图服务实现类
|
* @description 视图服务实现类
|
||||||
|
|||||||
@@ -1,203 +0,0 @@
|
|||||||
<?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="org.xyzh.system.mapper.dept.TbSysDeptRoleMapper">
|
|
||||||
|
|
||||||
<!-- 结果映射 -->
|
|
||||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.sys.TbSysDeptRoleDTO">
|
|
||||||
<!-- 部门角色关系字段 -->
|
|
||||||
<id column="dept_id" property="deptId" jdbcType="VARCHAR"/>
|
|
||||||
<id column="role_id" property="roleId" jdbcType="VARCHAR"/>
|
|
||||||
<!-- 基础字段 -->
|
|
||||||
<result column="optsn" property="optsn" jdbcType="VARCHAR"/>
|
|
||||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
|
||||||
<result column="updater" property="updater" jdbcType="VARCHAR"/>
|
|
||||||
<result column="dept_path" property="deptPath" jdbcType="VARCHAR"/>
|
|
||||||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
|
||||||
<result column="create_time" property="createTime" jdbcType="DATE"/>
|
|
||||||
<result column="update_time" property="updateTime" jdbcType="DATE"/>
|
|
||||||
<result column="delete_time" property="deleteTime" jdbcType="DATE"/>
|
|
||||||
<result column="deleted" property="deleted" jdbcType="Boolean"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<!-- VO结果映射(用于前端展示) -->
|
|
||||||
<resultMap id="PermissionVOResultMap" type="org.xyzh.api.system.vo.PermissionVO">
|
|
||||||
<!-- 部门字段 -->
|
|
||||||
<result column="dept_id" property="deptId" jdbcType="VARCHAR"/>
|
|
||||||
<result column="dept_name" property="deptName" jdbcType="VARCHAR"/>
|
|
||||||
<result column="parent_id" property="deptParentId" jdbcType="VARCHAR"/>
|
|
||||||
<result column="dept_description" property="deptDescription" jdbcType="VARCHAR"/>
|
|
||||||
<!-- 角色字段 -->
|
|
||||||
<result column="role_id" property="roleId" jdbcType="VARCHAR"/>
|
|
||||||
<result column="role_name" property="roleName" jdbcType="VARCHAR"/>
|
|
||||||
<result column="role_description" property="roleDescription" jdbcType="VARCHAR"/>
|
|
||||||
<result column="scope" property="roleScope" jdbcType="VARCHAR"/>
|
|
||||||
<result column="owner_dept_id" property="roleOwnerDeptId" jdbcType="VARCHAR"/>
|
|
||||||
<result column="role_status" property="roleStatus" jdbcType="Boolean"/>
|
|
||||||
<!-- BaseVO 基础字段 -->
|
|
||||||
<result column="optsn" property="optsn" jdbcType="VARCHAR"/>
|
|
||||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
|
||||||
<result column="updater" property="updater" jdbcType="VARCHAR"/>
|
|
||||||
<result column="dept_path" property="deptPath" jdbcType="VARCHAR"/>
|
|
||||||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
|
||||||
<result column="create_time" property="createTime" jdbcType="DATE"/>
|
|
||||||
<result column="update_time" property="updateTime" jdbcType="DATE"/>
|
|
||||||
<result column="delete_time" property="deleteTime" jdbcType="DATE"/>
|
|
||||||
<result column="deleted" property="deleted" jdbcType="Boolean"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<!-- 基础列 -->
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
dept_id, role_id,
|
|
||||||
optsn, creator, updater, dept_path, remark, create_time, update_time, delete_time, deleted
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<!-- 插入系统部门角色关系(必填 + 可选字段动态列,仅修改 insert) -->
|
|
||||||
<insert id="insertDeptRole" parameterType="org.xyzh.common.dto.sys.TbSysDeptRoleDTO">
|
|
||||||
INSERT INTO sys.tb_sys_dept_role
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<!-- 必填字段:dept_id, role_id, optsn -->
|
|
||||||
dept_id,
|
|
||||||
role_id,
|
|
||||||
optsn,
|
|
||||||
<!-- 可选字段:根据是否有值动态拼接 -->
|
|
||||||
<if test="creator != null and creator != ''">creator,</if>
|
|
||||||
<if test="deptPath != null and deptPath != ''">dept_path,</if>
|
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="deleteTime != null">delete_time,</if>
|
|
||||||
<if test="deleted != null">deleted,</if>
|
|
||||||
</trim>
|
|
||||||
VALUES
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<!-- 必填字段值 -->
|
|
||||||
#{deptId},
|
|
||||||
#{roleId},
|
|
||||||
#{optsn},
|
|
||||||
<!-- 可选字段值 -->
|
|
||||||
<if test="creator != null and creator != ''">#{creator},</if>
|
|
||||||
<if test="deptPath != null and deptPath != ''">#{deptPath},</if>
|
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="deleteTime != null">#{deleteTime},</if>
|
|
||||||
<if test="deleted != null">#{deleted},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<!-- 更新系统部门角色关系 -->
|
|
||||||
<update id="updateDeptRole" parameterType="org.xyzh.common.dto.sys.TbSysDeptRoleDTO">
|
|
||||||
UPDATE sys.tb_sys_dept_role
|
|
||||||
<set>
|
|
||||||
<if test="updater != null and updater != ''">
|
|
||||||
updater = #{updater},
|
|
||||||
</if>
|
|
||||||
<if test="deptPath != null and deptPath != ''">
|
|
||||||
dept_path = #{deptPath},
|
|
||||||
</if>
|
|
||||||
<if test="remark != null">
|
|
||||||
remark = #{remark},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
update_time = #{updateTime},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
WHERE dept_id = #{deptId} AND role_id = #{roleId}
|
|
||||||
<if test="deleted != null">
|
|
||||||
AND deleted = #{deleted}
|
|
||||||
</if>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<!-- 删除系统部门角色关系 -->
|
|
||||||
<update id="deleteDeptRole" parameterType="org.xyzh.common.dto.sys.TbSysDeptRoleDTO">
|
|
||||||
UPDATE sys.tb_sys_dept_role
|
|
||||||
SET deleted = true,
|
|
||||||
delete_time = NOW()
|
|
||||||
WHERE dept_id = #{deptId} AND role_id = #{roleId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<!-- 根据部门ID和角色ID查询系统部门角色关系 -->
|
|
||||||
<select id="getDeptRoleByDeptId" resultMap="PermissionVOResultMap">
|
|
||||||
SELECT
|
|
||||||
dr.dept_id, dr.role_id,
|
|
||||||
d.dept_id, d.name AS dept_name, d.parent_id, d.description AS dept_description,
|
|
||||||
r.role_id, r.name AS role_name, r.description AS role_description, r.scope, r.owner_dept_id, r.status AS role_status,
|
|
||||||
dr.optsn, dr.creator, dr.updater, dr.dept_path, dr.remark, dr.create_time, dr.update_time, dr.delete_time, dr.deleted
|
|
||||||
FROM sys.tb_sys_dept_role dr
|
|
||||||
LEFT JOIN sys.tb_sys_dept d ON dr.dept_id = d.dept_id AND (d.deleted IS NULL OR d.deleted = false)
|
|
||||||
LEFT JOIN sys.tb_sys_role r ON dr.role_id = r.role_id AND (r.deleted IS NULL OR r.deleted = false)
|
|
||||||
WHERE dr.dept_id = #{deptId} AND dr.role_id = #{roleId}
|
|
||||||
AND (dr.deleted IS NULL OR dr.deleted = false)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据条件查询系统部门角色关系列表 -->
|
|
||||||
<select id="getDeptRoleByFilter" resultMap="PermissionVOResultMap" parameterType="org.xyzh.common.dto.sys.TbSysDeptRoleDTO">
|
|
||||||
SELECT DISTINCT
|
|
||||||
dr.dept_id, dr.role_id,
|
|
||||||
d.dept_id, d.name AS dept_name, d.parent_id, d.description AS dept_description,
|
|
||||||
r.role_id, r.name AS role_name, r.description AS role_description, r.scope, r.owner_dept_id, r.status AS role_status,
|
|
||||||
dr.optsn, dr.creator, dr.updater, dr.dept_path, dr.remark, dr.create_time, dr.update_time, dr.delete_time, dr.deleted
|
|
||||||
FROM sys.tb_sys_dept_role dr
|
|
||||||
LEFT JOIN sys.tb_sys_dept d ON dr.dept_id = d.dept_id AND (d.deleted IS NULL OR d.deleted = false)
|
|
||||||
LEFT JOIN sys.tb_sys_role r ON dr.role_id = r.role_id AND (r.deleted IS NULL OR r.deleted = false)
|
|
||||||
<where>
|
|
||||||
<if test="filter.deptId != null and filter.deptId != ''">
|
|
||||||
AND dr.dept_id = #{filter.deptId}
|
|
||||||
</if>
|
|
||||||
<if test="filter.roleId != null and filter.roleId != ''">
|
|
||||||
AND dr.role_id = #{filter.roleId}
|
|
||||||
</if>
|
|
||||||
<if test="filter.deptPath != null and filter.deptPath != ''">
|
|
||||||
AND dr.dept_path LIKE CONCAT(#{filter.deptPath}, '%')
|
|
||||||
</if>
|
|
||||||
AND (dr.deleted IS NULL OR dr.deleted = false)
|
|
||||||
</where>
|
|
||||||
ORDER BY dr.create_time DESC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据条件查询系统部门角色关系分页列表 -->
|
|
||||||
<select id="getDeptRolePageByFilter" resultMap="PermissionVOResultMap">
|
|
||||||
SELECT DISTINCT
|
|
||||||
dr.dept_id, dr.role_id,
|
|
||||||
d.dept_id, d.name AS dept_name, d.parent_id, d.description AS dept_description,
|
|
||||||
r.role_id, r.name AS role_name, r.description AS role_description, r.scope, r.owner_dept_id, r.status AS role_status,
|
|
||||||
dr.optsn, dr.creator, dr.updater, dr.dept_path, dr.remark, dr.create_time, dr.update_time, dr.delete_time, dr.deleted
|
|
||||||
FROM sys.tb_sys_dept_role dr
|
|
||||||
LEFT JOIN sys.tb_sys_dept d ON dr.dept_id = d.dept_id AND (d.deleted IS NULL OR d.deleted = false)
|
|
||||||
LEFT JOIN sys.tb_sys_role r ON dr.role_id = r.role_id AND (r.deleted IS NULL OR r.deleted = false)
|
|
||||||
<where>
|
|
||||||
<if test="filter.deptId != null and filter.deptId != ''">
|
|
||||||
AND dr.dept_id = #{filter.deptId}
|
|
||||||
</if>
|
|
||||||
<if test="filter.roleId != null and filter.roleId != ''">
|
|
||||||
AND dr.role_id = #{filter.roleId}
|
|
||||||
</if>
|
|
||||||
<if test="filter.deptPath != null and filter.deptPath != ''">
|
|
||||||
AND dr.dept_path LIKE CONCAT(#{filter.deptPath}, '%')
|
|
||||||
</if>
|
|
||||||
AND (dr.deleted IS NULL OR dr.deleted = false)
|
|
||||||
</where>
|
|
||||||
ORDER BY dr.create_time DESC
|
|
||||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据条件查询系统部门角色关系数量 -->
|
|
||||||
<select id="getDeptRoleCount" resultType="java.lang.Integer" parameterType="org.xyzh.common.dto.sys.TbSysDeptRoleDTO">
|
|
||||||
SELECT COUNT(1)
|
|
||||||
FROM sys.tb_sys_dept_role
|
|
||||||
<where>
|
|
||||||
<if test="filter.deptId != null and filter.deptId != ''">
|
|
||||||
AND dept_id = #{filter.deptId}
|
|
||||||
</if>
|
|
||||||
<if test="filter.roleId != null and filter.roleId != ''">
|
|
||||||
AND role_id = #{filter.roleId}
|
|
||||||
</if>
|
|
||||||
<if test="filter.deptPath != null and filter.deptPath != ''">
|
|
||||||
AND dept_path LIKE CONCAT(#{filter.deptPath}, '%')
|
|
||||||
</if>
|
|
||||||
AND (deleted IS NULL OR deleted = false)
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.xyzh.system.mapper.permission.TbSysViewPermissionMapper">
|
<mapper namespace="org.xyzh.system.mapper.view.TbSysViewPermissionMapper">
|
||||||
|
|
||||||
<!-- 结果映射 -->
|
<!-- 结果映射 -->
|
||||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.sys.TbSysViewPermissionDTO">
|
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.sys.TbSysViewPermissionDTO">
|
||||||
Reference in New Issue
Block a user