47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
namespace app\common\dao\system\merchant;
|
|
|
|
|
|
use app\common\dao\BaseDao;
|
|
use app\common\model\system\merchant\MerchantShareholderLevel;
|
|
|
|
class MerchantShareholderLevelDao extends BaseDao{
|
|
|
|
protected function getModel(): string{
|
|
return MerchantShareholderLevel::class;
|
|
}
|
|
/**
|
|
* Common: 公共查询模型
|
|
* Author: wu-hui
|
|
* Time: 2024/06/12 11:28
|
|
* @param array $params
|
|
* @return MerchantShareholderLevel
|
|
*/
|
|
public function searchModel(array $params){
|
|
return (new MerchantShareholderLevel())
|
|
->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['merchant_type']) && $params['merchant_type'] !== '',function($query) use ($params){
|
|
$query->where('merchant_type', (int)$params['merchant_type']);
|
|
})
|
|
->when(isset($params['weight']) && $params['weight'] !== '',function($query) use ($params){
|
|
$query->where('weight', (int)$params['weight']);
|
|
})
|
|
->order('weight DESC,id DESC');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|