FireControlBigDataMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.sooka.sponest.data.digitalfirecontrol.mapper.FireControlBigDataMapper">
  6. <parameterMap id="pm_VisuForestCloudMapVO"
  7. type="com.sooka.sponest.data.app.domain.VisuForestCloudMapVO"></parameterMap>
  8. <resultMap type="com.sooka.sponest.data.digitalforest.domain.bo.VisuForestCloudEventTypeBO" id="VisuForestCloudEventTypeBOResult">
  9. <result property="name" column="name"/>
  10. <result property="value" column="value"/>
  11. </resultMap>
  12. <resultMap type="CenterdataTForestWeatherinformation" id="CenterdataTForestWeatherinformationResult">
  13. <result property="id" column="id"/>
  14. <result property="weatherinformationTime" column="weatherinformation_time"/>
  15. <result property="weatherinformationWeather" column="weatherinformation_weather"/>
  16. <result property="weatherinformationPower" column="weatherinformation_power"/>
  17. <result property="weatherinformationDirection" column="weatherinformation_direction"/>
  18. <result property="weatherinformationLow" column="weatherinformation_low"/>
  19. <result property="weatherinformationHigh" column="weatherinformation_high"/>
  20. <result property="weatherinformationTemperature" column="weatherinformation_temperature"/>
  21. <result property="forestWeatherinformationLevel" column="forest_weatherinformation_level"/>
  22. <result property="createBy" column="create_by"/>
  23. <result property="createTime" column="create_time"/>
  24. <result property="updateBy" column="update_by"/>
  25. <result property="updateTime" column="update_time"/>
  26. <result property="dataStatus" column="data_status"/>
  27. <result property="deptId" column="dept_id"/>
  28. <result property="deptName" column="dept_name"/>
  29. </resultMap>
  30. <select id="selectBigDataWatercraneDeptCount" parameterType="CenterdataTForestWatercrane"
  31. resultMap="VisuForestCloudEventTypeBOResult">
  32. select a.dept_name name,count(a.id) value from centerdata_t_forest_watercrane a
  33. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  34. where 1=1 ${params.dataScope}
  35. group by a.dept_id,a.dept_name
  36. ORDER BY VALUE desc
  37. LIMIT 8
  38. </select>
  39. <select id="geFireControltTotal" parameterMap="pm_VisuForestCloudMapVO" resultType="map">
  40. select '水鹤' name,count(*) value from centerdata_t_forest_watercrane a
  41. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  42. where 1=1 ${params.dataScope}
  43. union all
  44. select '取水口' name,count(*) value from centerdata_t_forest_waterintake a
  45. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  46. where 1=1 ${params.dataScope}
  47. union all
  48. SELECT a.dict_label name,count(b.firehydrant_type) value FROM ${database_system}.sys_dict_data a left join
  49. (SELECT a.firehydrant_type FROM centerdata_t_forest_firehydrant a
  50. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  51. where 1=1 ${params.dataScope}) b on a.dict_value = b.firehydrant_type
  52. where a.dict_type = 'firehydrant'
  53. GROUP BY a.dict_value
  54. union all
  55. select '泡沫液' name,count(*) value from centerdata_t_firecontrol_foam_liquid a
  56. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  57. where 1=1 ${params.dataScope}
  58. union all
  59. select '消防力量' name,count(*) value from centerdata_t_firecontrol_fire_force a
  60. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  61. where 1=1 ${params.dataScope}
  62. union all
  63. select '专职站' name,count(*) value from centerdata_t_firecontrol_fulltime_station a
  64. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  65. where 1=1 ${params.dataScope}
  66. </select>
  67. <select id="selectBigDataWaterintakeDeptCount" parameterType="CenterdataTForestWaterintake"
  68. resultMap="VisuForestCloudEventTypeBOResult">
  69. select a.dept_name name,count(a.id) value from centerdata_t_forest_waterintake a
  70. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  71. where 1=1 ${params.dataScope}
  72. group by a.dept_id,a.dept_name
  73. ORDER BY VALUE DESC
  74. LIMIT 8;
  75. </select>
  76. <select id="selectBigDataByYearMonth" parameterType="CenterdataTForestWeatherinformationBigDataVO"
  77. resultMap="CenterdataTForestWeatherinformationResult">
  78. select date_format(weatherinformation_time,'%Y-%m-%d') weatherinformation_time, IFNULL(weatherinformation_low,'') weatherinformation_low, IFNULL(weatherinformation_high,'') weatherinformation_high
  79. from centerdata_t_forest_weatherinformation
  80. where weatherinformation_time like concat('%', #{day}, '%')
  81. order by weatherinformation_time asc
  82. </select>
  83. <select id="selectBigDataFirecontrolFulltimeStationDeptCount" parameterType="CenterdataTFirecontrolFulltimeStation"
  84. resultMap="VisuForestCloudEventTypeBOResult">
  85. select a.dept_name name,count(a.id) value from centerdata_t_firecontrol_fulltime_station a
  86. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  87. where 1=1 ${params.dataScope}
  88. group by a.dept_id,a.dept_name
  89. </select>
  90. <select id="selectBigDataFirehydrantDeptCount" parameterType="CenterdataTForestFirehydrant"
  91. resultMap="VisuForestCloudEventTypeBOResult">
  92. select a.dept_name name,count(a.id) value from centerdata_t_forest_firehydrant a
  93. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  94. where 1=1 ${params.dataScope}
  95. group by a.dept_id,a.dept_name
  96. </select>
  97. <select id="selectBigDataFirecontrolFoamLiquidDeptCount" parameterType="CenterdataTFirecontrolFoamLiquid"
  98. resultType="java.util.Map">
  99. select d.ancestors ancestors,a.dept_id deptId,count(a.id) num
  100. from centerdata_t_firecontrol_foam_liquid a
  101. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  102. where 1=1 ${params.dataScope}
  103. group by a.dept_id
  104. </select>
  105. <select id="getbasiclinkageforeList" parameterType="CenterdataTFirecontrolBasicLinkageForce"
  106. resultType="map">
  107. SELECT d.ancestors ancestors,a.dept_id deptId,a.forklift_num forkliftNum,a.fire_fighting_truck_num fightingNum,a.fire_fighting_truck_tonnage ton
  108. from centerdata_t_firecontrol_basic_linkage_force a
  109. left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
  110. WHERE 1=1 ${params.dataScope}
  111. </select>
  112. <select id="getOtherlinkageforceList" parameterType="CenterdataTFirecontrolOtherLinkageForce" resultType="java.util.Map">
  113. SELECT
  114. a.dept_name AS 'name',
  115. count( a.id )
  116. as 'value'
  117. FROM
  118. centerdata_t_firecontrol_other_linkage_force a
  119. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  120. WHERE
  121. 1 = 1 ${params.dataScope}
  122. GROUP BY
  123. a.dept_id,
  124. a.dept_name
  125. </select>
  126. <select id="selectBigDataImportareaDeptCount" parameterType="CenterdataTForestImportarea"
  127. resultMap="VisuForestCloudEventTypeBOResult">
  128. select a.dept_name name,count(a.id) num from centerdata_t_forest_importarea a
  129. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  130. where a.area_type = #{areaType} ${params.dataScope}
  131. group by a.dept_name,a.dept_id
  132. </select>
  133. <select id="selectBigDataFireforceDeptCount" resultType="java.util.Map">
  134. select d.ancestors ancestors, a.dept_id deptId,count(a.id) value from centerdata_t_firecontrol_fire_force a
  135. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  136. where 1=1 ${params.dataScope}
  137. group by a.dept_id
  138. </select>
  139. <select id="selectBigDataNumWithDeptCount" parameterMap="pm_VisuForestCloudMapVO" resultType="map">
  140. SELECT a.ancestors,a.deptId,
  141. sum(CASE WHEN a.`name` = '消火栓' THEN a.value ELSE 0 END) AS 'fireHydrant',
  142. sum(CASE WHEN a.`name` = '取水口' THEN a.value ELSE 0 END) AS 'waterIntake',
  143. sum(CASE WHEN a.`name` = '水鹤' THEN a.value ELSE 0 END) AS 'waterCranes'
  144. FROM (
  145. SELECT d.ancestors ancestors, a.dept_id deptId, '水鹤' name, COUNT(*) value
  146. FROM centerdata_t_forest_watercrane a
  147. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  148. WHERE 1 = 1 ${params.dataScope}
  149. AND del_flag = 0
  150. GROUP BY a.dept_id
  151. UNION ALL
  152. SELECT d.ancestors ancestors, a.dept_id deptId, '取水口' name, COUNT(*) value
  153. FROM centerdata_t_forest_waterintake a
  154. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  155. WHERE 1 = 1 ${params.dataScope}
  156. AND del_flag = 0
  157. GROUP BY a.dept_id
  158. UNION ALL
  159. SELECT d.ancestors ancestors, a.dept_id deptId, '消火栓' name, COUNT(*) value
  160. FROM centerdata_t_forest_firehydrant a
  161. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  162. WHERE 1 = 1 ${params.dataScope}
  163. AND del_flag = 0
  164. GROUP BY a.dept_id
  165. ) a GROUP BY a.ancestors,a.deptId
  166. </select>
  167. <select id="selectKeyLocations" resultType="java.util.Map">
  168. SELECT d.ancestors ancestors,a.dept_id deptId,count(a.id) num
  169. FROM centerdata_t_firecontrol_fire_key_places a
  170. left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
  171. WHERE 1=1 ${params.dataScope}
  172. GROUP BY a.dept_id
  173. </select>
  174. </mapper>