* fix beginIF for dao.class.php and saveQueryCondition for doc.

This commit is contained in:
wangyidong
2016-03-14 15:59:12 +08:00
parent e843e0004d
commit b5a42dedda
2 changed files with 6 additions and 0 deletions

View File

@@ -1897,6 +1897,8 @@ class baseSQL
*/
public function orderBy($order)
{
if($this->inCondition and !$this->conditionIsTrue) return $this;
$order = str_replace(array('|', '', '_'), ' ', $order);
/* Add "`" in order string. */
@@ -1941,6 +1943,7 @@ class baseSQL
*/
public function limit($limit)
{
if($this->inCondition and !$this->conditionIsTrue) return $this;
if(empty($limit)) return $this;
stripos($limit, 'limit') !== false ? $this->sql .= " $limit " : $this->sql .= ' ' . DAO::LIMIT . " $limit ";
return $this;
@@ -1956,6 +1959,7 @@ class baseSQL
*/
public function groupBy($groupBy)
{
if($this->inCondition and !$this->conditionIsTrue) return $this;
$this->sql .= ' ' . DAO::GROUPBY . " $groupBy";
return $this;
}
@@ -1970,6 +1974,7 @@ class baseSQL
*/
public function having($having)
{
if($this->inCondition and !$this->conditionIsTrue) return $this;
$this->sql .= ' ' . DAO::HAVING . " $having";
return $this;
}

View File

@@ -152,6 +152,7 @@ class docModel extends model
$docs = $this->dao->select('*')->from(TABLE_DOC)->where($docQuery)->andWhere('deleted')->eq(0)->orderBy($sort)->page($pager)->fetchAll();
}
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'doc');
if($docs) return $docs;
return array();