From 5c33e3e5e6aa5c0c741c80e75f0a50cbbe962378 Mon Sep 17 00:00:00 2001 From: zhouhao Date: Fri, 11 Aug 2023 20:14:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DforUpdate=E6=97=A0?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ezorm/rdb/mapping/defaults/DefaultReactiveQuery.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/mapping/defaults/DefaultReactiveQuery.java b/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/mapping/defaults/DefaultReactiveQuery.java index 76b7c398..6c0eb9f2 100644 --- a/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/mapping/defaults/DefaultReactiveQuery.java +++ b/hsweb-easy-orm-rdb/src/main/java/org/hswebframework/ezorm/rdb/mapping/defaults/DefaultReactiveQuery.java @@ -52,6 +52,7 @@ public Flux fetch() { .where(param.getTerms()) .orderBy(getSortOrder()) .when(param.isPaging(), query -> query.paging(param.getPageIndex(), param.getPageSize())) + .when(param.isForUpdate(), QueryOperator::forUpdate) .fetch(eventWrapper(tableMetadata, wrapper, executorType("reactive"), type("fetch"))) .reactive()) .contextWrite(ctx->ctx.put(Logger.class,logger)); @@ -67,9 +68,11 @@ public Mono fetchOne() { .select(getSelectColumn()) .where(param.getTerms()) .orderBy(getSortOrder()) - .paging(0, 1) + //.paging(0, 1) + .when(param.isForUpdate(), QueryOperator::forUpdate) .fetch(eventWrapper(tableMetadata, wrapper, executorType("reactive"), type("fetchOne"))) - .reactive()) + .reactive() + .take(1)) .contextWrite(ctx-> ctx.put(Logger.class,logger)) .singleOrEmpty(); }