| | |
| | | <mapper namespace="org.springblade.jfpt.animalheat.mapper.AnimalHeatMapper"> |
| | | |
| | | <!--查询当天体温数据统计--> |
| | | <select id="getAnimalStatis" resultType="org.springblade.jfpt.animalheat.vo.StatisVo"> |
| | | <select id="getAnimalStatis" resultType="java.util.HashMap"> |
| | | SELECT 1 `status`,count(`status`) number FROM `blade_animal_heat` where |
| | | TO_DAYS(create_time)=TO_DAYS(now()) and `status`=1 |
| | | UNION |
| | |
| | | </select> |
| | | |
| | | <!--获取本周的体温统计数据--> |
| | | <select id="getAnimalStatisWeek" resultType="org.springblade.jfpt.animalheat.vo.StatisVo"> |
| | | <select id="getAnimalStatisWeek" resultType="java.util.HashMap"> |
| | | SELECT 1 `status`,count(`status`) number FROM `blade_animal_heat` where |
| | | YEARWEEK(date_format(create_time,'%Y-%m-%d')) = YEARWEEK(now()) and `status`=1 |
| | | UNION |
| | |
| | | ORDER BY create_time asc |
| | | </select> |
| | | |
| | | <!--查询本周每天的体温数据(按礼拜一开始计算)--> |
| | | <select id="selWeekDayAnimalStatis" resultType="java.util.HashMap"> |
| | | select DATE_FORMAT(date(subdate(curdate(),date_format(curdate(),'%w')-1)),'%m-%d') time,ifNull(count(*),0) as number |
| | | from blade_animal_heat |
| | | where |
| | | date_format(create_time,'%Y-%m-%d')=date(subdate(curdate(),date_format(curdate(),'%w')-1)) |
| | | union all |
| | | select DATE_FORMAT(DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 1 day)),'%m-%d') time,ifNull(count(*),0) as number |
| | | from blade_animal_heat |
| | | where |
| | | date_format(create_time,'%Y-%m-%d')=DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 1 day)) |
| | | union all |
| | | select DATE_FORMAT(DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 2 day)),'%m-%d') time,ifNull(count(*),0) as number |
| | | from blade_animal_heat |
| | | where |
| | | date_format(create_time,'%Y-%m-%d')=DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 2 day)) |
| | | union all |
| | | select DATE_FORMAT(DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 3 day)),'%m-%d') time,ifNull(count(*),0) as number |
| | | from blade_animal_heat |
| | | where |
| | | date_format(create_time,'%Y-%m-%d')=DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 3 day)) |
| | | union all |
| | | select DATE_FORMAT(DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 4 day)),'%m-%d') time,ifNull(count(*),0) as number |
| | | from blade_animal_heat |
| | | where |
| | | date_format(create_time,'%Y-%m-%d')=DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 4 day)) |
| | | union all |
| | | select DATE_FORMAT(DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 5 day)),'%m-%d') time,ifNull(count(*),0) as number |
| | | from blade_animal_heat |
| | | where |
| | | date_format(create_time,'%Y-%m-%d')=DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 5 day)) |
| | | union all |
| | | select DATE_FORMAT(DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 6 day)),'%m-%d') time,ifNull(count(*),0) as number |
| | | from blade_animal_heat |
| | | where |
| | | date_format(create_time,'%Y-%m-%d')=DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 6 day)) |
| | | </select> |
| | | |
| | | </mapper> |