6/19 实现了订单详情的查询

This commit is contained in:
mlf9527 2023-06-19 15:56:27 +08:00
parent 1ef562c529
commit 1ef5b4da93
2 changed files with 21 additions and 5 deletions

View File

@ -1,5 +1,6 @@
package io.renren.modules.takeout.controller; package io.renren.modules.takeout.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
@ -11,8 +12,10 @@ import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup; import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.takeout.dto.OrderDetailDTO; import io.renren.modules.takeout.dto.OrderDetailDTO;
import io.renren.modules.takeout.dto.OrdersDTO;
import io.renren.modules.takeout.excel.OrderDetailExcel; import io.renren.modules.takeout.excel.OrderDetailExcel;
import io.renren.modules.takeout.service.OrderDetailService; import io.renren.modules.takeout.service.OrderDetailService;
import io.renren.modules.takeout.service.OrdersService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -23,6 +26,8 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -39,6 +44,8 @@ import java.util.Map;
public class OrderDetailController { public class OrderDetailController {
@Autowired @Autowired
private OrderDetailService orderDetailService; private OrderDetailService orderDetailService;
@Autowired
private OrdersService ordersService;
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ -112,5 +119,11 @@ public class OrderDetailController {
ExcelUtils.exportExcelToTarget(response, null, list, OrderDetailExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, OrderDetailExcel.class);
} }
@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

@ -1,5 +1,6 @@
package io.renren.modules.takeout.service.impl; package io.renren.modules.takeout.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl; import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.takeout.dao.OrderDetailDao; import io.renren.modules.takeout.dao.OrderDetailDao;
@ -7,8 +8,10 @@ import io.renren.modules.takeout.dto.OrderDetailDTO;
import io.renren.modules.takeout.entity.OrderDetailEntity; import io.renren.modules.takeout.entity.OrderDetailEntity;
import io.renren.modules.takeout.service.OrderDetailService; import io.renren.modules.takeout.service.OrderDetailService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -19,16 +22,16 @@ import java.util.Map;
*/ */
@Service @Service
public class OrderDetailServiceImpl extends CrudServiceImpl<OrderDetailDao, OrderDetailEntity, OrderDetailDTO> implements OrderDetailService { public class OrderDetailServiceImpl extends CrudServiceImpl<OrderDetailDao, OrderDetailEntity, OrderDetailDTO> implements OrderDetailService {
@Autowired
OrderDetailDao orderDetailDao;
@Override @Override
public QueryWrapper<OrderDetailEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<OrderDetailEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("orderId");
QueryWrapper<OrderDetailEntity> wrapper = new QueryWrapper<>(); QueryWrapper<OrderDetailEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "order_id", id);
return wrapper; return wrapper;
} }
} }