#302 修改“我的数据”调用时使用的sql语句,增加了状态判断和排序规则

This commit is contained in:
Li Jianxuan 2012-03-21 03:45:03 +00:00
parent eda40489af
commit 428d5bccfc
1 changed files with 9 additions and 6 deletions

View File

@ -333,9 +333,10 @@ class AuthorController extends Zend_Controller_Action
//列表
if(empty($ac) || $ac=='list'){
$sql = "SELECT a.*,m.title,m.description FROM mdauthor a
LEFT JOIN normalmetadata m ON m.uuid=a.uuid
WHERE a.userid=?
$sql = "SELECT a.*,m.title,m.description FROM normalmetadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid
WHERE a.userid=? AND status>=0
ORDER BY status DESC,a.id DESC
";
$sth = $this->db->prepare($sql);
@ -363,9 +364,11 @@ class AuthorController extends Zend_Controller_Action
else
{
//搜索标题和描述两个字段
$sql = "SELECT m.uuid,m.title,m.description,a.status,a.userid FROM metadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid
WHERE (m.title like ? OR m.description like ?) AND a.userid=?";
$sql = "SELECT a.*,m.title,m.description FROM normalmetadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid
WHERE (m.title like ? OR m.description like ?) AND a.userid=? AND status>=0
ORDER BY status DESC,a.id DESC
";
$sth = $this->db->prepare($sql);
$sth->execute(array("%$keyword%","%$keyword%",$u_id));
$rows = $sth->fetchAll();