| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- Doo::loadCore('db/DooModel');
- /**
- * Created by PhpStorm.
- * User: ellisran
- * Date: 2016/9/22
- * Time: 16:20
- */
- class Version extends DooModel {
- public $verid;
- public $reportid;
- public $vername;
- public $content;
- public $xmlheader;
- public $xmlbody;
- public $status;
- public $addtime;
- public $edittime;
- public $_table = 'fc_version';
- public $_primarykey = 'verid';
- public $_fields = array('verid', 'reportid', 'vername', 'content', 'xmlheader', 'xmlbody', 'status', 'addtime', 'edittime');
- public function __construct() {
- parent::setupModel(__CLASS__);
- }
- public function getRowbyreport($reportid){
- return $this->find(array('where' => 'status!=0 and reportid='.$reportid, 'desc' => 'addtime', 'asArray' => TRUE));
- }
- public function getRowbyid($id){
- return $this->getOne(array('where' => 'verid='.$id ,'asArray' => TRUE));
- }
- public function getRowbyVername($ver){
- return $this->getOne(array('where' => 'vername='.$ver ,'asArray' => TRUE));
- }
- public function getreportidbyid($id){
- $result = $this->getOne(array('select' => 'reportid', 'where' => 'verid='.$id, 'asArray' => TRUE));
- return $result['reportid'];
- }
- public function getvertime($id){
- $result = $this->getOne(array('select' => 'addtime', 'where' => 'verid='.$id, 'asArray' => TRUE));
- return $result['addtime'];
- }
- public function getLastVerbyrid($rid){
- return $this->getOne(array('where' => 'status=2 and reportid='.$rid, 'desc' => 'addtime', 'asArray' => TRUE));
- }
- }
|