| xqd
@@ -20,36 +20,54 @@ class InfoRepository extends Repository {
|
|
|
public function searchCompany(array $search,array $orderby=['id'=>'desc'],$pagesize=10)
|
|
|
{
|
|
|
$currentQuery = $this->model;
|
|
|
- if(isset($search['keyword']) && ! empty($search['keyword'])) {
|
|
|
- $keywords = '%' . $search['keyword'] . '%';
|
|
|
+ /*企业名称*/
|
|
|
+ if(isset($search['companyName']) && ! empty($search['companyName'])) {
|
|
|
+ $keywords = str_replace(',','|',$search['companyName']);
|
|
|
$currentQuery = $currentQuery->where(function ($query) use ($keywords) {
|
|
|
- $query->where('companyName' , 'like', $keywords);
|
|
|
+ $query->where('companyName' , 'REGEXP', $keywords);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+ /*所在地区*/
|
|
|
if(isset($search['district']) && ! empty($search['district'])) {
|
|
|
- $currentQuery = $currentQuery->where(function ($query) use ($search) {
|
|
|
- $query->where('district','like', '%'.$search['district'].'%');
|
|
|
+ $district = str_replace(',','|',$search['district']);
|
|
|
+ $currentQuery = $currentQuery->where(function ($query) use ($district) {
|
|
|
+ $query->where('district','REGEXP', $district);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+ /*企业类型*/
|
|
|
if(isset($search['entType']) && ! empty($search['entType'])) {
|
|
|
- $currentQuery = $currentQuery->where(function ($query) use ($search) {
|
|
|
- $query->where('entType',$search['entType']);
|
|
|
+ $entType = str_replace(',','|',$search['entType']);
|
|
|
+ $currentQuery = $currentQuery->where(function ($query) use ($entType) {
|
|
|
+ $query->where('entType','REGEXP',$entType);
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+ /*经营状态*/
|
|
|
if(isset($search['openStatus']) && ! empty($search['openStatus'])) {
|
|
|
- $currentQuery = $currentQuery->where(function ($query) use ($search) {
|
|
|
- $query->where('openStatus',$search['openStatus']);
|
|
|
+ $openStatus = str_replace(',','|',$search['openStatus']);
|
|
|
+ $currentQuery = $currentQuery->where(function ($query) use ($openStatus) {
|
|
|
+ $query->where('openStatus','REGEXP',$openStatus);
|
|
|
});
|
|
|
}
|
|
|
+ /*所属行业*/
|
|
|
if(isset($search['industry']) && ! empty($search['industry'])) {
|
|
|
- $currentQuery = $currentQuery->where(function ($query) use ($search) {
|
|
|
- $query->where('industry','like','%'.$search['industry'].'%');
|
|
|
+ $industry= str_replace(',','|',$search['industry']);
|
|
|
+ $currentQuery = $currentQuery->where(function ($query) use ($industry) {
|
|
|
+ $query->where('industry','REGEXP',$industry);
|
|
|
});
|
|
|
}
|
|
|
+ /*注册资本*/
|
|
|
+ if(isset($search['regCapital']) && ! empty($search['regCapital'])) {
|
|
|
+ $regCapital = explode('-',$search['regCapital']);
|
|
|
|
|
|
+ $currentQuery = $currentQuery->where(function ($query) use ($regCapital) {
|
|
|
+ if(!$regCapital[1]){
|
|
|
+ $query->where('regCapital','>=',(int)$regCapital[1]);
|
|
|
+ }else{
|
|
|
+ $query->where('regCapital','>=',(int)$regCapital[0])
|
|
|
+ ->where('regCapital','<',(int)$regCapital[1]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
if($orderby && is_array($orderby)){
|
|
|
foreach ($orderby AS $field => $value){
|