package com.sooka.sponest.mobile.system.dept; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.system.api.domain.SysDept; import com.sooka.sponest.mobile.remoteapi.RemoteSystemBaseService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; /** * @Author LG * @Date 2023/10/11 - 9:57 */ @RestController @RequestMapping("/dept") public class DeptController { @Resource RemoteSystemBaseService remoteSystemBaseService; @GetMapping("/userDeptSelectIncludeChildren") public AjaxResult getUserList(SysDept sysDept) { AjaxResult deptList = remoteSystemBaseService.userDeptSelectIncludeChildren(String.valueOf(sysDept.getDeptId())); return AjaxResult.success(deptList.get("data")); } /** * 获取当日用户的所属部门 * * @return */ @GetMapping("/userDeptSelect") public AjaxResult getUserDeptSelect() { AjaxResult result = remoteSystemBaseService.getUserDeptSelect(); if ("200".equals(String.valueOf(result.get("code")))) { List> data = (List>) result.get("data"); if(!data.isEmpty()){ List> resultList = new ArrayList<>(); HashMap map = new HashMap<>(); map.put("deptId", data.get(0).get("id")); map.put("deptName", data.get(0).get("label")); resultList.add(map); return AjaxResult.success(resultList); }else{ return AjaxResult.error("500", "data is null"); } } else { return AjaxResult.error(String.valueOf(result.get("code")), result.get("msg")); } } /** * 根据部门ID和岗位ID查询子节点集合 * @param deptId * @param postId * @return */ @GetMapping("/getChildren") public AjaxResult getChildren(@RequestParam("deptId") String deptId, @RequestParam("postId") String postId) { return remoteSystemBaseService.getChildren(deptId, postId); } /** * 查询所属开发区 * @param sysDept * @return */ @PostMapping("/getDeptsByDeptType") public AjaxResult getDeptsByDeptType(@RequestBody SysDept sysDept){ sysDept.setDeptType("sys_dept_type_27"); return remoteSystemBaseService.getDeptsByDeptType(sysDept); } }