|
@@ -159,9 +159,6 @@ public class SysDeptController extends BaseController
|
|
|
@Transactional
|
|
|
public AjaxResult save(@Validated @RequestBody SysDept dept) throws NoSuchFieldException, IllegalAccessException {
|
|
|
|
|
|
- String tenantId = request.getHeader("tenantId");
|
|
|
- dept.setTenantId(Long.parseLong(tenantId) == 0?1L:Long.valueOf(tenantId));
|
|
|
-
|
|
|
Long deptId = dept.getDeptId();
|
|
|
// 判断没有id的进行新增操作
|
|
|
if(deptId == null){
|
|
@@ -197,6 +194,13 @@ public class SysDeptController extends BaseController
|
|
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
|
|
return error("该部门包含未停用的子部门!");
|
|
|
}
|
|
|
+ //判断是否可以改厂别,如果当前工段下没有员工允许改
|
|
|
+ SysDept oldDept = deptService.getDeptByDeptId(deptId);
|
|
|
+ if(oldDept.getTenantId() != dept.getTenantId()){
|
|
|
+ if(deptUserService.query().eq("dept_id",deptId).count()>0){
|
|
|
+ return error("该部门下存在员工,不允许修改厂别");
|
|
|
+ }
|
|
|
+ }
|
|
|
dept.setUpdateBy(getUsername());
|
|
|
return toAjax(deptService.updateDept(dept));
|
|
|
}
|
|
@@ -209,8 +213,6 @@ public class SysDeptController extends BaseController
|
|
|
@Log(title = "部门管理修改", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@Validated @RequestBody SysDept dept) throws NoSuchFieldException, IllegalAccessException {
|
|
|
- String tenantId = request.getHeader("tenantId");
|
|
|
- dept.setTenantId(Long.valueOf(tenantId));
|
|
|
Long deptId = dept.getDeptId();
|
|
|
deptService.checkDeptDataScope(deptId);
|
|
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|