| | |
| | | return removeByIds(Func.toLongList(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 提交部门信息 |
| | | * |
| | | * @param dept 部门信息 |
| | | * @return 是否操作成功 |
| | | */ |
| | | @Override |
| | | public boolean submit(Dept dept) { |
| | | log.info("提交数据:{}", JSON.toJSONString(dept)); |
| | | // 处理父节点信息 |
| | | if (Func.isEmpty(dept.getParentId())) { |
| | | dept.setTenantId(AuthUtil.getTenantId()); |
| | | dept.setParentId(BladeConstant.TOP_PARENT_ID); |
| | |
| | | String ancestors = parent.getAncestors() + StringPool.COMMA + dept.getParentId(); |
| | | dept.setAncestors(ancestors); |
| | | } |
| | | |
| | | // 处理ID重复问题:如果ID存在但记录不存在,设置ID为null让MyBatis-Plus重新生成 |
| | | if (dept.getId() != null) { |
| | | Dept existingDept = getById(dept.getId()); |
| | | if (existingDept == null) { |
| | | dept.setId(null); |
| | | } |
| | | } |
| | | |
| | | dept.setIsDeleted(BladeConstant.DB_NOT_DELETED); |
| | | return saveOrUpdate(dept); |
| | | } |