<?php
namespace app\workerapi\lists;
use app\common\lists\ListsSearchInterface;
use app\common\model\master_worker_message\MasterWorkerMessage;

/**
 * @author 林海涛
 * @date 2024/7/11 下午6:21
 */
class MasterWorkerMessageLists extends BaseWorkerDataLists  implements ListsSearchInterface
{
    public function setSearch(): array
    {
        return [
            '=' => ['msg_type'],
        ];
    }
    public function queryWhere()
    {
        $where = [];
        $where[] = ['worker_id', '=', $this->userId];
        return $where;
    }
    public function lists():array
    {
        return MasterWorkerMessage::where($this->searchWhere)
            ->where($this->queryWhere())
            ->field(['id', 'title','describe','create_time','update_time'])
            ->order(['id' => 'asc'])
            ->select()
            ->toArray();
    }
    public function count(): int
    {
        return MasterWorkerMessage::where($this->searchWhere)->where($this->queryWhere())->count();
    }
}