42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
/*
|
|
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
|
|
* @license https://www.oaooa.com/licenses/
|
|
*
|
|
* @link https://www.oaooa.com
|
|
* @author zyx(zyx@oaooa.com)
|
|
*/
|
|
if(!defined('IN_OAOOA')) {
|
|
exit('Access Denied');
|
|
}
|
|
|
|
class table_district extends dzz_table
|
|
{
|
|
public function __construct() {
|
|
|
|
$this->_table = 'district';
|
|
$this->_pk = 'id';
|
|
|
|
parent::__construct();
|
|
}
|
|
|
|
public function fetch_all_by_upid($upid, $order = null, $sort = 'DESC') {
|
|
$upid = is_array($upid) ? array_map('intval', (array)$upid) : dintval($upid);
|
|
if($upid !== null) {
|
|
$ordersql = $order !== null && !empty($order) ? ' ORDER BY '.DB::order($order, $sort) : '';
|
|
return DB::fetch_all('SELECT * FROM %t WHERE '.DB::field('upid', $upid)." $ordersql", array($this->_table), $this->_pk);
|
|
}
|
|
return array();
|
|
}
|
|
|
|
public function fetch_all_by_name($name) {
|
|
if(!empty($name)) {
|
|
return DB::fetch_all('SELECT * FROM %t WHERE '.DB::field('name', $name), array($this->_table));
|
|
}
|
|
return array();
|
|
}
|
|
|
|
}
|
|
|
|
?>
|