- /**
- * 添加数据
- * @param array $data 数据
- * @return int|string
- */
- public function add($data)
- {
- return $this->insertGetId($data);
- }
- /**
- * 根据编号 删除数据
- * @param int $id 编号
- * @return int
- */
- public function removeOne_byId($id)
- {
- return $this->where('id', $id)->delete();
- }
- /**
- * 根据编号 修改数据
- * @param array $data 数据
- * @return $this
- */
- public function modifyOne_byId($data)
- {
- return $this->where('id', $data['id'])->update($data);
- }
- /**
- * 读取全部数据
- * @return null
- */
- public function readAll()
- {
- return $this->ta($this->order('id', $this->_order)->select());
- }
- /**
- * 根据编号 读取数据
- * @param int $id 编号
- * @return null
- */
- public function readOne_byId($id)
- {
- return $this->ta($this->where('id', $id)->find());
- }
- /**
- * 分页读取数据
- * @param int $page_now 当前页
- * @return null
- */
- public function limitAll($page_now = 1)
- {
- return $this->ta(
- $this
- ->whereIn('f_area_city_id', session('emp.f_area_id'))
- ->order('id', $this->_order)
- ->limit($this->_page_size)
- ->page($page_now)
- ->select()
- );
- }
- //该片段来自于http://www.codesnippet.cn/detail/0606201715225.html
来源: http://www.codesnippet.cn/detail/0606201715225.html