$data = $data->where("c_user_id='{$uid}' and id!={$squirrel['cage']} and is_delete=0");
if(!empty($keyword)){
$data = $data->where("c_user_id='{$uid}' and id!={$squirrel['cage']} and is_delete=0 and (number like '%{$keyword}%' or strains like '%{$keyword}%')");
$sql = "select count(*) num from squirrel where cage={$data[$key]['id']} and is_kill=0 and is_delete=0 and sex=2";
$womannum = $this->Cagemodel->query($sql);
if(!empty($womannum)){
$data[$key]['womannum'] = $womannum[0]['num'];
// if($squirrel['sex']==1) unset($data[$key]);
}
if($val['type']==2){
if($squirrel['sex']==1){
if((int)$this->SquirrelModel->field("count(*) num")->where("sex=1 and cage={$val['id']} and id!={$squirrel['id']}")->fList()['num']==1) unset($data[$key]);
}if($squirrel['sex']==2){
if((int)$this->SquirrelModel->field("count(*) num")->where("sex=2 and cage={$val['id']} and id!={$squirrel['id']}")->fList()['num']==2) unset($data[$key]);
}
}else{
//查询笼位是否有不同性别鼠
if($squirrel['sex']==1){
if(!empty($this->SquirrelModel->field("*")->where("sex=2 and cage={$val['id']} and id!={$squirrel['id']}")->fRow())) unset($data[$key]);
}if($squirrel['sex']==2){
if(!empty($this->SquirrelModel->field("*")->where("sex=1 and cage={$val['id']} and id!={$squirrel['id']}")->fRow())) unset($data[$key]);