$where=" and (A.`name` like '%".$searchValue."%' or A.`code` like '%".$searchValue."%') ";
$where=" and (A.`name` like '%".$searchValue."%' or A.`code` like '%".$searchValue."%') ";
}
}
if($searchSp){
$where.=" and B.sp_id = $searchSp ";
}
if($searchHotel){
if($searchHotel){
$where.=" and A.hotel_id = $searchHotel ";
$where.=" and A.hotel_id = $searchHotel ";
}
}
...
@@ -33,9 +36,9 @@ class FrontModel extends RelationModel{
...
@@ -33,9 +36,9 @@ class FrontModel extends RelationModel{
//返回列表(limit分页)
//返回列表(limit分页)
if($queryType=="list"){
if($queryType=="list"){
$where.=$sort." ".$limit;
$where.=$sort." ".$limit;
$fields=" A.*,B.`name` hotel_name,case A.`status` when 2 then '<font color=red>删除</font>' when 1 then '<font color=red>禁用</font>' when 0 then '<font color=green>启用</font>' end as `status` ";
$fields=" A.*,B.`name` hotel_name,C.`name` sp_name,case A.`status` when 2 then '<font color=red>删除</font>' when 1 then '<font color=red>禁用</font>' when 0 then '<font color=green>启用</font>' end as `status` ";
}
}
$sql="select ".$fields." from sh_hotel_device A join sh_hotel B on A.hotel_id = B.id where 1=1 ".$where.";";
$sql="select ".$fields." from sh_hotel_device A join sh_hotel B on A.hotel_id = B.id join sh_sp C on B.sp_id = C.id where 1=1 ".$where.";";