TYPE=VIEW query=select if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `varbarname`,`heatwatch`.`bar`.`cowType` AS `cowType`,count(0) AS `barcow_no`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from (`heatwatch`.`cow` left join `heatwatch`.`bar` on(((`heatwatch`.`cow`.`intCurBar` = `heatwatch`.`bar`.`varBarCode`) and (`heatwatch`.`cow`.`intPastureId` = `heatwatch`.`bar`.`intPastureId`)))) where isnull(`heatwatch`.`cow`.`dateLeave`) group by `heatwatch`.`cow`.`intPastureId`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBar`,0) union select \'合计\' AS `合计`,\'\' AS `n`,count(0) AS `count(0)`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from `heatwatch`.`cow` where (isnull(`heatwatch`.`cow`.`dateLeave`) and (`heatwatch`.`cow`.`intPastureId` = 12)) group by `heatwatch`.`cow`.`intPastureId` md5=4d080914d48cdafc697ee6c4c6478ecb updatable=0 algorithm=0 definer_user=roo definer_host=% suid=1 with_check_option=0 timestamp=2022-12-14 10:07:38 create-version=1 source=select if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\') AS `varbarname`,`bar`.`cowType` AS `cowType`,count(0) AS `barcow_no`,`cow`.`intPastureId` AS `intPastureId` from (`cow` left join `bar` on(`cow`.`intCurBar` = `bar`.`varBarCode` and `cow`.`intPastureId` = `bar`.`intPastureId`)) where `cow`.`dateLeave` is null group by `cow`.`intPastureId`,if(`cow`.`intCurBar` > 0,`cow`.`intCurBar`,0) union select \'合计\' AS `合计`,\'\' AS `n`,count(0) AS `count(0)`,`cow`.`intPastureId` AS `intPastureId` from `cow` where `cow`.`dateLeave` is null and `cow`.`intPastureId` = 12 group by `cow`.`intPastureId` client_cs_name=utf8 connection_cl_name=utf8_general_ci view_body_utf8=select if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `varbarname`,`heatwatch`.`bar`.`cowType` AS `cowType`,count(0) AS `barcow_no`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from (`heatwatch`.`cow` left join `heatwatch`.`bar` on(((`heatwatch`.`cow`.`intCurBar` = `heatwatch`.`bar`.`varBarCode`) and (`heatwatch`.`cow`.`intPastureId` = `heatwatch`.`bar`.`intPastureId`)))) where isnull(`heatwatch`.`cow`.`dateLeave`) group by `heatwatch`.`cow`.`intPastureId`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBar`,0) union select \'合计\' AS `合计`,\'\' AS `n`,count(0) AS `count(0)`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from `heatwatch`.`cow` where (isnull(`heatwatch`.`cow`.`dateLeave`) and (`heatwatch`.`cow`.`intPastureId` = 12)) group by `heatwatch`.`cow`.`intPastureId`