package com.dayou.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dayou.common.RestResponse;
import com.dayou.dto.history.HisMajorOrder;
import com.dayou.dto.history.HisOrderParam;
import com.dayou.service.IHistoryOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类说明：原系统订单查询
 *
 * @author: wucl
 * @since: 2024/5/8
 * created with IntelliJ IDEA.
 */
@RestController
@RequestMapping("history/order")
@Slf4j
public class HistoryOrderController {

    @Autowired
    private IHistoryOrderService historyOrderService;

    /**
     * 获取原系统cookie
     * @return
     */
    @GetMapping("/cookie")
    public RestResponse<String> getEverCookie(){
        String cookie = historyOrderService.getEverCookie();
        return RestResponse.data(cookie);
    }

    /**
     * 原系统大中型订单
     * @param hisOrderParam
     * @return
     */
    @GetMapping("/major")
    public RestResponse<Page<HisMajorOrder>> page(HisOrderParam hisOrderParam){
        Page<HisMajorOrder> pages = historyOrderService.hisMajorPage(hisOrderParam);
        return RestResponse.data(pages);
    }
}
