|
@@ -341,14 +341,17 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|
|
public int insertDept(SysDeptBo bo) {
|
|
public int insertDept(SysDeptBo bo) {
|
|
|
SysDept info = baseMapper.selectById(bo.getParentId());
|
|
SysDept info = baseMapper.selectById(bo.getParentId());
|
|
|
// 如果父节点不为正常状态,则不允许新增子节点
|
|
// 如果父节点不为正常状态,则不允许新增子节点
|
|
|
- if (!SystemConstants.NORMAL.equals(info.getStatus())) {
|
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(info) && !SystemConstants.NORMAL.equals(info.getStatus())) {
|
|
|
throw new ServiceException("部门停用,不允许新增");
|
|
throw new ServiceException("部门停用,不允许新增");
|
|
|
}
|
|
}
|
|
|
if (bo.getOrderNum() == null || bo.getOrderNum() < 0) {
|
|
if (bo.getOrderNum() == null || bo.getOrderNum() < 0) {
|
|
|
bo.setOrderNum(baseMapper.selectMaxOrderNumByParentId(bo.getParentId()));
|
|
bo.setOrderNum(baseMapper.selectMaxOrderNumByParentId(bo.getParentId()));
|
|
|
}
|
|
}
|
|
|
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
|
|
SysDept dept = MapstructUtils.convert(bo, SysDept.class);
|
|
|
- dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
|
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(info)) {
|
|
|
|
|
+ dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
|
|
|
|
|
+ }
|
|
|
|
|
+// dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
|
|
|
// 1. 校验当前是否为总控平台(main),否则不能指定 platformCode
|
|
// 1. 校验当前是否为总控平台(main),否则不能指定 platformCode
|
|
|
String currentPlatform = PlatformContext.getPlatform();
|
|
String currentPlatform = PlatformContext.getPlatform();
|
|
|
if (StringUtils.isEmpty(currentPlatform)) {
|
|
if (StringUtils.isEmpty(currentPlatform)) {
|