yangsai@163.com 9 months ago
parent 76f9b51193
commit 2db25c42e6
  1. 6
      application/models/Cage.php

@ -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"); $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); $mannum = $this->query($sql);
if(!empty($mannum)){ if(!empty($mannum)){
$val['mannum'] = $mannum[0]['num']; $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); $womannum = $this->query($sql);
if(!empty($womannum)){ if(!empty($womannum)){
$val['womannum'] = $womannum[0]['num']; $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); $othernum = $this->query($sql);
if(!empty($othernum)){ if(!empty($othernum)){
$val['othernum'] = $othernum[0]['num']; $val['othernum'] = $othernum[0]['num'];

Loading…
Cancel
Save