['is_adopt', 'is_storage', 'is_stream'], 'between_time' => 'create_time' ]; } /** * @notes 设置支持排序字段 * @return string[] * @date 2021/12/29 10:07 * @remark 格式: ['前端传过来的字段名' => '数据库中的字段名']; */ public function setSortFields(): array { return ['id' => 'id']; } /** * @notes 设置默认排序 * @return string[] * @date 2021/12/29 10:06 */ public function setDefaultOrder(): array { return ['id' => 'desc']; } /** * @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 { $list = OpurchaseGoodsOffer::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->order($this->sortOrder) ->select()->each(function ($item) { $find = Goods::where('id', $item['goods_id'])->with('unitName')->find(); if ($find) { $item['goods_name'] = $find['name']; $item['unit_name'] = $find['unit_name']; } if($item['stream_admin_id']){ $item['stream_admin_name']=Admin::where('id', $item['stream_admin_id'])->value('name'); }else{ $item['stream_admin_name']=''; } if($item['storage_admin_id']){ $item['storage_admin_name']=Admin::where('id', $item['storage_admin_id'])->value('name'); }else{ $item['storage_admin_name']=''; } $item['supplier_name'] = Supplier::where('id', $item['supplier_id'])->value('mer_name'); })->toArray(); return $list; } /** * @notes 获取采购供应链商户报价数量 * @return int * @author likeadmin * @date 2024/04/27 11:26 */ public function count(): int { return OpurchaseGoodsOffer::where($this->searchWhere)->count(); } }