控制器
$PointProductModel=D('PointProduct');
$list= $PointProductModel->getPointProduct($id=null,$no,array('in','0,1'),
$isdelete=0,null,$pointortime);
模型
public function getPointProduct($id,$no,$condition,
$isdelete,$chinesename,$pointortime){
$m=M('point_product');
if($id){
$con['pointproduct_id']=$id;
}
if($no){
$con['pointproduct_no']=$no;
}
if($condition!==null){
$con['pointproduct_condition']=$condition;
}
if($isdelete!==null){
$con['pointproduct_isdelete']=$isdelete;
}
if($chinesename){
$con['pointproduct_chinesename']=$chinesename;
}
if($pointortime){
$con['pointproduct_pointortime']=$pointortime;
}
$result=$m->where($con)->order("pointproduct_sort desc")->select();
}
数据库如何优化
代码如何优化
性能最高
出现频率最高的字段加索引