package com.ruoyi.web.modules.trading.controller;

import java.util.List;
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 com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.web.modules.trading.domain.BizSupplierSettlement;
import com.ruoyi.web.modules.trading.service.IAppSupplierSettlementService;
import com.ruoyi.web.modules.trading.support.AppSupplierPageSupport;

/**
 * 供应商小程序待结算单。
 */
@RestController
@RequestMapping("/app/supplier/settlement")
public class BizAppSupplierSettlementController extends BaseController
{
    @Autowired
    private IAppSupplierSettlementService appSupplierSettlementService;

    /**
     * 待结算单分页列表（结算主表 + 关联订单 lineList 明细）。
     */
    @GetMapping("/list")
    public TableDataInfo list()
    {
        AppSupplierPageSupport.startPage();
        List<BizSupplierSettlement> list = appSupplierSettlementService.selectPendingList();
        return getDataTable(list);
    }

    /**
     * 待结算单详情（结算主表 + lineList 明细）。
     */
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(appSupplierSettlementService.selectPendingById(id));
    }
}
