| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.TreeSelect; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | */ |
| | | @ApiOperation("获取部门下拉树列表") |
| | | @GetMapping("/treeselect") |
| | | public AjaxResult<List<TreeSelect>> treeselect(SysDept dept) { |
| | | public AjaxResult<List<Tree<Long>>> treeselect(SysDept dept) { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); |
| | | } |
| | |
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { |
| | | return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(getUsername()); |
| | | return toAjax(deptService.insertDept(dept)); |
| | | } |
| | | |
| | |
| | | && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) { |
| | | return AjaxResult.error("该部门包含未停用的子部门!"); |
| | | } |
| | | dept.setUpdateBy(getUsername()); |
| | | return toAjax(deptService.updateDept(dept)); |
| | | } |
| | | |