File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
server/api-service/lowcoder-infra/src/main/java/org/lowcoder/infra/birelation Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ public Mono<BiRelation> addBiRelation(BiRelation biRelation) {
36
36
37
37
@ Override
38
38
public Mono <List <BiRelation >> batchAddBiRelation (Collection <BiRelation > biRelations ) {
39
- return biRelationRepository .saveAll (biRelations )
39
+ return Flux .fromIterable (biRelations )
40
+ .flatMap (this ::upsertAndReturn )
40
41
.collectList ();
41
42
}
42
43
@@ -232,4 +233,12 @@ public Mono<Boolean> removeBiRelationById(String id) {
232
233
.thenReturn (true )
233
234
.onErrorReturn (false );
234
235
}
236
+
237
+ private Mono <BiRelation > upsertAndReturn (BiRelation biRelation ) {
238
+ Criteria criteria = Criteria .where ("bizType" ).is (biRelation .getBizType ())
239
+ .and ("sourceId" ).is (biRelation .getSourceId ())
240
+ .and ("targetId" ).is (biRelation .getTargetId ());
241
+ return mongoUpsertHelper .upsertWithAuditingParams (biRelation , criteria )
242
+ .onErrorResume (ex -> Mono .empty ());
243
+ }
235
244
}
You can’t perform that action at this time.
0 commit comments