Przeglądaj źródła

协议复制的开发

dongxin 1 rok temu
rodzic
commit
496d7a3b0f

+ 8 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementServiceImpl.java

@@ -312,6 +312,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
             PtlAgreementUndwrtRules newAgreementUndwrtRules = new PtlAgreementUndwrtRules();
             PtlAgreementUndwrtRules newAgreementUndwrtRules = new PtlAgreementUndwrtRules();
             BeanUtils.copyProperties(agreementUndwrtRules,newAgreementUndwrtRules);
             BeanUtils.copyProperties(agreementUndwrtRules,newAgreementUndwrtRules);
             newAgreementUndwrtRules.setId(null);
             newAgreementUndwrtRules.setId(null);
+            // 根据协议id获取最大的序号
+            LambdaQueryWrapper<PtlAgreementUndwrtRules> undwrtRulesLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            undwrtRulesLambdaQueryWrapper.eq(PtlAgreementUndwrtRules::getAgreementId, newAgreement.getId())
+                    .eq(PtlAgreementUndwrtRules::getIsDelete, 0);
+            undwrtRulesLambdaQueryWrapper.orderByDesc(PtlAgreementUndwrtRules::getOrderNum);
+            undwrtRulesLambdaQueryWrapper.last("LIMIT 1"); // 只取一个结果
+            PtlAgreementUndwrtRules maxRules = agreementRulesService.getOne(undwrtRulesLambdaQueryWrapper);
+            newAgreementUndwrtRules.setOrderNum(Objects.nonNull(maxRules) ? maxRules.getOrderNum() + 1 : 1);
             newAgreementUndwrtRules.setAgreementId(newAgreement.getId());
             newAgreementUndwrtRules.setAgreementId(newAgreement.getId());
             agreementRulesService.save(newAgreementUndwrtRules);
             agreementRulesService.save(newAgreementUndwrtRules);