ManholeMapper.xml 4.3 KB

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