package com.bofeng.dao; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.bofeng.entity.MsReport; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; /** * @Author: xielianghe * @Date: 2020/2/4 15:45 */ @Mapper @Repository public interface MsReportMapper extends BaseMapper { List selectByReportDate(@Param("reportDate") String reportDate, @Param("userCreate") Long userCreate); @Select("select * from ms_report where report_date getNowByYesterdayDate(@Param("userCreate") Long userCreate); @Select("select user_create from ms_report where report_date getUserByYesterdayDate(); @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=1") Long selectHouseIdByUserId(@Param("userId") Long userId); @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=1") List selectHouseIdsByUserId(@Param("userId") Long userId); //确诊 @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and medical=1") Integer selectSuspectedNum(@Param("reportId") Long reportId); //隔离 @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and single_room=1") Integer selectSingleRoomNum(@Param("reportId") Long reportId); //正常 @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and suspected_status=0") Integer selectisSuspectedNum(@Param("reportId") Long reportId); //疑似 @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and suspected_status=1") Integer selectisNoSuspectedNum(@Param("reportId") Long reportId); /** * 最近3天是否都有上报 * * @param userId * @return */ @Select("select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 1 day) and user_create=#{userId}\n" + "union\n" + "select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 2 day) and user_create=#{userId}\n" + "union\n" + "select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 3 day) and user_create=#{userId}") List selectMsReportLate(@Param("userId") Long userId); /** * 用户自身的健康状态, list大于0健康,等于0不健康 * * @param userId * @return */ @Select("select * from ms_report where report_status=1 and report_date=curdate() and ms_status=1 and user_create=#{userId}") List selectMsReportToday(@Param("userId") Long userId); }