控制层
//产品管理列表,同时根据查询条件显示列表
public function productlist(){
import('ORG.Util.Page');
$user_name = trim($_GET['user_name']);
$phone = trim($_GET['phone']);
$card_examine = trim($_GET['card_examine']);
$idcard_examine = trim($_GET['idcard_examine']);
$starttime = trim($_GET['starttime']);
$endtime = trim($_GET['endtime']);
$city = trim($_GET['city']);
$orga_name = trim($_GET['orga_name']);
$product = M('product');
$count = $product->count();// 查询满足要求的总记录数
$Page = new Page($count,15);// 实例化分页类 传入总记录数
$show = $Page->show();// 分页显示输出
$sql="SELECT `app_product`.id, `app_product`.product_name, `app_product`.product_orga,`app_product`.city,
`app_product`.create_time,`app_user`.user_name
FROM `app_product` LEFT JOIN `app_user` on `app_product`.userid = `app_user`.id ";
// var_dump($sql);
// die();
$sql=$sql." where 1=1";
if($user_name){
$sql = $sql." and user_name like "." '%$user_name%'";
}
if($phone){
$sql = $sql." and phone="."'$phone'";
}
if($card_examine == '0' or $card_examine){
$sql = $sql." and card_examine=".$card_examine;
}
if($idcard_examine == '0' or $idcard_examine){
$sql = $sql." and idcard_examine=".$idcard_examine;
}
if($starttime){
$sql = $sql." and create_time >"." '$starttime' ";
}
if($endtime){