From 8444084e6aa11efa23287e7f82474ac22378a5c4 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 01 四月 2025 16:03:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtStaffController.java | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 40 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtStaffController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtStaffController.java index 29cc75a..6a24756 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtStaffController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtStaffController.java @@ -8,6 +8,8 @@ import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; +import com.ruoyi.system.api.domain.poji.sys.SysUser; +import com.ruoyi.system.api.service.RemoteUserService; import com.ruoyi.system.domain.dto.*; import com.ruoyi.system.domain.vo.MgtDeptStaffListVo; import com.ruoyi.system.domain.vo.MgtStaffPageVo; @@ -23,6 +25,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; import static com.ruoyi.common.core.web.domain.AjaxResult.success; @@ -39,7 +42,8 @@ @RequestMapping("/mgt/staff") public class MgtStaffController { - + @Resource + private RemoteUserService sysUserService; @Resource private StaffSuggestService staffSuggestService; @@ -49,11 +53,44 @@ @RequestMapping(value = "/listMgtDeptStaff", method = RequestMethod.POST) @ApiOperation(value = "获取部门员工列表") - public R<List<MgtDeptStaffListVo>> listMgtDeptStaff() { - List<MgtDeptStaffListVo> mgtDeptStaffListVoList= sysStaffService.listMgtDeptStaff(); + public R<List<MgtDeptStaffListVo>> listMgtDeptStaff(@RequestBody ListMgtDeptStaffDto listMgtDeptStaffDto) { + // 获取当前登陆人的可视权限 + SysUser sysUser = SecurityUtils.getSysUser(); + // 如果当前登陆人权限是查看部门数据 + Long deptId = null; + // 如果当前登陆人是查看个人数据 + Long userId = null; + if (sysUser!=null){ + String dataScope = sysUser.getDataScope(); + if (!sysUser.getUserName().equals("admin")){ + if (org.springframework.util.StringUtils.hasLength(dataScope)){ + switch (dataScope){ + case "3": + // 本部门数据 查询当前登陆人属于哪个部门 查询这个部门下所有员工关联的所有店铺 + deptId = sysUser.getDeptId(); + break; + case "5": + // 仅个人数据 查询当前登陆人关联店铺下的用户 + userId = sysUser.getUserId(); + break; + } + } + } + } + List<MgtDeptStaffListVo> mgtDeptStaffListVoList= sysStaffService.listMgtDeptStaff(deptId,userId, listMgtDeptStaffDto.getName()); return R.ok(mgtDeptStaffListVoList); } + + @RequestMapping(value = "/listDeptStaff", method = RequestMethod.POST) + @ApiOperation(value = "获取所有部门员工列表") + public R<List<MgtDeptStaffListVo>> listDeptStaff() { + List<MgtDeptStaffListVo> mgtDeptStaffListVoList= sysStaffService.listMgtDeptStaff(null,null, null); + return R.ok(mgtDeptStaffListVoList); + } + + + @RequestMapping(value = "/listMgtDeptStaffByPermission", method = RequestMethod.POST) @ApiOperation(value = "通过权限获取部门员工列表") public R<List<MgtDeptStaffListVo>> listMgtDeptStaffByPermission() { -- Gitblit v1.7.1