| | |
| | | package com.ruoyi.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDept dept)
|
| | | {
|
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
| | | }
|
| | |
| | | {
|
| | | Long deptId = dept.getDeptId();
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 保存部门排序
|
| | | */
|
| | | @RequiresPermissions("system:dept:edit")
|
| | | @Log(title = "保存部门排序", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/updateSort")
|
| | | public AjaxResult updateSort(@RequestBody Map<String, String> params)
|
| | | {
|
| | | String[] deptIds = params.get("deptIds").split(",");
|
| | | String[] orderNums = params.get("orderNums").split(",");
|
| | | deptService.updateDeptSort(deptIds, orderNums);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除部门
|
| | | */
|
| | | @RequiresPermissions("system:dept:remove")
|