|
@@ -62,8 +62,14 @@ public class TransfusionConfigFacade {
|
|
|
.eq("his_name", transfusionConfig.getHisName())
|
|
|
.eq("unique_name", transfusionConfig.getUniqueName());
|
|
|
TransfusionConfig oldRecord = transfusionConfigService.getOne(queryWrapper, false);
|
|
|
- if (oldRecord != null) {
|
|
|
- return true;
|
|
|
+ if (transfusionConfig.getId() == null
|
|
|
+ && oldRecord != null) {
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
|
|
|
+ }
|
|
|
+ if (transfusionConfig.getId() != null
|
|
|
+ && oldRecord != null
|
|
|
+ && !transfusionConfig.getId().equals(oldRecord.getId())) {
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -87,8 +93,14 @@ public class TransfusionConfigFacade {
|
|
|
.eq("his_name", transfusionConfig.getHisName())
|
|
|
.eq("unique_name", transfusionConfig.getUniqueName());
|
|
|
TransfusionConfig oldRecord = transfusionConfigService.getOne(queryWrapper, false);
|
|
|
- if (oldRecord != null) {
|
|
|
- transfusionConfig.setId(oldRecord.getId());
|
|
|
+ if (transfusionConfig.getId() == null
|
|
|
+ && oldRecord != null) {
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
|
|
|
+ }
|
|
|
+ if (transfusionConfig.getId() != null
|
|
|
+ && oldRecord != null
|
|
|
+ && !transfusionConfig.getId().equals(oldRecord.getId())) {
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
|
|
|
}
|
|
|
//新增数据
|
|
|
if (transfusionConfig.getId() == null) {
|