<?php

namespace app\admin\controller\sys_manage;

use app\admin\validate\sys_manage\AdvValidate;
use app\admin\validate\sys_manage\SupplierValidate;
use app\controller\Curd;
use app\model\Adv;
use app\model\Supplier;
use support\Request;
use support\Response;

class SupplierController extends Curd
{
    public function __construct()
    {
        $this->model = new Supplier();
        $this->validate = true;
        $this->validateClass = new SupplierValidate();
    }

    /** 列表
     * @Desc
     * @Author Gorden
     * @Date 2024/3/5 10:00
     *
     * @param Request $request
     * @return Response
     * @throws \support\exception\BusinessException
     */
    public function select(Request $request): Response
    {
        [$where, $format, $limit, $field, $order] = $this->selectInput($request);
        $order = $request->get('order', 'desc');
        $field = $field ?? 'supplier_addtimes';
        $query = $this->doSelect($where, $field, $order);
        return $this->doFormat($query, $format, $limit);
    }
}