feat: add article and production modules
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace plugin\produce\app\dao;
|
||||
|
||||
use core\base\BaseDao;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use plugin\produce\app\model\Process;
|
||||
|
||||
class ProcessDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return Process::class;
|
||||
}
|
||||
|
||||
public function selectList(
|
||||
array $where,
|
||||
string|array $field = '*',
|
||||
int $page = 0,
|
||||
int $limit = 0,
|
||||
string $order = '',
|
||||
array $with = [],
|
||||
bool $search = false,
|
||||
?array $withoutScopes = null
|
||||
): ?Collection {
|
||||
$query = $this->selectModel($where, $field, $page, $limit, $order, $with, $search, $withoutScopes);
|
||||
$query->withCount(['steps as step_count']);
|
||||
|
||||
if ($page > 0 && $limit > 0) {
|
||||
return $query->paginate($limit, ['*'], 'page', $page)->getCollection();
|
||||
}
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
protected function getKeywordFields(): array
|
||||
{
|
||||
return ['process_code', 'process_name', 'description'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user