| | |
| | | organizationDTO.setMsg(ResponseCodeEnum.ORGANIZATION_EXIST.getMsg()); |
| | | return organizationDTO; |
| | | } |
| | | //查询父组织是否存在 |
| | | Integer parentId = organization.getParentId(); |
| | | Organization parentOrganization = new Organization(); |
| | | if (!ObjectUtils.isEmpty(parentId)) { |
| | | parentOrganization.setId(parentId); |
| | | parentOrganization.setIsDelete(Constants.NOT_DELETE); |
| | | queryWrapper.setEntity(parentOrganization); |
| | | parentOrganization = organizationMapper.selectOne(queryWrapper); |
| | | if (ObjectUtils.isEmpty(parentOrganization)) { |
| | | organizationDTO.setCode(ResponseCodeEnum.ORGANIZATION_PARENT_NOT_EXIST.getCode()); |
| | | organizationDTO.setMsg(ResponseCodeEnum.ORGANIZATION_PARENT_NOT_EXIST.getMsg()); |
| | | return organizationDTO; |
| | | } |
| | | } |
| | | //插入组织 |
| | | organizationMapper.insert(organization); |
| | | |
| | | //封装DTO信息 |
| | | organizationDTO.setParentOrganization(parentOrganization); |
| | | organizationDTO.setOrganization(organization); |
| | | organizationDTO.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | organizationDTO.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | |
| | |
| | | return organizationDTO; |
| | | } |
| | | |
| | | //如果更改了父组织,查询父组织是否存在 |
| | | Integer parentId = organization.getParentId(); |
| | | Organization parentOrganization = new Organization(); |
| | | if (!ObjectUtils.isEmpty(parentId) && parentId != 0) { |
| | | QueryWrapper<Organization> existParentWrapper = new QueryWrapper<>(); |
| | | parentOrganization.setId(parentId); |
| | | parentOrganization.setIsDelete(Constants.NOT_DELETE); |
| | | existParentWrapper.setEntity(parentOrganization); |
| | | parentOrganization = organizationMapper.selectOne(existParentWrapper); |
| | | if (ObjectUtils.isEmpty(parentOrganization)) { |
| | | organizationDTO.setCode(ResponseCodeEnum.ORGANIZATION_PARENT_NOT_EXIST.getCode()); |
| | | organizationDTO.setMsg(ResponseCodeEnum.ORGANIZATION_PARENT_NOT_EXIST.getMsg()); |
| | | return organizationDTO; |
| | | } |
| | | } |
| | | |
| | | //更新组织 |
| | | organizationMapper.updateById(organization); |
| | |
| | | organization = organizationMapper.selectById(organization.getId()); |
| | | |
| | | //封装DTO信息 |
| | | organizationDTO.setParentOrganization(parentOrganization); |
| | | organizationDTO.setOrganization(organization); |
| | | organizationDTO.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | organizationDTO.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | |
| | |
| | | |
| | | return organizationDTO; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * @Description: 删除客户组织 |
| | |
| | | //取参 |
| | | Integer id = form.getOrganizationId(); |
| | | |
| | | //查询组织是否存在 |
| | | //查询要删除的组织用于插入日志 |
| | | Organization existOrganization = new Organization(); |
| | | existOrganization.setIsDelete(Constants.NOT_DELETE); |
| | | existOrganization.setId(id); |
| | |
| | | } |
| | | |
| | | //封装返回结果 |
| | | dto.setOrganization(existOrganization); |
| | | dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); |
| | | dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); |
| | | //操作插入日志 |