From 9defd381ad04462e3a5fecc5d7343b7ebe738913 Mon Sep 17 00:00:00 2001 From: wlx Date: Wed, 16 May 2012 01:10:41 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2sql=E4=B8=AD=E7=9A=84left=20j?= =?UTF-8?q?oin=E4=B8=BAright=20join=E4=BB=A5=E9=98=B2=E6=AD=A2=E5=B7=B2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9A=84=E5=85=83=E6=95=B0=E6=8D=AE=E5=87=BA?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/ReviewController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/application/default/controllers/ReviewController.php b/application/default/controllers/ReviewController.php index 2dd8dd3e..c7879bb0 100644 --- a/application/default/controllers/ReviewController.php +++ b/application/default/controllers/ReviewController.php @@ -25,16 +25,16 @@ class ReviewController extends Zend_Controller_Action function indexAction() { //最新10个收稿 - $sql="select m.uuid,m.title,date(s.ts_created) as ts_created from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=0 order by s.ts_created desc limit 10"; + $sql="select m.uuid,m.title,date(s.ts_created) as ts_created from mdstatus s right join metadata m on m.uuid=s.uuid where s.status=0 order by s.ts_created desc limit 10"; $this->view->mdreceived = $this->db->fetchAll($sql); //最新10个接收 - $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=1 order by s.ts_created desc limit 10"; + $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s right join metadata m on m.uuid=s.uuid where s.status=1 order by s.ts_created desc limit 10"; $this->view->mdaccepted = $this->db->fetchAll($sql); //最新10个送审 - $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status in (2,3,4) order by s.ts_created desc limit 10"; + $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s right join metadata m on m.uuid=s.uuid where s.status in (2,3,4) order by s.ts_created desc limit 10"; $this->view->mdinreview = $this->db->fetchAll($sql); //最新10个已审 - $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=5 order by s.ts_created desc limit 10"; + $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s right join metadata m on m.uuid=s.uuid where s.status=5 order by s.ts_created desc limit 10"; $this->view->mdreviewed = $this->db->fetchAll($sql); //统计数字 $sql="select (select count(*) from mdexperts) as experts,(select count(*) from mdstatus where status=0) as draft,(select count(*) from mdstatus where status=1) as accept,(select count(*) from mdstatus where status in (2,3,4)) as inreview,(select count(*) from mdstatus where status=5) as reviewed,(select count(*) from mdreview) as openreview,(select count(distinct(userid)) from mdreview) as openreviewuser"; @@ -101,9 +101,9 @@ class ReviewController extends Zend_Controller_Action $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); - $row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status in (1)"); + $row=$this->db->fetchAll("select count(s.*) from mdstatus s right join normalmetadata m on s.uuid=m.uuid where s.status in (1)"); $sum=$row[0]['count']; - $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (1) order by s.ts_created desc,m.title limit ? offset ?"; + $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s right join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (1) order by s.ts_created desc,m.title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); } @@ -120,9 +120,9 @@ class ReviewController extends Zend_Controller_Action $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); - $row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status in (2,3,4)"); + $row=$this->db->fetchAll("select count(s.*) from mdstatus s right join normalmetadata m on s.uuid=m.uuid where s.status in (2,3,4)"); $sum=$row[0]['count']; - $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (2,3,4) order by s.ts_created desc,m.title limit ? offset ?"; + $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s right join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (2,3,4) order by s.ts_created desc,m.title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); }//在审阶段的元数据