RbMapper.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package com.bofeng.dao;
  2. import com.baomidou.mybatisplus.mapper.BaseMapper;
  3. import com.baomidou.mybatisplus.mapper.Wrapper;
  4. import com.bofeng.entity.*;
  5. import org.apache.ibatis.annotations.Mapper;
  6. import org.apache.ibatis.annotations.Param;
  7. import org.apache.ibatis.annotations.Select;
  8. import org.springframework.stereotype.Repository;
  9. import java.util.Date;
  10. import java.util.List;
  11. @Mapper
  12. @Repository
  13. public interface RbMapper extends BaseMapper<sysUptownUnit> {
  14. @Select("select DISTINCT c.report_status as reportStatus,a.house_id as houseId,a.doorplate as doorplate,c.report_id as reportId,c.ms_status as msStatus,b.unit_id as unitId from sys_uptown_house a " +
  15. "inner join sys_uptown_unit b on a.unit_id = b.unit_id " +
  16. "inner join sys_owner d on d.uptown_id = b.uptown_id " +
  17. "inner join sys_user_role e on e.property_id = d.owner_id and e.role_id = 2 " +
  18. "left join ms_report c on c.house_id = a.house_id and DATE_FORMAT(c.time_update,'%Y-%m-%d') = #{dateStr} " +
  19. "where b.unit_id = #{str}")
  20. List<SysUptownHouse> selectMp(@Param("str") Long str,@Param("dateStr") String dateStr);
  21. // and c.time_update = #{date}
  22. @Select("select c.ridgepole as ridgepole,c.unit as unit,c.unit_id as unitId from sys_user_role a " +
  23. "inner join sys_owner b on b.owner_id = a.property_id and a.role_id = 2 " +
  24. "inner join sys_uptown_unit c on c.uptown_id = b.uptown_id " +
  25. "where a.user_id = #{userId}")
  26. List<sysUptownUnit> selectDY(@Param("userId") Long userId);
  27. @Select("select a.normal_num as normalNum,e.ridgepole as ridgepole,e.unit as unit,b.doorplate as doorplate,a.safety_num as safetyNum,a.sure_num as sureNum,a.suspected_num as suspectedNum," +
  28. "c.user_name as userName,c.cough as cough,c.muscle as muscle,c.dyspnea as dyspnea," +
  29. "c.fatigue as fatigue,c.diarrhea as diarrhea,c.others as others,c.single_room as singleRoom,a.single_num as singleNum " +
  30. "from ms_report a " +
  31. "inner join sys_uptown_house b on b.house_id = a.house_id " +
  32. "inner join sys_uptown_unit e on e.unit_id = b.unit_id " +
  33. "left join ms_suspected c on c.report_id = a.report_id " +
  34. "where b.house_id = #{houseId} and DATE_FORMAT(a.time_update,'%Y-%m-%d') = #{dateStr}")
  35. List<MsSuspected> selectYcXq(@Param("houseId") Long houseId, @Param("dateStr") String dateStr);
  36. @Select("select * from " +
  37. "(" +
  38. "select count(*) as num,d.user_id as userId,e.uptown_name as uptownName from sys_uptown_house a " +
  39. "inner join sys_uptown_unit b on b.unit_id = a.unit_id " +
  40. "inner join sys_uptown e on b.uptown_id = e.uptown_id " +
  41. "inner join sys_owner c on c.uptown_id = b.uptown_id " +
  42. "inner join sys_user_role d on d.property_id = c.owner_id and d.role_id = 2 " +
  43. "GROUP BY d.user_id,e.uptown_name " +
  44. "union all " +
  45. "select DISTINCT count(*) as num,e.user_id as userId,'' as uptownName from ms_report a " +
  46. "inner join sys_uptown_house b on a.house_id = b.house_id " +
  47. "inner join sys_uptown_unit c on c.unit_id = b.unit_id " +
  48. "inner join sys_owner d on d.uptown_id = c.uptown_id " +
  49. "inner join sys_user_role e on e.property_id = d.owner_id and e.role_id = 2 " +
  50. "where a.report_status = 1 and a.report_date = #{reportDate} " +
  51. "GROUP BY e.user_id " +
  52. "union all " +
  53. "select DISTINCT count(*) as num,e.user_id as userId,'' as uptownName from ms_report a " +
  54. "inner join sys_uptown_house b on a.house_id = b.house_id " +
  55. "inner join sys_uptown_unit c on c.unit_id = b.unit_id " +
  56. "inner join sys_owner d on d.uptown_id = c.uptown_id " +
  57. "inner join sys_user_role e on e.property_id = d.owner_id and e.role_id = 2 " +
  58. "where a.report_status = 1 and a.ms_status = 2 and a.report_date = #{reportDate} " +
  59. "GROUP BY e.user_id " +
  60. ") tt " +
  61. "where tt.userId = #{userId}")
  62. List<MsSuspected> selecthuiz(@Param("userId") Long userId,@Param("reportDate") String reportDate);
  63. @Select(
  64. "select suu.ridgepole,suu.unit,suh.doorplate,suho.linkman,suho.phone,msr.safety_num as safetyNum," +
  65. "msr.sure_num as sureNum,msr.suspected_num as suspectedNum,msr.normal_num as normalNum," +
  66. "msr.single_num as singleNum,mss.user_name as userName,mss.grender," +
  67. "mss.age,mss.family_status as familyStatus,mss.medical,mss.temperature,mss.cough,mss.muscle ,mss.dyspnea," +
  68. "mss.fatigue,mss.diarrhea,mss.single_room as singleRoom from ms_suspected mss "+
  69. "inner join ms_report msr on msr.report_id = mss.report_id and msr.report_date = #{date} "+
  70. "inner join sys_uptown_house suh on suh.house_id = msr.house_id "+
  71. "inner join sys_uptown_unit suu on suu.unit_id = suh.unit_id and suu.uptown_id=#{uptownId} "+
  72. "left join sys_uptown_home suho on suho.house_id = suh.house_id"
  73. )
  74. List<ExcelRiBao> selectExcelRiBao(@Param("uptownId") Long uptownId, @Param("date") String date);
  75. @Select(
  76. "select u.* from sys_user_role ur " +
  77. "left join sys_uptown_house up on up.house_id = ur.property_id " +
  78. "left join sys_uptown_unit uu on uu.unit_id = up.unit_id " +
  79. "left join sys_uptown u on u.uptown_id = uu.uptown_id " +
  80. "where ur.role_id = 1 and ur.user_id = #{userId} "
  81. )
  82. List<Uptown> selectUptown(@Param("userId") Long userId);
  83. }