TBArchivesToiletsMapper.xml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.daju.mix.dao.mapper.TBArchivesToiletsMapper">
  4. <resultMap type="com.daju.mix.dao.entity.TBArchivesToilets" id="BaseTBArchivesToiletsMap"/>
  5. <resultMap type="com.daju.mix.dto.IndexWarningsDto" id="IndexWarningsDtoMap"/>
  6. <select id="selectArchivesToiletsId" resultType="java.lang.String">
  7. SELECT id
  8. from t_b_archives_toilets
  9. where id = (select max(id) from t_b_archives_toilets)
  10. </select>
  11. <!-- 随机一条数据-->
  12. <select id="selectRecent" resultMap="BaseTBArchivesToiletsMap">
  13. select *
  14. from t_b_archives_toilets
  15. order by rand()
  16. limit 1
  17. </select>
  18. <resultMap type="com.daju.mix.dto.AllElements" id="AllElements"/>
  19. <select id="allElementsByToilets" resultMap="AllElements">
  20. select tbar.code id,
  21. cim_longitude longitude,
  22. cim_latitude latitude,
  23. height altitude,
  24. tbca.status warningState,
  25. tbca.content warningMessage,
  26. 9 type,
  27. expected_completion time,
  28. max(tbca.create_date)
  29. from t_b_archives_toilets tbar
  30. left join t_b_car_alarm tbca on tbar.code = tbca.archive_id
  31. group by tbar.id
  32. </select>
  33. <!-- 获取预警信息列表-->
  34. <select id="selectWarnings" resultMap="IndexWarningsDtoMap">
  35. select tbat.id, tbca.create_date time, tbca.content content, tbca.status state
  36. from t_b_archives_toilets tbat
  37. left join t_b_car_alarm tbca on tbat.id = tbca.archive_id
  38. where tbat.id = #{id}
  39. </select>
  40. <resultMap id="LookOverStatusDto" type="com.daju.mix.dto.LookOverStatusDto"/>
  41. <select id="lookOverStatusDto" resultMap="LookOverStatusDto">
  42. select a.name, b.status currentStatus, Max(b.create_date) lastCleanTime, d.description workSchedule, count(c.id) totalWarningCount
  43. from t_b_archives_toilets a
  44. left join t_b_car_schedule_common_section b on a.code = b.archive_id
  45. left join t_b_car_schedule d on b.schedule_id = d.id
  46. left join t_b_car_alarm c on a.code = c.archive_id
  47. where a.code = #{code}
  48. group by a.id;
  49. </select>
  50. </mapper>