| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | /** |
| | | * 部门信息 |
| | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | /** |
| | | * 获取部门列表 |
| | | */ |
| | |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 基于当前用户的 OA_OrderClass 返回分公司列表 |
| | | */ |
| | | @GetMapping("/branch/by-oa") |
| | | public AjaxResult listBranchByOaOrderClass() |
| | | { |
| | | com.ruoyi.common.core.domain.model.LoginUser loginUser = com.ruoyi.common.utils.SecurityUtils.getLoginUser(); |
| | | com.ruoyi.common.core.domain.entity.SysUser user = loginUser.getUser(); |
| | | java.util.List<com.ruoyi.common.core.domain.entity.SysDept> result = deptService.computeBranchCompaniesForUser(user); |
| | | return success(result); |
| | | } |
| | | |
| | | /** |
| | | * 基于指定用户ID的 OA_OrderClass 返回分公司列表,并附加该用户所属分公司 |
| | | */ |
| | | @GetMapping("/branch/by-user/{userId}") |
| | | public AjaxResult listBranchByUser(@PathVariable("userId") Long userId) |
| | | { |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysDept> result = deptService.computeBranchCompaniesForUser(user); |
| | | return success(result); |
| | | } |
| | | |
| | | /** |
| | |
| | | deptService.checkDeptDataScope(deptId); |
| | | return toAjax(deptService.deleteDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据service_class查询部门信息 |
| | | */ |
| | | @GetMapping("/service-class/{serviceClass}") |
| | | public AjaxResult getDeptByServiceClass(@PathVariable String serviceClass) |
| | | { |
| | | SysDept dept = deptService.selectDeptByServiceClass(serviceClass); |
| | | if (dept != null) { |
| | | return success(dept); |
| | | } else { |
| | | return error("未找到对应的部门信息"); |
| | | } |
| | | } |
| | | } |