TShouhuanAlarmListMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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.ruoyi.system.mapper.TShouhuanAlarmListMapper">
  6. <resultMap type="TShouhuanAlarmList" id="TShouhuanAlarmListResult">
  7. <result property="id" column="id"/>
  8. <result property="facilityId" column="facility_id"/>
  9. <result property="shinfoId" column="shinfo_id"/>
  10. <result property="deviceIdCode" column="device_id_code"/>
  11. <result property="gpsLong" column="gps_long"/>
  12. <result property="gpsLat" column="gps_lat"/>
  13. <result property="speed" column="speed"/>
  14. <result property="direction" column="direction"/>
  15. <result property="poster" column="poster"/>
  16. <result property="electricQuantity" column="electric_quantity"/>
  17. <result property="stepNumber" column="step_number"/>
  18. <result property="rollNumber" column="roll_number"/>
  19. <result property="statusType" column="status_type"/>
  20. <result property="alarmType" column="alarm_type"/>
  21. <result property="terminalStatus" column="terminal_status"/>
  22. <result property="createTime" column="createtime"/>
  23. <result property="alarmFromType" column="alarm_from_type"/>
  24. <result property="msg" column="msg"/>
  25. <result property="isSend" column="is_send"/>
  26. <result property="sendTime" column="send_time"/>
  27. </resultMap>
  28. <sql id="selectTShouhuanAlarmListVo">
  29. select id,
  30. facility_id,
  31. shinfo_id,
  32. device_id_code,
  33. gps_long,
  34. gps_lat,
  35. speed,
  36. direction,
  37. poster,
  38. electric_quantity,
  39. step_number,
  40. roll_number,
  41. status_type,
  42. alarm_type,
  43. terminal_status,
  44. createtime,
  45. alarm_from_type,
  46. msg,
  47. is_send,
  48. send_time
  49. from t_shouhuan_alarm_list
  50. </sql>
  51. <select id="selectTShouhuanAlarmListList" parameterType="TShouhuanAlarmList" resultMap="TShouhuanAlarmListResult">
  52. <include refid="selectTShouhuanAlarmListVo"/>
  53. <where>
  54. <if test="facilityId != null ">and facility_id = #{facilityId}</if>
  55. <if test="shinfoId != null ">and shinfo_id = #{shinfoId}</if>
  56. <if test="deviceIdCode != null and deviceIdCode != ''">and device_id_code = #{deviceIdCode}</if>
  57. <if test="gpsLong != null ">and gps_long = #{gpsLong}</if>
  58. <if test="gpsLat != null ">and gps_lat = #{gpsLat}</if>
  59. <if test="speed != null ">and speed = #{speed}</if>
  60. <if test="direction != null ">and direction = #{direction}</if>
  61. <if test="poster != null ">and poster = #{poster}</if>
  62. <if test="electricQuantity != null ">and electric_quantity = #{electricQuantity}</if>
  63. <if test="stepNumber != null ">and step_number = #{stepNumber}</if>
  64. <if test="rollNumber != null ">and roll_number = #{rollNumber}</if>
  65. <if test="statusType != null ">and status_type = #{statusType}</if>
  66. <if test="alarmType != null ">and alarm_type = #{alarmType}</if>
  67. <if test="terminalStatus != null and terminalStatus != ''">and terminal_status = #{terminalStatus}</if>
  68. <if test="createTime != null ">and createtime = #{createTime}</if>
  69. <if test="alarmFromType != null ">and alarm_from_type = #{alarmFromType}</if>
  70. <if test="msg != null and msg != ''">and msg = #{msg}</if>
  71. <if test="isSend != null ">and is_send = #{isSend}</if>
  72. <if test="sendTime != null ">and send_time = #{sendTime}</if>
  73. </where>
  74. </select>
  75. <select id="selectTShouhuanAlarmListById" parameterType="Integer" resultMap="TShouhuanAlarmListResult">
  76. <include refid="selectTShouhuanAlarmListVo"/>
  77. where id = #{id}
  78. </select>
  79. <select id="selectTShouhuanAlarmList" resultType="com.ruoyi.system.domain.dto.DataAlarmListDto">
  80. SELECT c.name,
  81. c.tel_one,
  82. a.gps_long,
  83. a.gps_lat,
  84. a.use_gps_long,
  85. a.use_gps_lat,
  86. a.location,
  87. a.createtime,
  88. a.status_type,
  89. a.alarm_type
  90. FROM `t_shouhuan_alarm_list` a
  91. left join t_device_list b on a.device_id_code = b.device_id
  92. left join t_user_profile c on c.id = b.userid
  93. </select>
  94. <select id="selectTShouhuanAlarmListCount" resultType="java.lang.Integer">
  95. select IFNULL(count(*), 0)
  96. from t_shouhuan_alarm_list
  97. </select>
  98. <select id="selectTShouhuanAlarmSOS" resultType="java.lang.Integer">
  99. SELECT IFNULL(count(*), 0)
  100. FROM `t_shouhuan_alarm_list`
  101. where alarm_type = 16
  102. </select>
  103. <select id="selectTShouhuanAlarmSOSSolve" resultType="java.lang.Integer">
  104. SELECT IFNULL(count(*), 0)
  105. FROM `t_sos_solve`
  106. where solve_status = 1
  107. </select>
  108. <select id="selectTShouhuanAlarmRail" resultType="java.lang.Integer">
  109. SELECT IFNULL(count(*), 0)
  110. FROM `t_shouhuan_alarm_list`
  111. where status_type = 2
  112. </select>
  113. <select id="selectTShouhuanAlarmRailSolve" resultType="java.lang.Integer">
  114. SELECT IFNULL(count(*), 0)
  115. FROM `t_rail_solve`
  116. where solve_status = 1
  117. </select>
  118. <select id="selectTShouhuanAlarmHeart" resultType="java.lang.Integer">
  119. SELECT IFNULL(count(*), 0)
  120. FROM `t_shouhuan_alarm_list`
  121. where alarm_type = 22
  122. </select>
  123. <select id="selectTShouhuanAlarmHeartSolve" resultType="java.lang.Integer">
  124. SELECT IFNULL(count(*), 0)
  125. FROM `t_health_solve`
  126. where solve_status = 1
  127. </select>
  128. <select id="selectTShouhuanAlarmFall" resultType="java.lang.Integer">
  129. SELECT IFNULL(count(*), 0)
  130. FROM `t_shouhuan_alarm_list`
  131. where alarm_type = 21
  132. </select>
  133. <select id="selectTShouhuanAlarmFallSolve" resultType="java.lang.Integer">
  134. SELECT IFNULL(count(*), 0)
  135. FROM `t_fall_solve`
  136. where solve_status = 1
  137. </select>
  138. <select id="selectTShouhuanAlarmLow" resultType="java.lang.Integer">
  139. SELECT IFNULL(count(*), 0)
  140. FROM `t_shouhuan_alarm_list`
  141. where alarm_type = 17
  142. </select>
  143. <select id="selectTShouhuanAlarmLowSolve" resultType="java.lang.Integer">
  144. SELECT IFNULL(count(*), 0)
  145. FROM `t_other_solve` a
  146. left join t_shouhuan_alarm_list b
  147. on a.alarmid = b.id
  148. where b.alarm_type = 17
  149. </select>
  150. <select id="selectTShouhuanAlarmStatus" resultType="java.lang.Integer">
  151. SELECT IFNULL(count(*), 0)
  152. FROM `t_shouhuan_info`
  153. where online_statis = 1
  154. </select>
  155. <select id="selectTShouhuanAlarmStatusSolve" resultType="java.lang.Integer">
  156. SELECT IFNULL(count(*), 0)
  157. FROM `t_shouhuan_info`
  158. where online_statis = 0
  159. </select>
  160. <select id="selectTShouhuanAlarmOtherSolve" resultType="java.lang.Integer">
  161. SELECT IFNULL(count(*), 0)
  162. FROM `t_other_solve`
  163. where solve_status = 1
  164. </select>
  165. <select id="selectAlarmStatusListDto" resultType="com.ruoyi.system.domain.dto.AlarmStatusListDto">
  166. SELECT a.id,
  167. c.name,
  168. a.location,
  169. a.use_gps_long,
  170. a.use_gps_lat,
  171. a.facility_id as facilityId,
  172. a.device_id_code,
  173. a.createtime,
  174. a.alarm_type
  175. FROM `t_shouhuan_alarm_list` a
  176. left join t_device_list b on a.device_id_code = b.device_id
  177. left join t_user_profile c on c.id = b.userid
  178. </select>
  179. <insert id="insertTShouhuanAlarmList" parameterType="TShouhuanAlarmList" useGeneratedKeys="true" keyProperty="id">
  180. insert into t_shouhuan_alarm_list
  181. <trim prefix="(" suffix=")" suffixOverrides=",">
  182. <if test="facilityId != null">facility_id,</if>
  183. <if test="shinfoId != null">shinfo_id,</if>
  184. <if test="deviceIdCode != null">device_id_code,</if>
  185. <if test="gpsLong != null">gps_long,</if>
  186. <if test="gpsLat != null">gps_lat,</if>
  187. <if test="useGpsLong != null">use_gps_long,</if>
  188. <if test="useGpsLat != null">use_gps_lat,</if>
  189. <if test="location != null">location,</if>
  190. <if test="speed != null">speed,</if>
  191. <if test="direction != null">direction,</if>
  192. <if test="poster != null">poster,</if>
  193. <if test="electricQuantity != null">electric_quantity,</if>
  194. <if test="stepNumber != null">step_number,</if>
  195. <if test="rollNumber != null">roll_number,</if>
  196. <if test="statusType != null">status_type,</if>
  197. <if test="alarmType != null">alarm_type,</if>
  198. <if test="terminalStatus != null">terminal_status,</if>
  199. <if test="createTime != null">createtime,</if>
  200. <if test="alarmFromType != null">alarm_from_type,</if>
  201. <if test="msg != null">msg,</if>
  202. <if test="isSend != null">is_send,</if>
  203. <if test="sendTime != null">send_time,</if>
  204. </trim>
  205. <trim prefix="values (" suffix=")" suffixOverrides=",">
  206. <if test="facilityId != null">#{facilityId},</if>
  207. <if test="shinfoId != null">#{shinfoId},</if>
  208. <if test="deviceIdCode != null">#{deviceIdCode},</if>
  209. <if test="gpsLong != null">#{gpsLong},</if>
  210. <if test="gpsLat != null">#{gpsLat},</if>
  211. <if test="useGpsLong != null">use_gps_long,</if>
  212. <if test="useGpsLat != null">use_gps_lat,</if>
  213. <if test="location != null">location,</if>
  214. <if test="speed != null">#{speed},</if>
  215. <if test="direction != null">#{direction},</if>
  216. <if test="poster != null">#{poster},</if>
  217. <if test="electricQuantity != null">#{electricQuantity},</if>
  218. <if test="stepNumber != null">#{stepNumber},</if>
  219. <if test="rollNumber != null">#{rollNumber},</if>
  220. <if test="statusType != null">#{statusType},</if>
  221. <if test="alarmType != null">#{alarmType},</if>
  222. <if test="terminalStatus != null">#{terminalStatus},</if>
  223. <if test="createTime != null">#{createTime},</if>
  224. <if test="alarmFromType != null">#{alarmFromType},</if>
  225. <if test="msg != null">#{msg},</if>
  226. <if test="isSend != null">#{isSend},</if>
  227. <if test="sendTime != null">#{sendTime},</if>
  228. </trim>
  229. </insert>
  230. <update id="updateTShouhuanAlarmList" parameterType="TShouhuanAlarmList">
  231. update t_shouhuan_alarm_list
  232. <trim prefix="SET" suffixOverrides=",">
  233. <if test="facilityId != null">facility_id = #{facilityId},</if>
  234. <if test="shinfoId != null">shinfo_id = #{shinfoId},</if>
  235. <if test="deviceIdCode != null">device_id_code = #{deviceIdCode},</if>
  236. <if test="gpsLong != null">gps_long = #{gpsLong},</if>
  237. <if test="gpsLat != null">gps_lat = #{gpsLat},</if>
  238. <if test="speed != null">speed = #{speed},</if>
  239. <if test="direction != null">direction = #{direction},</if>
  240. <if test="poster != null">poster = #{poster},</if>
  241. <if test="electricQuantity != null">electric_quantity = #{electricQuantity},</if>
  242. <if test="stepNumber != null">step_number = #{stepNumber},</if>
  243. <if test="rollNumber != null">roll_number = #{rollNumber},</if>
  244. <if test="statusType != null">status_type = #{statusType},</if>
  245. <if test="alarmType != null">alarm_type = #{alarmType},</if>
  246. <if test="terminalStatus != null">terminal_status = #{terminalStatus},</if>
  247. <if test="createTime != null">createtime = #{createTime},</if>
  248. <if test="alarmFromType != null">alarm_from_type = #{alarmFromType},</if>
  249. <if test="msg != null">msg = #{msg},</if>
  250. <if test="isSend != null">is_send = #{isSend},</if>
  251. <if test="sendTime != null">send_time = #{sendTime},</if>
  252. </trim>
  253. where id = #{id}
  254. </update>
  255. <delete id="deleteTShouhuanAlarmListById" parameterType="Integer">
  256. delete
  257. from t_shouhuan_alarm_list
  258. where id = #{id}
  259. </delete>
  260. <delete id="deleteTShouhuanAlarmListByIds" parameterType="String">
  261. delete from t_shouhuan_alarm_list where id in
  262. <foreach item="id" collection="array" open="(" separator="," close=")">
  263. #{id}
  264. </foreach>
  265. </delete>
  266. </mapper>