|
|
|
@ -37,19 +37,19 @@ class CageModel extends Orm_Base{ |
|
|
|
|
//查询鼠编号 |
|
|
|
|
$val['squirrel'] = $this->query("select number from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and type=1 limit 0,6"); |
|
|
|
|
//查询公鼠 |
|
|
|
|
$sql = "select count(*) num from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and sex=1"; |
|
|
|
|
$sql = "select count(*) num from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and sex=1 and type=1"; |
|
|
|
|
$mannum = $this->query($sql); |
|
|
|
|
if(!empty($mannum)){ |
|
|
|
|
$val['mannum'] = $mannum[0]['num']; |
|
|
|
|
} |
|
|
|
|
//查询母鼠 |
|
|
|
|
$sql = "select count(*) num from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and sex=2"; |
|
|
|
|
$sql = "select count(*) num from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and sex=2 and type=1"; |
|
|
|
|
$womannum = $this->query($sql); |
|
|
|
|
if(!empty($womannum)){ |
|
|
|
|
$val['womannum'] = $womannum[0]['num']; |
|
|
|
|
} |
|
|
|
|
//查询其他 |
|
|
|
|
$sql = "select count(*) num from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and sex=0"; |
|
|
|
|
$sql = "select count(*) num from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and sex=0 and type=1"; |
|
|
|
|
$othernum = $this->query($sql); |
|
|
|
|
if(!empty($othernum)){ |
|
|
|
|
$val['othernum'] = $othernum[0]['num']; |
|
|
|
|