| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- Doo::loadCore('db/DooModel');
- /**
- * Created by PhpStorm.
- * User: ellisran
- * Date: 2016/9/22
- * Time: 16:20
- */
- class Item extends DooModel {
- public $itemid;
- public $itemname;
- public $code;
- public $_table = 'fc_item';
- public $_primarykey = 'itemid';
- public $_fields = array('itemid', 'itemname', 'code');
- public function __construct() {
- parent::setupModel(__CLASS__);
- }
- public function getRowbylimit($limit){
- return $this->find(array('desc' => 'itemid','limit'=>$limit,'asArray' => TRUE));
- }
- public function getAllMsg(){
- return $this->find(array('select' => 'itemid,itemname','desc' => 'itemid','asArray' => TRUE));
- }
- public function getRowbyid($id){
- return $this->getOne(array('select' => 'itemid,itemname,code', 'where' => 'itemid='.$id, 'asArray' => TRUE));
- }
- public function getfisrtitemid(){
- $item = $this->getOne(array('select' => 'itemid', 'desc' => 'itemid', 'limit' => 1, 'asArray' => TRUE));
- return $item['itemid'];
- }
- public function getnamebyid($id){
- $item = $this->getOne(array('select' => 'itemname', 'where' => 'itemid='.$id, 'asArray' => TRUE));
- return $item['itemname'];
- }
- public function getRowbyCode($code){
- return $this->getOne(array('select' => 'itemid,itemname,code', 'where' => 'code="'.$code.'"', 'asArray' => TRUE));
- }
- }
|