鼠笼管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
squirrel_cage/application/models/NewSquirrel.php

68 lines
4.0 KiB

<?php
class NewSquirrelModel extends Orm_Base{
public $table = 'new_squirrel';
public $field = array(
'id' => array('type' => "int(11)",'comment' => ''),
'count' => array('type' => "varchar(45)",'comment' => '笼位编号'),
'birthday' => array('type' => "int(11)",'comment' => '小鼠生日'),
'father' => array('type' => "varchar(255)",'comment' => '小鼠父亲'),
'mother' => array('type' => "varchar(255)",'comment' => '小鼠母亲'),
7 months ago
'strains' => array('type' => "varchar(255)",'comment' => '小鼠品系'),
'gene' => array('type' => "varchar(255)",'comment' => '小鼠基因'),
'remark' => array('type' => "int(11)",'comment' => '备注'),
'is_fen' => array('type' => "varchar(255)",'comment' => '是否杀死'),
'fen_num' => array('type' => "varchar(255)",'comment' => '是否删除'),
'cage' => array('type' => "varchar(255)",'comment' => '笼位id'),
'created' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'c_user_id' => array('type' => "varchar(255)",'comment' => '操作人信息'),
'weaning_time' => array('type' => "varchar(255)",'comment' => '断奶时间'),
'nursing_time' => array('type' => "varchar(255)",'comment' => '护理时间'),
'grow_time' => array('type' => "varchar(255)",'comment' => '成长时间'),
'infertility_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'dose_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
7 months ago
'kill_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'del_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'jianwei_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'test_time' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'kill_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'del_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'jianwei_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
'test_show' => array('type' => "varchar(255)",'comment' => '是否为新生小鼠'),
);
public $pk = 'id';
public function getModelList($params){
7 months ago
$CageModel = new CageModel();
6 months ago
$SquirrelModel = new SquirrelModel();
//获取幼崽信息
6 months ago
$data['wj']=$this->field('id,count,birthday,father,mother,strains,gene,remark,cage,is_fen')->where("id>0 {$params['where']} and is_fen=0")->fList();
6 months ago
foreach($data['wj'] as $key => &$val){
6 months ago
$val['cage'] = $CageModel->field('number')->where("id={$val['cage']}")->fRow()['number'];
$val['icon'] = Yaf_Registry::get("config")->web->url->img."/public/icon/small.png";
6 months ago
}
6 months ago
$data['j'] = $SquirrelModel->field('id,number,birthday,father,mother,strains_id as strains,gene,remark,cage')->where("type=2 {$params['where']}")->fList();
foreach($data['j'] as $key => &$va){
6 months ago
$va['cage'] = $CageModel->field('number')->where("id={$va['cage']}")->fRow()['number'];
$va['icon'] = Yaf_Registry::get("config")->web->url->img."/public/icon/small.png";
7 months ago
}
return $data;
}
7 months ago
public function getOneInfo($squirrel){
7 months ago
$CageModel = new CageModel();
6 months ago
$data = $this->field('id,count,birthday,father,mother,strains,gene,remark,cage,weaning_time,nursing_time,grow_time,infertility_time,dose_time,cage cage_id,c_user_id')->where("id={$squirrel}")->fRow();
7 months ago
$data['cage'] = $CageModel->field('number')->where("id={$data['cage']}")->fRow()['number'];
7 months ago
$data['icon'] = Yaf_Registry::get("config")->web->url->img."/public/icon/small.png";
7 months ago
return $data;
7 months ago
}
7 months ago
public function operate($params){
foreach($params as $key => $val){
if(empty($val)){
unset($params[$key]);
}
}
if(!$this->update($params)) return false;
return true;
}
}