| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDept dept)
|
| | | {
|
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
| | | }
|
| | | dept.setCreateBy(getUsername());
|
| | | dept.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
| | | return toAjax(deptService.insertDept(dept));
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | Long deptId = dept.getDeptId();
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
| | | }
|