RbMapper.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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,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. "where d.user_id = #{userId} " +
  44. "GROUP BY e.uptown_name " +
  45. "union all " +
  46. "select DISTINCT count(*) as num,'' as uptownName from ms_report a " +
  47. "inner join sys_uptown_house b on a.house_id = b.house_id " +
  48. "inner join sys_uptown_unit c on c.unit_id = b.unit_id " +
  49. "inner join sys_owner d on d.uptown_id = c.uptown_id " +
  50. "inner join sys_user_role e on e.property_id = d.owner_id and e.role_id = 2 " +
  51. "where a.report_status = 1 and a.report_date = #{reportDate} and e.user_id = #{userId} " +
  52. "union all " +
  53. "select DISTINCT count(*) as num,'' 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} and e.user_id = #{userId} " +
  59. "union all " +
  60. "SELECT DISTINCT " +
  61. "sum(a.safety_num) AS yc," +
  62. "'' as uptownName " +
  63. "FROM " +
  64. "ms_report a " +
  65. "INNER JOIN sys_uptown_house b ON a.house_id = b.house_id " +
  66. "INNER JOIN sys_uptown_unit c ON c.unit_id = b.unit_id " +
  67. "INNER JOIN sys_owner d ON d.uptown_id = c.uptown_id " +
  68. "INNER JOIN sys_user_role e ON e.property_id = d.owner_id " +
  69. "AND e.role_id = 2 " +
  70. "WHERE a.report_status = 1 " +
  71. "AND a.report_date = #{reportDate} " +
  72. "and e.user_id = #{userId} " +
  73. "GROUP BY a.house_id " +
  74. "union all " +
  75. "SELECT DISTINCT " +
  76. "sum(a.suspected_num+a.sure_num+a.single_num) AS ycnum," +
  77. "'' as uptownName " +
  78. "FROM " +
  79. "ms_report a " +
  80. "INNER JOIN sys_uptown_house b ON a.house_id = b.house_id " +
  81. "INNER JOIN sys_uptown_unit c ON c.unit_id = b.unit_id " +
  82. "INNER JOIN sys_owner d ON d.uptown_id = c.uptown_id " +
  83. "INNER JOIN sys_user_role e ON e.property_id = d.owner_id " +
  84. "AND e.role_id = 2 " +
  85. "WHERE a.report_status = 1 " +
  86. "and a.ms_status = 2 " +
  87. "AND a.report_date = #{reportDate} " +
  88. "and e.user_id = #{userId} " +
  89. "GROUP BY a.house_id" +
  90. ") tt ")
  91. List<MsSuspected> selecthuiz(@Param("userId") Long userId,@Param("reportDate") String reportDate);
  92. @Select(
  93. "select suu.ridgepole,suu.unit,suh.doorplate,suho.linkman,suho.phone,msr.safety_num as safetyNum," +
  94. "msr.sure_num as sureNum,msr.suspected_num as suspectedNum,msr.normal_num as normalNum," +
  95. "msr.single_num as singleNum,mss.user_name as userName,mss.grender," +
  96. "mss.age,mss.family_status as familyStatus,mss.medical,mss.temperature,mss.cough,mss.muscle ,mss.dyspnea," +
  97. "mss.fatigue,mss.diarrhea,mss.single_room as singleRoom from ms_suspected mss "+
  98. "inner join ms_report msr on msr.report_id = mss.report_id and msr.report_date = #{date} "+
  99. "inner join sys_uptown_house suh on suh.house_id = msr.house_id "+
  100. "inner join sys_uptown_unit suu on suu.unit_id = suh.unit_id and suu.uptown_id=#{uptownId} "+
  101. "left join sys_uptown_home suho on suho.house_id = suh.house_id order by doorplate asc"
  102. )
  103. List<ExcelRiBao> selectExcelRiBao(@Param("uptownId") Long uptownId, @Param("date") String date);
  104. @Select(
  105. "select u.* from sys_user_role ur " +
  106. "left join sys_uptown_house up on up.house_id = ur.property_id " +
  107. "left join sys_uptown_unit uu on uu.unit_id = up.unit_id " +
  108. "left join sys_uptown u on u.uptown_id = uu.uptown_id " +
  109. "where ur.role_id = 1 and ur.user_id = #{userId} "
  110. )
  111. List<Uptown> selectUptown(@Param("userId") Long userId);
  112. }