切换sql中的left join为right join以防止已删除的元数据出现
This commit is contained in:
parent
3c4508c432
commit
9defd381ad
|
@ -25,16 +25,16 @@ class ReviewController extends Zend_Controller_Action
|
||||||
function indexAction()
|
function indexAction()
|
||||||
{
|
{
|
||||||
//最新10个收稿
|
//最新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);
|
$this->view->mdreceived = $this->db->fetchAll($sql);
|
||||||
//最新10个接收
|
//最新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);
|
$this->view->mdaccepted = $this->db->fetchAll($sql);
|
||||||
//最新10个送审
|
//最新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);
|
$this->view->mdinreview = $this->db->fetchAll($sql);
|
||||||
//最新10个已审
|
//最新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);
|
$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";
|
$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');
|
$page=@(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($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'];
|
$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->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$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');
|
$page=@(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($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'];
|
$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->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
}//在审阶段的元数据
|
}//在审阶段的元数据
|
||||||
|
|
Loading…
Reference in New Issue