new-admin-api/app/common/dao/system/merchant/MerchantBrandDao.php

37 lines
1.1 KiB
PHP

<?php
namespace app\common\dao\system\merchant;
use app\common\dao\BaseDao;
use app\common\model\system\merchant\MerchantBrand;
class MerchantBrandDao extends BaseDao{
protected function getModel():string{
return MerchantBrand::class;
}
/**
* Common: 公共查询模型
* Author: wu-hui
* Time: 2024/02/04 15:32
* @param array $params
* @return MerchantBrand
*/
public function searchModel(array $params){
return (new MerchantBrand())
->where('is_del', 0)
->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']}%");
})
->when(isset($params['equivalent_to_title']) && $params['equivalent_to_title'] !== '',function($query) use ($params){
$query->where('title', $params['equivalent_to_title']);
})
->order('create_time DESC,id DESC');
}
}