| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/dept")
|
| | | @AllArgsConstructor
|
| | | public class SysDeptController extends BaseController
|
| | | {
|
| | | @Autowired
|
| | | private ISysDeptService deptService;
|
| | |
|
| | | /**
|
| | |
| | | @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() + "'失败,部门名称已存在");
|
| | | }
|