From 6599852bc98eafc917218b5b7498cad9b19f3fab Mon Sep 17 00:00:00 2001 From: mlf9527 <2192316287@qq.com> Date: Mon, 19 Jun 2023 17:14:31 +0800 Subject: [PATCH] =?UTF-8?q?6/19=20=E5=AE=9E=E7=8E=B0=E4=BA=86=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=94=A8=E6=88=B7=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OrderDetailController.java | 5 +++-- .../takeout/controller/OrdersController.java | 19 +++++++++++++++---- .../service/impl/OrderDetailServiceImpl.java | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrderDetailController.java b/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrderDetailController.java index f7dc15b..171a43f 100644 --- a/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrderDetailController.java +++ b/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrderDetailController.java @@ -119,11 +119,12 @@ public class OrderDetailController { ExcelUtils.exportExcelToTarget(response, null, list, OrderDetailExcel.class); } -@GetMapping("detailInfo/{orderId}") + + @GetMapping("detailInfo/{orderId}") public Result Info(@PathVariable Long orderId,@ApiIgnore @RequestParam Map params){ OrdersDTO ordersDTO = ordersService.get(orderId); params.put("orderId",ordersDTO.getNumber()); List orderDetailDTOS=orderDetailService.list(params); return new Result().ok(orderDetailDTOS); -} + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrdersController.java b/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrdersController.java index 30da486..b68abb6 100644 --- a/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrdersController.java +++ b/renren-admin/src/main/java/io/renren/modules/takeout/controller/OrdersController.java @@ -11,8 +11,10 @@ import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.UpdateGroup; import io.renren.modules.takeout.dto.OrdersDTO; +import io.renren.modules.takeout.dto.UserDTO; import io.renren.modules.takeout.excel.OrdersExcel; import io.renren.modules.takeout.service.OrdersService; +import io.renren.modules.takeout.service.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -25,6 +27,7 @@ import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** @@ -39,19 +42,27 @@ import java.util.Map; public class OrdersController { @Autowired private OrdersService ordersService; + @Autowired + private UserService userService; @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") }) @RequiresPermissions("takeout:orders:page") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = ordersService.page(params); + List ordersDTOS = page.getList().stream().map(ordersDTO -> { + UserDTO userDTO = userService.get(ordersDTO.getUserId()); + ordersDTO.setUserName(userDTO.getName()); + return ordersDTO; + }).collect(Collectors.toList()); + page.setList(ordersDTOS); return new Result>().ok(page); } diff --git a/renren-admin/src/main/java/io/renren/modules/takeout/service/impl/OrderDetailServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/takeout/service/impl/OrderDetailServiceImpl.java index 728464a..63099d4 100644 --- a/renren-admin/src/main/java/io/renren/modules/takeout/service/impl/OrderDetailServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/takeout/service/impl/OrderDetailServiceImpl.java @@ -22,8 +22,8 @@ import java.util.Map; */ @Service public class OrderDetailServiceImpl extends CrudServiceImpl implements OrderDetailService { -@Autowired -OrderDetailDao orderDetailDao; + @Autowired + OrderDetailDao orderDetailDao; @Override public QueryWrapper getWrapper(Map params){ String id = (String)params.get("orderId");