$where=" and (A.`name` like '%".$searchValue."%' or A.`code` like '%".$searchValue."%') ";
}
$model=newModel();
//======================
$fields="count(A.id) count";
//返回列表(limit分页)
if($queryType=="list"){
$where.=$sort." ".$limit;
$fields="A.*,B.`name` sp_name,C.`name` region_name,case A.status when 1 then '<font color=red>禁用</font>' when 0 then '<font color=green>启用</font>' end as status";
}
$sql="select ".$fields." from sh_hotel A join sh_sp B on A.sp_id=B.id join sh_region C on A.region_id=C.id where 1=1 ".$where.";";
$where=" and (`name` like '%".$searchValue."%' or `ip_addr` like '%".$searchValue."%' or `mac` like '%".$searchValue."%') ";
}
if($searchType){
$where.=" and `type` = ".$searchType." ";
}
$model=newModel();
//======================
$fields="count(pb.id) count";
//返回列表(limit分页)
if($queryType=="list"){
$where.=$sort." ".$limit;
$fields="A.*,FROM_UNIXTIME(A.addtime) addtime,FROM_UNIXTIME(A.updatetime) updatetime,B.`name` sp_name,C.`name` region_name,case A.status when 0 then '<font color=red>禁用</font>' when 1 then '<font color=green>启用</font>' end as status";
}
$sql="select ".$fields." from sh_hotel A join sh_sp B on A.sp_id=B.id join sh_region C on A.region_id=C.id where 1=1 ".$where.";";