| | |
| | | @Override |
| | | public int insertDept(SysDept dept) |
| | | { |
| | | SysDept info = deptMapper.selectDeptById(dept.getParentId()); |
| | | // 如果父节点不为正常状态,则不允许新增子节点 |
| | | if (null != info && !UserConstants.DEPT_NORMAL.equals(info.getStatus())) |
| | | { |
| | | throw new ServiceException("部门停用,不允许新增"); |
| | | } |
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); |
| | | // SysDept info = deptMapper.selectDeptById(dept.getParentId()); |
| | | // // 如果父节点不为正常状态,则不允许新增子节点 |
| | | // if (null != info && !UserConstants.DEPT_NORMAL.equals(info.getStatus())) |
| | | // { |
| | | // throw new ServiceException("部门停用,不允许新增"); |
| | | // } |
| | | // dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); |
| | | //判断店铺数据 |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | |
| | | @Override |
| | | public int updateDept(SysDept dept) |
| | | { |
| | | SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); |
| | | SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); |
| | | if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) { |
| | | String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); |
| | | String oldAncestors = oldDept.getAncestors(); |
| | | dept.setAncestors(newAncestors); |
| | | updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); |
| | | } |
| | | // SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); |
| | | // SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); |
| | | // if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) { |
| | | // String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); |
| | | // String oldAncestors = oldDept.getAncestors(); |
| | | // dept.setAncestors(newAncestors); |
| | | // updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); |
| | | // } |
| | | //判断店铺数据 |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |