diff --git a/src/main/java/com/pms/ocp/service/impl/TenantBasicManagementServiceImpl.java b/src/main/java/com/pms/ocp/service/impl/TenantBasicManagementServiceImpl.java index 610afd96be6961e208b80317d3319e759d48ab94..841a1e4ac11572857698390ebfd15d31db4393cf 100644 --- a/src/main/java/com/pms/ocp/service/impl/TenantBasicManagementServiceImpl.java +++ b/src/main/java/com/pms/ocp/service/impl/TenantBasicManagementServiceImpl.java @@ -406,28 +406,50 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl lambdaQueryWrapper2 = new LambdaQueryWrapper<>(); + lambdaQueryWrapper2.eq(OcpTenantBase::getTenantCode, tenantCode); + OcpTenantBase one = this.getOne(lambdaQueryWrapper2); OcpTenantBase ocpTenantBase = new OcpTenantBase(); BeanUtils.copyProperties(ocpBaseTiocnDto, ocpTenantBase); ocpTenantBase.setIsDelete((short) 0); + if (StringUtils.isEmpty(objId)){ + if (one!=null){ + return ResponseVO.error("应用编码不能重复"); + }else { + ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis())); + ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); + this.save(ocpTenantBase); + } + }else { + ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(OcpTenantBase::getObjId,ocpTenantBase.getObjId()); + this.update(ocpTenantBase,lambdaQueryWrapper); + } + + + - LambdaQueryWrapper lambdaQueryWrapper2 = new LambdaQueryWrapper<>(); - lambdaQueryWrapper2.eq(OcpTenantBase::getTenantCode, tenantCode); // boolean flag = this.update(ocpTenantBase, lambdaQueryWrapper2); // if (flag) { // log.info("应用基础表修改成功"); // System.out.println("应用基础表修改成功"); // } - int delete = tenantBasicManagementMapper.delete(lambdaQueryWrapper2); - if (delete == 0) { - log.info("增加"); - ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis())); - ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); - } else { - log.info("编辑"); - ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); - } - boolean save1 = this.save(ocpTenantBase); +// int delete = tenantBasicManagementMapper.delete(lambdaQueryWrapper2); +// if (delete == 0) { +// log.info("增加"); +// ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis())); +// ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); +// } else { +// log.info("编辑"); +// ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); +// } +// boolean save1 = this.save(ocpTenantBase); + + + OcpTenantExtent ocpTenantExtent = new OcpTenantExtent(); ocpTenantExtent.setTenantCode(tenantCode); ocpTenantExtent.setTenantState((short) 0); @@ -457,7 +479,7 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl