TYPE=VIEW
query=select `heatwatch`.`cow`.`intCowId` AS `intCowId`,`heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'同期\' AS `sort`,if(((to_days(curdate()) - to_days(`heatwatch`.`cow`.`dateCurPz`)) < `heatwatch`.`cow`.`lactationDays`),concat(\'DIM:\',`heatwatch`.`cow`.`lactationDays`,\'天，配后天数：\',(to_days(curdate()) - to_days(`heatwatch`.`cow`.`dateCurPz`)),\'天\'),concat(\'DIM:\',`heatwatch`.`cow`.`lactationDays`,\'天\')) AS `DESCRIB`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from (`heatwatch`.`cow` join `heatwatch`.`bar` on(((`heatwatch`.`cow`.`intCurBar` = `heatwatch`.`bar`.`varBarCode`) and (`heatwatch`.`cow`.`intPastureId` = `heatwatch`.`bar`.`intPastureId`)))) where ((`heatwatch`.`cow`.`belongState` = \'泌乳牛\') and ((`heatwatch`.`cow`.`sireClass` = \'未孕\') or (`heatwatch`.`cow`.`sireClass` = \'妊检未孕\')) and isnull(`heatwatch`.`cow`.`dateLeave`) and isnull(`heatwatch`.`cow`.`prohibitDate`) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`events`.`intCowId` from `heatwatch`.`events` where ((`heatwatch`.`events`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`heatwatch`.`events`.`dateEvtDate`)) < 5))))) and (((`heatwatch`.`cow`.`lactationDays` > 58) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`events`.`intCowId` from `heatwatch`.`events` where ((`heatwatch`.`events`.`intClass` = \'PG\') and ((to_days(curdate()) - to_days(`heatwatch`.`events`.`dateEvtDate`)) < 7)))))) or ((`heatwatch`.`cow`.`lastTQ` = \'PG\') and (`heatwatch`.`cow`.`lastTQDays` = 2) and `heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`events`.`intCowId` from `heatwatch`.`events` where ((`heatwatch`.`events`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`heatwatch`.`events`.`dateEvtDate`)) = 9)))))) order by `heatwatch`.`cow`.`varCowCode`
md5=794bbb0cc0ec1369b586c7e338bdd1c7
updatable=1
algorithm=0
definer_user=roo
definer_host=%
suid=1
with_check_option=0
timestamp=2022-12-14 10:07:39
create-version=1
source=select `cow`.`intCowId` AS `intCowId`,`cow`.`varCowCode` AS `varCowCode`,if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'同期\' AS `sort`,if(to_days(curdate()) - to_days(`cow`.`dateCurPz`) < `cow`.`lactationDays`,concat(\'DIM:\',`cow`.`lactationDays`,\'天，配后天数：\',to_days(curdate()) - to_days(`cow`.`dateCurPz`),\'天\'),concat(\'DIM:\',`cow`.`lactationDays`,\'天\')) AS `DESCRIB`,`cow`.`intPastureId` AS `intPastureId` from (`cow` join `bar` on(`cow`.`intCurBar` = `bar`.`varBarCode` and `cow`.`intPastureId` = `bar`.`intPastureId`)) where `cow`.`belongState` = \'泌乳牛\' and (`cow`.`sireClass` = \'未孕\' or `cow`.`sireClass` = \'妊检未孕\') and `cow`.`dateLeave` is null and `cow`.`prohibitDate` is null and !(`cow`.`intCowId` in (select `events`.`intCowId` from `events` where `events`.`intClass` = \'GnRH\' and to_days(curdate()) - to_days(`events`.`dateEvtDate`) < 5)) and (`cow`.`lactationDays` > 58 and !(`cow`.`intCowId` in (select `events`.`intCowId` from `events` where `events`.`intClass` = \'PG\' and to_days(curdate()) - to_days(`events`.`dateEvtDate`) < 7)) or `cow`.`lastTQ` = \'PG\' and `cow`.`lastTQDays` = 2 and `cow`.`intCowId` in (select `events`.`intCowId` from `events` where `events`.`intClass` = \'GnRH\' and to_days(curdate()) - to_days(`events`.`dateEvtDate`) = 9)) order by `cow`.`varCowCode`
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=select `heatwatch`.`cow`.`intCowId` AS `intCowId`,`heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'同期\' AS `sort`,if(((to_days(curdate()) - to_days(`heatwatch`.`cow`.`dateCurPz`)) < `heatwatch`.`cow`.`lactationDays`),concat(\'DIM:\',`heatwatch`.`cow`.`lactationDays`,\'天，配后天数：\',(to_days(curdate()) - to_days(`heatwatch`.`cow`.`dateCurPz`)),\'天\'),concat(\'DIM:\',`heatwatch`.`cow`.`lactationDays`,\'天\')) AS `DESCRIB`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from (`heatwatch`.`cow` join `heatwatch`.`bar` on(((`heatwatch`.`cow`.`intCurBar` = `heatwatch`.`bar`.`varBarCode`) and (`heatwatch`.`cow`.`intPastureId` = `heatwatch`.`bar`.`intPastureId`)))) where ((`heatwatch`.`cow`.`belongState` = \'泌乳牛\') and ((`heatwatch`.`cow`.`sireClass` = \'未孕\') or (`heatwatch`.`cow`.`sireClass` = \'妊检未孕\')) and isnull(`heatwatch`.`cow`.`dateLeave`) and isnull(`heatwatch`.`cow`.`prohibitDate`) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`events`.`intCowId` from `heatwatch`.`events` where ((`heatwatch`.`events`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`heatwatch`.`events`.`dateEvtDate`)) < 5))))) and (((`heatwatch`.`cow`.`lactationDays` > 58) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`events`.`intCowId` from `heatwatch`.`events` where ((`heatwatch`.`events`.`intClass` = \'PG\') and ((to_days(curdate()) - to_days(`heatwatch`.`events`.`dateEvtDate`)) < 7)))))) or ((`heatwatch`.`cow`.`lastTQ` = \'PG\') and (`heatwatch`.`cow`.`lastTQDays` = 2) and `heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`events`.`intCowId` from `heatwatch`.`events` where ((`heatwatch`.`events`.`intClass` = \'GnRH\') and ((to_days(curdate()) - to_days(`heatwatch`.`events`.`dateEvtDate`)) = 9)))))) order by `heatwatch`.`cow`.`varCowCode`
