From 4c0386906413bc2494aa029c2c2194691d68ef63 Mon Sep 17 00:00:00 2001 From: wlx Date: Thu, 15 May 2014 16:02:23 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E9=A2=98=E6=96=87=E7=8C=AE=E7=9A=84sq?= =?UTF-8?q?l=E6=95=88=E7=8E=87=E6=8F=90=E5=8D=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/module/Reference/Reference.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/application/module/Reference/Reference.php b/application/module/Reference/Reference.php index a38a9627..c787a9b8 100644 --- a/application/module/Reference/Reference.php +++ b/application/module/Reference/Reference.php @@ -221,14 +221,14 @@ class Reference public function fetchThemeReferences($code) { $wheresql = array(); - $wheresql[] = " s.code='$code' "; + //$wheresql[] = " s.code='$code' "; if(!empty($this->keyword)) { - $wheresql[] = " (ref.title LIKE '%{$this->keyword}%' OR ref.reference LIKE '%{$this->keyword}%') "; + $wheresql[] = " (ref.title iLIKE '%{$this->keyword}%' OR ref.reference iLIKE '%{$this->keyword}%') "; } if(count($wheresql)>0) { - $wheresql = " WHERE ".join(" AND ",$wheresql); + $wheresql = " and ".join(" AND ",$wheresql); }else{ $wheresql = ""; } @@ -240,9 +240,10 @@ class Reference $order = "ref.{$this->order} {$this->sort}"; } - $sql="select distinct ref.* from mdref r left join {$this->table->reference} ref on r.refid=ref.id + $sql="select distinct ref.* from {$this->table->reference} ref where ref.id in (select r.refid from mdref r left join datasource ds on r.uuid=ds.uuid left join {$this->table->source} s on s.id=ds.sourceid - $wheresql + where s.code='$code') + $wheresql ORDER BY $order"; $rs=$this->db->query($sql); return $rs->fetchAll();