public function search($where, &$page = NULL) { $sql = "SELECT a.*,b.user_name from {$this->_table} a inner join mp_account b on a.id = b.other_id and sorts = 2 "; $sqlCnt = "SELECT COUNT(*) AS cnt FROM mp_corporate a inner join mp_account b on a.id = b.other_id and sorts = 2 "; // $sql = "SELECT a.*,(select user_name FROM {$this->_table} where id = a.u_user) as m_user_name from {$this->_table} a "; return parent::search($where, $page, $sql, $sqlCnt); }
public function search($where, &$page = NULL) { $sql = "SELECT a.* from {$this->_table} a "; // $sql = "SELECT a.*,(select user_name FROM {$this->_table} where id = a.u_user) as m_user_name from {$this->_table} a "; $order = "id desc "; return parent::search($where, $page, $sql, null, $order); }
public function search_csv($where) { $sql = "SELECT a.*,b.ins_co_name,c.electric_name,(select user_name FROM {$this->_table} where id = a.u_user) as m_user_name from {$this->_table} a "; $sql = $sql . " LEFT JOIN M_INS_CO b ON a.ins_co_cd = b.ins_co_cd "; $sql = $sql . " LEFT JOIN M_ELECTRIC c ON a.electric_id = c.id "; $page = null; return parent::search($where, $page, $sql); }
public function search($where, &$page = NULL, $pro = NULL) { $sqljoin = " select spec_id, group_concat(pro_name) as proname from mp_pro "; if ($pro) { $sqljoin = " inner join (" . $sqljoin . " where pro_id in " . $pro . " group by spec_id ) c on c.spec_id = a.id "; } else { $sqljoin = " left join (" . $sqljoin . " group by spec_id ) c on c.spec_id = a.id "; } $sql = "SELECT a.*,b.user_name,c.proname from {$this->_table} a inner join mp_account b on a.id = b.other_id and sorts = 3 {$sqljoin}"; $sqlCnt = "SELECT COUNT(*) AS cnt FROM {$this->_table} a inner join mp_account b on a.id = b.other_id and sorts = 3 "; if ($pro) { $sqlCnt = $sqlCnt . $sqljoin; } //print_r($sql);exit; // $sql = "SELECT a.*,(select user_name FROM {$this->_table} where id = a.u_user) as m_user_name from {$this->_table} a "; return parent::search($where, $page, $sql, $sqlCnt); }
public function getProBySpecId($specid) { $sql = 'select * from mp_pro where spec_id = ' . $specid; return parent::search($where = null, $page = null, $sql); }