ManholeMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.welampiot.dao.ManholeDao">
  4. <select id="getTotalBySectionList" resultType="Integer">
  5. select count(m.id) as total from manhole m
  6. where m.type=0
  7. <if test="sectionList != null and !sectionList.isEmpty()">
  8. and m.sectionid in
  9. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  10. #{dto}
  11. </foreach>
  12. </if>
  13. </select>
  14. <select id="getOnlineTotalBySectionList" resultType="Integer">
  15. select count(m.id) as onlineTotal from manhole m
  16. where m.online = 1 and m.type=0
  17. <if test="sectionList != null and !sectionList.isEmpty()">
  18. and m.sectionid in
  19. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  20. #{dto}
  21. </foreach>
  22. </if>
  23. </select>
  24. <select id="getAlarmTotalBySectionList" resultType="Integer">
  25. select count(m.id) as alarmTotal from manhole m
  26. where m.type=0 and m.online = 1 and (m.openAlarm = 1 or m.overAlarm = 1 or m.airAlarm = 1 or m.dismanAlarm = 1)
  27. <if test="sectionList != null and !sectionList.isEmpty()">
  28. and m.sectionid in
  29. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  30. #{dto}
  31. </foreach>
  32. </if>
  33. </select>
  34. <select id="getNormalTotalBySectionList" resultType="Integer">
  35. select count(m.id) as normalTotal from manhole m
  36. where m.type=0 and m.online = 1 and m.overAlarm = 0 and m.openAlarm = 0 and m.airAlarm = 0 and m.dismanAlarm = 0
  37. <if test="sectionList != null and !sectionList.isEmpty()">
  38. and m.sectionid in
  39. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  40. #{dto}
  41. </foreach>
  42. </if>
  43. </select>
  44. <select id="getNewTotalBySectionList" resultType="ManholeDTO">
  45. select m.id,m.createTime from manhole m
  46. where m.type=0
  47. <if test="sectionList != null and !sectionList.isEmpty()">
  48. and m.sectionid in
  49. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  50. #{dto}
  51. </foreach>
  52. </if>
  53. </select>
  54. <select id="getListByDTO" resultType="com.welampiot.dto.ManholeDTO" parameterType="com.welampiot.dto.ManholeDTO">
  55. select m.id,m.name,m.areaid as areaId,m.sectionid as sectionId,m.model,m.address,
  56. m.online,m.angle,m.longitude,m.latitude,m.batteryVol,m.alarmStatus,m.alarmInfo,
  57. m.updateTime,m.createTime,m.status,m.install_date installDate,
  58. m.expiration_date expirationDate,g.chinese_name chArea,g.english_name enArea,g.ru_name ruArea,
  59. p.chinese_name chCity,p.english_name enCity,p.ru_name ruCity,s.timezone,s.name as section
  60. from manhole m left join section s on m.sectionid = s.id
  61. left join global_location g on m.areaid = g.id
  62. left join global_location p on g.pid = p.id
  63. where m.type=0 <if test="sectionList != null and !sectionList.isEmpty()">
  64. and m.sectionid in
  65. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  66. #{dto}
  67. </foreach>
  68. </if>
  69. <if test="keywords != null and keywords != ''">
  70. and (m.name like '%${keywords}%' or m.address like '%${keywords}%')
  71. </if>
  72. order by convert(m.name using gbk) asc,m.id desc
  73. <if test="page >= 0 and count > 0">
  74. limit #{page},#{count}
  75. </if>
  76. </select>
  77. <select id="getHistoryListByDTO" resultType="ManholeDTO">
  78. select m.angle,m.batteryVol,m.alarmStatus,m.alarmInfo,
  79. m.updateTime,m.status,s.timezone
  80. from manhole m left join section s on m.sectionid = s.id
  81. where m.id = #{id}
  82. <if test="sectionList != null and !sectionList.isEmpty()">
  83. and m.sectionid in
  84. <foreach collection="sectionList" item="dto" open="(" separator="," close=")">
  85. #{dto}
  86. </foreach>
  87. </if>
  88. <if test="page >= 0 and count > 0">
  89. limit #{page},#{count}
  90. </if>
  91. </select>
  92. </mapper>