/** * 表统计 * * @param array $filter * @return int */ public function count(array $filter = array()) { $sql = "SELECT COUNT(*) FROM " . $this->db->table($this->tableName); if (!empty($filter)) { $sql .= " WHERE " . $this->parseFilter($filter); } return intval($this->db->getOne($sql)); }