erp/app/admin/lists/operation/OpurchaseclassofferLists.php
2024-05-11 16:50:16 +08:00

72 lines
1.9 KiB
PHP

<?php
namespace app\admin\lists\operation;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\operation\Opurchaseclass;
use app\common\lists\ListsSearchInterface;
use app\common\model\goods\Goods;
use app\common\model\opurchase\OpurchaseGoodsOffer;
use app\common\model\supplier\Supplier;
/**
* 采购供应链商户报价
* Class OpurchaseclassofferLists
* @package app\admin\listsoperation
*/
class OpurchaseclassofferLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function setSearch(): array
{
return [
'=' => ['is_adopt'],
];
}
/**
* @notes 获取采购供应链商户报价列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function lists(): array
{
$where=[];
return OpurchaseGoodsOffer::where($this->searchWhere)
->where($where)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) {
$find = Goods::where('id', $item['goods_id'])->with('unitName')->find();
$item['goods_name'] = $find['name'];
$item['unit_name'] = $find['unit_name'];
$item['supplier_name'] = Supplier::where('id',$item['supplier_id'])->value('mer_name');
})->toArray();
}
/**
* @notes 获取采购供应链商户报价数量
* @return int
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function count(): int
{
return OpurchaseGoodsOffer::where($this->searchWhere)->count();
}
}