新增路由类型

This commit is contained in:
WenG 2021-05-10 13:13:54 +08:00
parent 4f62d30d12
commit 0f583af56d

View File

@ -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<ServerResponse> update(ServerRequest serverRequest) {
String id = serverRequest.pathVariable("id");
Mono<RouteType> 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());
}
/**
* 列表
*