| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | if (department != null) { |
| | | return ResponseValue.error("部门名称已存在"); |
| | | } |
| | | |
| | | // 部门编号 |
| | | FinSysTenantDepartmentParam finSysTenantDepartmentParam1 = new FinSysTenantDepartmentParam(); |
| | | finSysTenantDepartmentParam1.setCode(param.getCode()); |
| | | List<FinSysTenantDepartment> datas = departmentService.queryDataList(finSysTenantDepartmentParam1); |
| | | if(!CollectionUtil.isEmpty(datas)){ |
| | | return ResponseValue.error("此编号已存在"); |
| | | } |
| | | int result = this.departmentService.add(param, this.getSysInfo()); |
| | | if (result > 0) { |
| | | return ResponseValue.success(); |
| | |
| | | FinSysTenantDepartment tenantDepartment = |
| | | this.departmentService.getTenantDepartment(null, param.getTenantId(), param.getCode()); |
| | | if (tenantDepartment != null) { |
| | | return ResponseValue.error("部门编号已存在"); |
| | | //return ResponseValue.error("部门编号已存在"); |
| | | } |
| | | // 部门编号 |
| | | FinSysTenantDepartmentParam finSysTenantDepartmentParam1 = new FinSysTenantDepartmentParam(); |
| | | finSysTenantDepartmentParam1.setCode(param.getCode()); |
| | | List<FinSysTenantDepartment> datas = departmentService.queryDataList(finSysTenantDepartmentParam1); |
| | | if(!CollectionUtil.isEmpty(datas)){ |
| | | FinSysTenantDepartment finSysTenantDepartment1 = datas.get(0); |
| | | if(!finSysTenantDepartment1.getId().equals(param.getId())){ |
| | | return ResponseValue.error("此编号已存在"); |
| | | } |
| | | } |
| | | int num = this.departmentService.updateFinSysTenantDepartment(param, sysInfo); |
| | | return num > 0 ? ResponseValue.success() : ResponseValue.error("编辑失败!"); |