34 lines
879 B
PHP
34 lines
879 B
PHP
<?php
|
|
namespace app\common\dao\marketing\activity;
|
|
|
|
|
|
use app\common\dao\BaseDao;
|
|
use app\common\model\marketing\activity\Cate;
|
|
|
|
class CateDao extends BaseDao{
|
|
|
|
protected function getModel(): string{
|
|
return Cate::class;
|
|
}
|
|
/**
|
|
* Common: 公共搜索模型
|
|
* Author: wu-hui
|
|
* Time: 2024/03/14 15:21
|
|
* @param array $params
|
|
* @return Cate
|
|
*/
|
|
public function searchList(array $params){
|
|
return (new Cate())
|
|
->when(isset($params['id']) && $params['id'] !== '',function($query) use ($params){
|
|
$query->where('id', (int)$params['id']);
|
|
})
|
|
->when(isset($params['title']) && $params['title'] !== '',function($query) use ($params){
|
|
$query->where('title','like',"%{$params['title']}%");
|
|
})
|
|
->order('create_time DESC,id DESC');
|
|
}
|
|
|
|
|
|
|
|
}
|