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()); + } + /** * 列表 *