From 0f583af56d79cadf553a072c383814ba1a1e4789 Mon Sep 17 00:00:00 2001 From: WenG <450292408@qq.com> Date: Mon, 10 May 2021 13:13:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B7=AF=E7=94=B1=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/routetype/RouteTypeHandler.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/ink/wgink/gateway/handler/routetype/RouteTypeHandler.java b/src/main/java/ink/wgink/gateway/handler/routetype/RouteTypeHandler.java index da49d1f..9b0e33a 100644 --- a/src/main/java/ink/wgink/gateway/handler/routetype/RouteTypeHandler.java +++ b/src/main/java/ink/wgink/gateway/handler/routetype/RouteTypeHandler.java @@ -1,12 +1,9 @@ package ink.wgink.gateway.handler.routetype; -import ink.wgink.gateway.consts.ISystemConst; import ink.wgink.gateway.dao.routetype.IRouteTypeDao; -import ink.wgink.gateway.exception.ParamsException; import ink.wgink.gateway.exception.SearchException; import ink.wgink.gateway.handler.BaseHandler; import ink.wgink.gateway.pojo.result.SuccessResult; -import ink.wgink.gateway.pojo.route.Route; import ink.wgink.gateway.pojo.routetype.RouteType; import ink.wgink.gateway.util.RequestFieldCheckUtil; import org.springframework.data.domain.Example; @@ -76,6 +73,17 @@ public class RouteTypeHandler extends BaseHandler { .then(ServerResponse.ok().contentType(MediaType.APPLICATION_JSON_UTF8).body(Mono.just(new SuccessResult()), SuccessResult.class)); } + public Mono update(ServerRequest serverRequest) { + String id = serverRequest.pathVariable("id"); + Mono routeTypeMono = serverRequest.bodyToMono(RouteType.class); + return routeTypeDao.findById(id).flatMap(routeType -> routeTypeMono.flatMap(rt -> { + RouteType routeTypeExample = new RouteType(); + routeTypeExample.setTitle(rt.getTitle()); + ExampleMatcher exampleMatcher = ExampleMatcher.matchingAny().withMatcher("title", ExampleMatcher.GenericPropertyMatcher::exact).withIgnoreCase("id"); + Example example = Example.of(routeTypeExample, exampleMatcher); + })).switchIfEmpty(ServerResponse.notFound().build()); + } + /** * 列表 *