package org.wfc.system.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.system.domain.UOrder;
import org.wfc.system.service.IUOrderService;
import org.wfc.system.service.IUPackageService;
import org.wfc.system.service.IUUserService;

import java.util.List;

/**
 * <p>
 * 用户平台-订单表 前端控制器
 * </p>
 *
 * @author sys
 * @since 2025-01-03
 */
@RestController
@RequestMapping("/order")
public class UOrderController extends BaseController {

    @Autowired
    private IUOrderService uOrderService;

    @Autowired
    private IUUserService uUserService;

    @Autowired
    private IUPackageService packageService;

    @GetMapping("/page")
    public TableDataInfo page(UOrder uOrder) {
        startPage();
        List<UOrder> list = uOrderService.listOrder(uOrder);
        return getDataTable(list);
    }

    @GetMapping("/list")
    public AjaxResult list(UOrder uOrder) {
        List<UOrder> list = uOrderService.list();
        return success(list);
    }

    @GetMapping(value = "/{id}")
    public AjaxResult getById(@PathVariable("id") Long id) {
        return success(uOrderService.getById(id));
    }

}
