RbMapper.java 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 from sys_uptown_house a " +
  39. "inner join sys_uptown_unit b on b.unit_id = a.unit_id " +
  40. "inner join sys_owner c on c.uptown_id = b.uptown_id " +
  41. "inner join sys_user_role d on d.property_id = c.owner_id and d.role_id = 2 " +
  42. "GROUP BY d.user_id " +
  43. "union all " +
  44. "select DISTINCT count(*) as num,e.user_id as userId from ms_report a " +
  45. "inner join sys_uptown_house b on a.house_id = b.house_id " +
  46. "inner join sys_uptown_unit c on c.unit_id = b.unit_id " +
  47. "inner join sys_owner d on d.uptown_id = c.uptown_id " +
  48. "inner join sys_user_role e on e.property_id = d.owner_id and e.role_id = 2 " +
  49. "where a.report_status = 1 and a.report_date = #{reportDate} " +
  50. "GROUP BY e.user_id " +
  51. "union all " +
  52. "select DISTINCT count(*) as num,e.user_id as userId from ms_report a " +
  53. "inner join sys_uptown_house b on a.house_id = b.house_id " +
  54. "inner join sys_uptown_unit c on c.unit_id = b.unit_id " +
  55. "inner join sys_owner d on d.uptown_id = c.uptown_id " +
  56. "inner join sys_user_role e on e.property_id = d.owner_id and e.role_id = 2 " +
  57. "where a.report_status = 1 and a.ms_status = 2 and a.report_date = #{reportDate} " +
  58. "GROUP BY e.user_id " +
  59. ") tt " +
  60. "where tt.userId = #{userId}")
  61. List<MsSuspected> selecthuiz(@Param("userId") Long userId,@Param("reportDate") String reportDate);
  62. @Select(
  63. "select suu.ridgepole,suu.unit,suh.doorplate,suho.linkman,suho.phone,msr.safety_num," +
  64. "msr.sure_num,msr.suspected_num,msr.normal_num,msr.single_num,mss.user_name,mss.grender," +
  65. "mss.age,mss.family_status,mss.medical,mss.temperature,mss.cough,mss.muscle ,mss.dyspnea," +
  66. "mss.fatigue,mss.diarrhea,mss.single_room from ms_suspected mss "+
  67. "inner join ms_report msr on msr.report_id = mss.report_id and msr.report_date = #{date} "+
  68. "inner join sys_uptown_house suh on suh.house_id = msr.house_id "+
  69. "inner join sys_uptown_unit suu on suu.unit_id = suh.unit_id and suu.uptown_id=#{uptownId} "+
  70. "left join sys_uptown_home suho on suho.house_id = suh.house_id"
  71. )
  72. List<ExcelRiBao> selectExcelRiBao(@Param("uptownId") Long uptownId, @Param("date") String date);
  73. @Select(
  74. "select u.* from sys_user_role ur " +
  75. "left join sys_uptown_house up on up.house_id = ur.property_id " +
  76. "left join sys_uptown_unit uu on uu.unit_id = up.unit_id " +
  77. "left join sys_uptown u on u.uptown_id = uu.uptown_id " +
  78. "where ur.role_id = 1 and ur.user_id = #{userId} "
  79. )
  80. List<Uptown> selectUptown(@Param("userId") Long userId);
  81. }