6/19 实现了订单用户的显示

This commit is contained in:
mlf9527 2023-06-19 17:14:31 +08:00
parent e7d9742cbb
commit 6599852bc9
3 changed files with 20 additions and 8 deletions

View File

@ -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<String,Object> params){
OrdersDTO ordersDTO = ordersService.get(orderId);
params.put("orderId",ordersDTO.getNumber());
List<OrderDetailDTO> orderDetailDTOS=orderDetailService.list(params);
return new Result().ok(orderDetailDTOS);
}
}
}

View File

@ -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,6 +42,8 @@ import java.util.Map;
public class OrdersController {
@Autowired
private OrdersService ordersService;
@Autowired
private UserService userService;
@GetMapping("page")
@ApiOperation("分页")
@ -52,6 +57,12 @@ public class OrdersController {
public Result<PageData<OrdersDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<OrdersDTO> page = ordersService.page(params);
List<OrdersDTO> 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<PageData<OrdersDTO>>().ok(page);
}

View File

@ -22,8 +22,8 @@ import java.util.Map;
*/
@Service
public class OrderDetailServiceImpl extends CrudServiceImpl<OrderDetailDao, OrderDetailEntity, OrderDetailDTO> implements OrderDetailService {
@Autowired
OrderDetailDao orderDetailDao;
@Autowired
OrderDetailDao orderDetailDao;
@Override
public QueryWrapper<OrderDetailEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("orderId");