FireControlBigDataMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. union all
  67. select '重点场所' name,count(*) value from centerdata_t_firecontrol_fire_key_places a
  68. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  69. where 1=1 ${params.dataScope}
  70. union all
  71. select '压力传感器' name,count(*) value from centerdata_t_firecontrol_fire_pressure_sensor a
  72. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  73. where 1=1 ${params.dataScope}
  74. union all
  75. select '基本联动力量' name,count(*) value from centerdata_t_firecontrol_basic_linkage_force a
  76. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  77. where 1=1 ${params.dataScope}
  78. union all
  79. select '其他联动力量' name,count(*) value from centerdata_t_firecontrol_other_linkage_force a
  80. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  81. where 1=1 ${params.dataScope}
  82. </select>
  83. <select id="selectBigDataWaterintakeDeptCount" parameterType="CenterdataTForestWaterintake"
  84. resultMap="VisuForestCloudEventTypeBOResult">
  85. select a.dept_name name,count(a.id) value from centerdata_t_forest_waterintake 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. ORDER BY VALUE DESC
  90. LIMIT 8;
  91. </select>
  92. <select id="selectBigDataByYearMonth" parameterType="CenterdataTForestWeatherinformationBigDataVO"
  93. resultMap="CenterdataTForestWeatherinformationResult">
  94. select date_format(weatherinformation_time,'%Y-%m-%d') weatherinformation_time, IFNULL(weatherinformation_low,'') weatherinformation_low, IFNULL(weatherinformation_high,'') weatherinformation_high
  95. from centerdata_t_forest_weatherinformation
  96. where weatherinformation_time like concat('%', #{day}, '%')
  97. order by weatherinformation_time asc
  98. </select>
  99. <select id="selectBigDataFirecontrolFulltimeStationDeptCount" parameterType="CenterdataTFirecontrolFulltimeStation"
  100. resultMap="VisuForestCloudEventTypeBOResult">
  101. select a.dept_name name,count(a.id) value from centerdata_t_firecontrol_fulltime_station a
  102. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  103. where 1=1 ${params.dataScope}
  104. group by a.dept_id,a.dept_name
  105. </select>
  106. <select id="selectBigDataFirehydrantDeptCount" parameterType="CenterdataTForestFirehydrant"
  107. resultMap="VisuForestCloudEventTypeBOResult">
  108. select a.dept_name name,count(a.id) value from centerdata_t_forest_firehydrant a
  109. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  110. where 1=1 ${params.dataScope}
  111. group by a.dept_id,a.dept_name
  112. </select>
  113. <select id="selectBigDataFirecontrolFoamLiquidDeptCount" parameterType="CenterdataTFirecontrolFoamLiquid"
  114. resultType="java.util.Map">
  115. SELECT
  116. d.ancestors AS ancestors,
  117. a.dept_id AS deptId,
  118. SUM( a.reserves ) AS reserves
  119. FROM
  120. centerdata_t_firecontrol_foam_liquid a
  121. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  122. WHERE 1 = 1 ${params.dataScope}
  123. GROUP BY
  124. a.dept_id,
  125. d.ancestors;
  126. </select>
  127. <select id="getbasiclinkageforeList" parameterType="CenterdataTFirecontrolBasicLinkageForce"
  128. resultType="map">
  129. SELECT d.ancestors ancestors,a.dept_id deptId,a.forklift_num forkliftNum,a.fire_fighting_truck_num fightingNum,a.fire_fighting_truck_tonnage ton
  130. from centerdata_t_firecontrol_basic_linkage_force a
  131. left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
  132. WHERE 1=1 ${params.dataScope}
  133. </select>
  134. <select id="getOtherlinkageforceList" parameterType="CenterdataTFirecontrolOtherLinkageForce" resultType="java.util.Map">
  135. SELECT
  136. a.dept_name AS 'name',
  137. count( a.id )
  138. as 'value'
  139. FROM
  140. centerdata_t_firecontrol_other_linkage_force a
  141. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  142. WHERE
  143. 1 = 1 ${params.dataScope}
  144. GROUP BY
  145. a.dept_id,
  146. a.dept_name
  147. </select>
  148. <select id="selectBigDataImportareaDeptCount" parameterType="CenterdataTForestImportarea"
  149. resultMap="VisuForestCloudEventTypeBOResult">
  150. select a.dept_name name,count(a.id) num from centerdata_t_forest_importarea a
  151. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  152. where a.area_type = #{areaType} ${params.dataScope}
  153. group by a.dept_name,a.dept_id
  154. </select>
  155. <select id="selectBigDataFireforceDeptCount" resultType="java.util.Map">
  156. select d.ancestors ancestors, a.dept_id deptId,count(a.id) value from centerdata_t_firecontrol_fire_force a
  157. left join ${database_system}.sys_dept d on d.dept_id = a.dept_id
  158. where 1=1 ${params.dataScope}
  159. group by a.dept_id
  160. </select>
  161. <select id="selectBigDataNumWithDeptCount" parameterMap="pm_VisuForestCloudMapVO" resultType="map">
  162. SELECT a.ancestors,a.deptId,
  163. sum(CASE WHEN a.`name` = '消火栓' THEN a.value ELSE 0 END) AS 'fireHydrant',
  164. sum(CASE WHEN a.`name` = '取水口' THEN a.value ELSE 0 END) AS 'waterIntake',
  165. sum(CASE WHEN a.`name` = '水鹤' THEN a.value ELSE 0 END) AS 'waterCranes'
  166. FROM (
  167. SELECT d.ancestors ancestors, a.dept_id deptId, '水鹤' name, COUNT(*) value
  168. FROM centerdata_t_forest_watercrane a
  169. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  170. WHERE 1 = 1 ${params.dataScope}
  171. AND del_flag = 0
  172. GROUP BY a.dept_id
  173. UNION ALL
  174. SELECT d.ancestors ancestors, a.dept_id deptId, '取水口' name, COUNT(*) value
  175. FROM centerdata_t_forest_waterintake a
  176. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  177. WHERE 1 = 1 ${params.dataScope}
  178. AND del_flag = 0
  179. GROUP BY a.dept_id
  180. UNION ALL
  181. SELECT d.ancestors ancestors, a.dept_id deptId, '消火栓' name, COUNT(*) value
  182. FROM centerdata_t_forest_firehydrant a
  183. LEFT JOIN ${database_system}.sys_dept d ON d.dept_id = a.dept_id
  184. WHERE 1 = 1 ${params.dataScope}
  185. AND del_flag = 0
  186. GROUP BY a.dept_id
  187. ) a GROUP BY a.ancestors,a.deptId
  188. </select>
  189. <select id="selectKeyLocations" resultType="java.util.Map">
  190. SELECT d.ancestors ancestors,a.dept_id deptId,count(a.id) num
  191. FROM centerdata_t_firecontrol_fire_key_places a
  192. left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
  193. WHERE 1=1 ${params.dataScope}
  194. GROUP BY a.dept_id
  195. </select>
  196. </mapper>