function mget_rec_count($params = NULL) { $this->db->select($params['select']); $this->db->from($params['table']); if (array_key_exists('join', $params)) { DBX::join($this, $params['join']); } if (array_key_exists('where', $params)) { $this->db->where($params['where']); } if (array_key_exists('like', $params)) { $this->db->where($params['like']); } $result = $this->db->get(); $num_row = $result->num_rows() > 0 ? $result->num_rows() : 0; $result = $this->mget_rec($params); $response['total'] = $num_row; $response['rows'] = $result; return $response; }
function mhas_child_tree($params, $id) { $this->db->select('COUNT(*) AS rec_count'); $this->db->from($params['table']); if (array_key_exists('join', $params)) { DBX::join($this, $params['join']); } if (array_key_exists('where', $params)) { $this->db->where($params['where']); } $this->db->where('parent_id', $id); // $this->db->where('is_deleted', 0); return $this->db->get()->row()->rec_count > 0 ? TRUE : FALSE; }
function gen_join() { $params['join'][] = ['a_user_config as auc', 'au.id = auc.user_id']; DBX::join($this, $params['join']); }