Commit b6d82795 authored by 郭凡凡's avatar 郭凡凡

修改bug

parent 7feab2ab
...@@ -406,28 +406,50 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan ...@@ -406,28 +406,50 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
*/ */
@Override @Override
public ResponseVO saveAndUpdateTenant(OcpBaseTiocnDto ocpBaseTiocnDto) { public ResponseVO saveAndUpdateTenant(OcpBaseTiocnDto ocpBaseTiocnDto) {
String objId = ocpBaseTiocnDto.getObjId();
String tenantCode = ocpBaseTiocnDto.getTenantCode(); String tenantCode = ocpBaseTiocnDto.getTenantCode();
LambdaQueryWrapper<OcpTenantBase> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
lambdaQueryWrapper2.eq(OcpTenantBase::getTenantCode, tenantCode);
OcpTenantBase one = this.getOne(lambdaQueryWrapper2);
OcpTenantBase ocpTenantBase = new OcpTenantBase(); OcpTenantBase ocpTenantBase = new OcpTenantBase();
BeanUtils.copyProperties(ocpBaseTiocnDto, ocpTenantBase); BeanUtils.copyProperties(ocpBaseTiocnDto, ocpTenantBase);
ocpTenantBase.setIsDelete((short) 0); 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<OcpTenantBase> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OcpTenantBase::getObjId,ocpTenantBase.getObjId());
this.update(ocpTenantBase,lambdaQueryWrapper);
}
LambdaQueryWrapper<OcpTenantBase> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
lambdaQueryWrapper2.eq(OcpTenantBase::getTenantCode, tenantCode);
// boolean flag = this.update(ocpTenantBase, lambdaQueryWrapper2); // boolean flag = this.update(ocpTenantBase, lambdaQueryWrapper2);
// if (flag) { // if (flag) {
// log.info("应用基础表修改成功"); // log.info("应用基础表修改成功");
// System.out.println("应用基础表修改成功"); // System.out.println("应用基础表修改成功");
// } // }
int delete = tenantBasicManagementMapper.delete(lambdaQueryWrapper2); // int delete = tenantBasicManagementMapper.delete(lambdaQueryWrapper2);
if (delete == 0) { // if (delete == 0) {
log.info("增加"); // log.info("增加");
ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis())); // ocpTenantBase.setTenantCtime(new Timestamp(System.currentTimeMillis()));
ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); // ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
} else { // } else {
log.info("编辑"); // log.info("编辑");
ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis())); // ocpTenantBase.setTenantMtime(new Timestamp(System.currentTimeMillis()));
} // }
boolean save1 = this.save(ocpTenantBase); // boolean save1 = this.save(ocpTenantBase);
OcpTenantExtent ocpTenantExtent = new OcpTenantExtent(); OcpTenantExtent ocpTenantExtent = new OcpTenantExtent();
ocpTenantExtent.setTenantCode(tenantCode); ocpTenantExtent.setTenantCode(tenantCode);
ocpTenantExtent.setTenantState((short) 0); ocpTenantExtent.setTenantState((short) 0);
...@@ -457,7 +479,7 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan ...@@ -457,7 +479,7 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
ocpTenantIocn.setIocn(ocpBaseTiocnDto.getIocn()); ocpTenantIocn.setIocn(ocpBaseTiocnDto.getIocn());
ocpTenantIocn.setCompanyCode(ownerCompanyCode); ocpTenantIocn.setCompanyCode(ownerCompanyCode);
boolean save = ocpTenantIocnService.save(ocpTenantIocn); boolean save = ocpTenantIocnService.save(ocpTenantIocn);
if (save1 && save) { if ( save) {
return ResponseVO.ok("添加成功"); return ResponseVO.ok("添加成功");
} }
return ResponseVO.error("未知错误"); return ResponseVO.error("未知错误");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment