企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### listBySql **动态构建select sql并执行** **参数** \* 1.$sql:传入的基本select语句 \* 2.$param:构造sql所需参数 \* 返回: Array 二维数组.第一维是所有记录,第二维是某条记录的字段数组 ~~~ function listBySql($sql) { $sql=str_replace ( "@", "", $sql ); //拼装搜索条件 $sql = $this->createQuery ( $sql, $this->searchArr ); //构建group by $groupBy = $this->groupBy; if (isset ( $groupBy ) && ! empty ( $groupBy ) && $groupBy != "id") { $sql .= " group By $groupBy "; } //构建排序信息 if(!empty($this->sort)){ $asc = $this->asc ? "DESC" : "ASC"; //echo $this->asc; $sql .= " order by " . $this->sort . " " . $asc; } $this->listSql=$sql; // echo $sql." "; return $this->_db->getArray ( $sql ); } ~~~