| 123456789101112131415 |
- TYPE=VIEW
- query=select distinct `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,if((`s2`.`dateEvtDate` > 0),\'同期发情\',\'正常发情\') AS `sort`,if(((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) > -(1)),concat(\'发情天数\',(to_days(curdate()) - to_days(`s1`.`dateEvtDate`)),\',发情评分:\',if((`heatwatch`.`estrus`.`intScore` = 3),\'+++\',if((`heatwatch`.`estrus`.`intScore` = 2),\'++\',\'+\')),\' DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0)),concat(\'DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0))) AS `DESCRIB`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from ((((`heatwatch`.`cow` left join `heatwatch`.`events` `s1` on(((`heatwatch`.`cow`.`intCowId` = `s1`.`intCowId`) and (`s1`.`intClass` = \'发情\')))) left join `heatwatch`.`estrus` on((`s1`.`intEvtId` = `heatwatch`.`estrus`.`intEvtId`))) left join ((`heatwatch`.`events` `s2` join `heatwatch`.`events` `s3` on(((`s2`.`intCowId` = `s3`.`intCowId`) and (`s2`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`s2`.`dateEvtDate`)) = 1) and (`s3`.`intClass` = \'PG\') and ((to_days(curdate()) - to_days(`s3`.`dateEvtDate`)) = 3)))) join `heatwatch`.`events` `s4` on(((`s3`.`intCowId` = `s4`.`intCowId`) and (`s4`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`s4`.`dateEvtDate`)) = 10)))) on((`heatwatch`.`cow`.`intCowId` = `s2`.`intCowId`))) join `heatwatch`.`manageparam` `m` on(((`heatwatch`.`cow`.`intPastureId` = `m`.`intPastureId`) and (`m`.`varDiscribe` = \'产后几天配种\')))) where ((((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) < 4) or (`s2`.`dateEvtDate` > 0)) and ((to_days(ifnull(`heatwatch`.`cow`.`dateCurPz`,\'2016-1-1\')) - to_days(`s1`.`dateEvtDate`)) < 0) and (ifnull(`heatwatch`.`cow`.`lactationDays`,0) >= `m`.`varVal`) and isnull(`heatwatch`.`cow`.`dateLeave`) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`assist`.`intCowId` from `heatwatch`.`assist` where ((`heatwatch`.`assist`.`sort` in (1,2)) and ((to_days(curdate()) - to_days(`heatwatch`.`assist`.`eventDateTime`)) < 3) and isnull(`heatwatch`.`assist`.`checkDateTime`)))))) order by `heatwatch`.`cow`.`intCurBarName`,`heatwatch`.`cow`.`varCowCode`
- md5=c7ab48473cea99863373fbcabc68e2f3
- updatable=0
- algorithm=0
- definer_user=root
- definer_host=%
- suid=1
- with_check_option=0
- timestamp=2022-12-14 10:07:39
- create-version=1
- source=select distinct `cow`.`varCowCode` AS `varCowCode`,if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,if(`s2`.`dateEvtDate` > 0,\'同期发情\',\'正常发情\') AS `sort`,if(to_days(curdate()) - to_days(`s1`.`dateEvtDate`) > -1,concat(\'发情天数\',to_days(curdate()) - to_days(`s1`.`dateEvtDate`),\',发情评分:\',if(`estrus`.`intScore` = 3,\'+++\',if(`estrus`.`intScore` = 2,\'++\',\'+\')),\' DIM:\',ifnull(`cow`.`lactationDays`,0)),concat(\'DIM:\',ifnull(`cow`.`lactationDays`,0))) AS `DESCRIB`,`cow`.`intPastureId` AS `intPastureId` from ((((`cow` left join `events` `s1` on(`cow`.`intCowId` = `s1`.`intCowId` and `s1`.`intClass` = \'发情\')) left join `estrus` on(`s1`.`intEvtId` = `estrus`.`intEvtId`)) left join ((`events` `s2` join `events` `s3` on(`s2`.`intCowId` = `s3`.`intCowId` and `s2`.`intClass` = \'GnRH\' and to_days(curdate()) - to_days(`s2`.`dateEvtDate`) = 1 and `s3`.`intClass` = \'PG\' and to_days(curdate()) - to_days(`s3`.`dateEvtDate`) = 3)) join `events` `s4` on(`s3`.`intCowId` = `s4`.`intCowId` and `s4`.`intClass` = \'GnRH\' and to_days(curdate()) - to_days(`s4`.`dateEvtDate`) = 10)) on(`cow`.`intCowId` = `s2`.`intCowId`)) join `manageparam` `m` on(`cow`.`intPastureId` = `m`.`intPastureId` and `m`.`varDiscribe` = \'产后几天配种\')) where (to_days(curdate()) - to_days(`s1`.`dateEvtDate`) < 4 or `s2`.`dateEvtDate` > 0) and to_days(ifnull(`cow`.`dateCurPz`,\'2016-1-1\')) - to_days(`s1`.`dateEvtDate`) < 0 and ifnull(`cow`.`lactationDays`,0) >= `m`.`varVal` and `cow`.`dateLeave` is null and !(`cow`.`intCowId` in (select `assist`.`intCowId` from `assist` where `assist`.`sort` in (1,2) and to_days(curdate()) - to_days(`assist`.`eventDateTime`) < 3 and `assist`.`checkDateTime` is null)) order by `cow`.`intCurBarName`,`cow`.`varCowCode`
- client_cs_name=utf8
- connection_cl_name=utf8_general_ci
- view_body_utf8=select distinct `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,if((`s2`.`dateEvtDate` > 0),\'同期发情\',\'正常发情\') AS `sort`,if(((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) > -(1)),concat(\'发情天数\',(to_days(curdate()) - to_days(`s1`.`dateEvtDate`)),\',发情评分:\',if((`heatwatch`.`estrus`.`intScore` = 3),\'+++\',if((`heatwatch`.`estrus`.`intScore` = 2),\'++\',\'+\')),\' DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0)),concat(\'DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0))) AS `DESCRIB`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from ((((`heatwatch`.`cow` left join `heatwatch`.`events` `s1` on(((`heatwatch`.`cow`.`intCowId` = `s1`.`intCowId`) and (`s1`.`intClass` = \'发情\')))) left join `heatwatch`.`estrus` on((`s1`.`intEvtId` = `heatwatch`.`estrus`.`intEvtId`))) left join ((`heatwatch`.`events` `s2` join `heatwatch`.`events` `s3` on(((`s2`.`intCowId` = `s3`.`intCowId`) and (`s2`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`s2`.`dateEvtDate`)) = 1) and (`s3`.`intClass` = \'PG\') and ((to_days(curdate()) - to_days(`s3`.`dateEvtDate`)) = 3)))) join `heatwatch`.`events` `s4` on(((`s3`.`intCowId` = `s4`.`intCowId`) and (`s4`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`s4`.`dateEvtDate`)) = 10)))) on((`heatwatch`.`cow`.`intCowId` = `s2`.`intCowId`))) join `heatwatch`.`manageparam` `m` on(((`heatwatch`.`cow`.`intPastureId` = `m`.`intPastureId`) and (`m`.`varDiscribe` = \'产后几天配种\')))) where ((((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) < 4) or (`s2`.`dateEvtDate` > 0)) and ((to_days(ifnull(`heatwatch`.`cow`.`dateCurPz`,\'2016-1-1\')) - to_days(`s1`.`dateEvtDate`)) < 0) and (ifnull(`heatwatch`.`cow`.`lactationDays`,0) >= `m`.`varVal`) and isnull(`heatwatch`.`cow`.`dateLeave`) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`assist`.`intCowId` from `heatwatch`.`assist` where ((`heatwatch`.`assist`.`sort` in (1,2)) and ((to_days(curdate()) - to_days(`heatwatch`.`assist`.`eventDateTime`)) < 3) and isnull(`heatwatch`.`assist`.`checkDateTime`)))))) order by `heatwatch`.`cow`.`intCurBarName`,`heatwatch`.`cow`.`varCowCode`
|