| | |
| | | <!--获取本周的体温统计数据--> |
| | | <select id="getAnimalStatisWeek" resultType="java.util.HashMap"> |
| | | SELECT 1 `name`,count(`status`) value FROM `blade_animal_heat` where |
| | | YEARWEEK(date_format(create_time,'%Y-%m-%d')) = YEARWEEK(now()) and `status`=1 |
| | | YEARWEEK(date_format(create_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1) and `status`=1 |
| | | UNION |
| | | SELECT 0 `name`,count(`status`) value FROM `blade_animal_heat` where |
| | | YEARWEEK(date_format(create_time,'%Y-%m-%d')) = YEARWEEK(now()) and `status`=0 |
| | | YEARWEEK(date_format(create_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1) and `status`=0 |
| | | </select> |
| | | |
| | | <!--获取本月的体温统计数据--> |
| | | <select id="getAnimalStatisMonth" resultType="java.util.HashMap"> |
| | | SELECT 1 `name`,count(`status`) value FROM `blade_animal_heat` where |
| | | date_format(create_time,'%Y%m') = date_format(now(),'%Y%m') and `status`=1 |
| | | UNION |
| | | SELECT 0 `name`,count(`status`) value FROM `blade_animal_heat` where |
| | | date_format(create_time,'%Y%m') = date_format(now(),'%Y%m') and `status`=0 |
| | | </select> |
| | | |
| | | <!--查询体温数据的分页数据--> |
| | | <select id="selectAnimalHeatPageList" resultType="org.springblade.jfpt.animalheat.entity.BladeAnimalHeat"> |
| | | SELECT * FROM blade_animal_heat |
| | | <if test="animalHeatVo.begTime!=null and animalHeatVo.begTime!=''"> |
| | |
| | | date_format(create_time,'%Y-%m-%d')=DATE(DATE_ADD(subdate(curdate(),date_format(curdate(),'%w')-1), interval 6 day)) |
| | | </select> |
| | | |
| | | |
| | | <!--统计7天内每天体温异常的的总人数--> |
| | | <select id="selectAnimalHeatDataStatis" resultType="java.lang.Integer"> |
| | | select ifnull(b.count,0) as count from |
| | | ( |
| | | SELECT DATE_FORMAT(date_sub(curdate(), interval 6 day),'%Y-%m-%d') as click_date |
| | | union all |
| | | SELECT DATE_FORMAT(date_sub(curdate(), interval 5 day),'%Y-%m-%d') as click_date |
| | | union all |
| | | SELECT DATE_FORMAT(date_sub(curdate(), interval 4 day),'%Y-%m-%d') as click_date |
| | | union all |
| | | SELECT DATE_FORMAT(date_sub(curdate(), interval 3 day),'%Y-%m-%d') as click_date |
| | | union all |
| | | SELECT DATE_FORMAT(date_sub(curdate(), interval 2 day),'%Y-%m-%d') as click_date |
| | | union all |
| | | SELECT DATE_FORMAT(date_sub(curdate(), interval 1 day),'%Y-%m-%d') as click_date |
| | | union all |
| | | SELECT DATE_FORMAT(curdate(),'%Y-%m-%d') as click_date |
| | | ) a |
| | | left join |
| | | ( |
| | | select DATE_FORMAT(create_time,'%Y-%m-%d') as datetime, count(*) as count from blade_animal_heat |
| | | where `status`=1 |
| | | group by DATE_FORMAT(create_time,'%Y-%m-%d') |
| | | ) b |
| | | on |
| | | a.click_date = b.datetime |
| | | </select> |
| | | </mapper> |