getModel())::getDB()->when($except, function ($query, $except) use ($field) { $query->where($field, '<>', $except); })->where($field, $value)->count() > 0; } /** * 批量删除 * @Author:Qinii * @Date: 2020/5/8 * @param array $id * @param array $temp_id */ public function batchRemove(array $id,array $temp_id) { if($id) ($this->getModel())::getDB()->where($this->getPk(),'in',$id)->delete(); if($temp_id) ($this->getModel())::getDB()->where('temp_id','in',$temp_id)->delete(); } /** * @param int $tempId * @return ShippingTemplateUndeliveryEntity[] */ public function getShippingTemplateUndeliveryEntityListByTempId(int $tempId): array { $entityList = []; try { /** @var model $model */ $model = $this->getModel(); $dataListRes = $model::getDB() ->where('temp_id', '=', $tempId) ->select() ->toArray(); if (!empty($dataListRes)) { foreach ($dataListRes as $data) { $entityList[] = ShippingTemplateUndeliveryEntity::newInstance($data); } } } catch (\Exception $e) { } return $entityList; } }