From 1c51ec78abc672cba3eb7e7892e169aa65069326 Mon Sep 17 00:00:00 2001 From: wangyu <727842003@qq.com> Date: Tue, 7 Dec 2021 23:03:21 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=AE=9E=E7=8E=B0=E5=85=A8?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/ViewController.tpl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/flyfish-web/src/main/resources/templates/ViewController.tpl b/flyfish-web/src/main/resources/templates/ViewController.tpl index 027dffd..6ad49e2 100644 --- a/flyfish-web/src/main/resources/templates/ViewController.tpl +++ b/flyfish-web/src/main/resources/templates/ViewController.tpl @@ -8,26 +8,27 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; -import java.util.stream.Collectors; import com.flyfish.framework.bean.Result; import com.flyfish.framework.configuration.annotations.PagedQuery; import com.flyfish.framework.domain.base.Vo; -import com.flyfish.framework.service.BaseService; +import com.flyfish.framework.service.BaseReactiveService; @RestController @RequestMapping("#{uri}") public class #{className} { @Autowired - protected BaseService<#{beanClassName}> service; + protected BaseReactiveService<#{beanClassName}> service; @GetMapping("views") - public Result>> getVoList(@PagedQuery #{queryBeanClassName}#{queryBeanSuffix} qo) { + public Mono>>> getVoList(@PagedQuery #{queryBeanClassName}#{queryBeanSuffix} qo) { if (null != qo.getPageable()) { - return Result.accept(service.getPageList(qo).map(item -> new #{listViewClassName}().from(item))); + return service.getPageList(qo).map(page -> page.map(item -> new #{listViewClassName}().from(item))) + .map(Result::accept); } - return Result.accept(service.getList(qo).stream() - .map(item -> new #{listViewClassName}().from(item)).collect(Collectors.toList())); + return service.getList(qo).map(item -> new #{listViewClassName}().from(item)) + .collectList() + .map(Result::accept); } }