KwsAlarmMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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.sckw.slope.detection.dao.mysql.KwsAlarmMapper">
  4. <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsAlarm">
  5. <!--@mbg.generated-->
  6. <!--@Table kws_alarm-->
  7. <id column="id" jdbcType="BIGINT" property="id" />
  8. <result column="pid" jdbcType="BIGINT" property="pid" />
  9. <result column="title" jdbcType="VARCHAR" property="title" />
  10. <result column="val" jdbcType="VARCHAR" property="val" />
  11. <result column="content" jdbcType="VARCHAR" property="content" />
  12. <result column="company_id" jdbcType="VARCHAR" property="companyId" />
  13. <result column="level" jdbcType="INTEGER" property="level" />
  14. <result column="type" jdbcType="INTEGER" property="type" />
  15. <result column="lat" jdbcType="VARCHAR" property="lat" />
  16. <result column="lng" jdbcType="VARCHAR" property="lng" />
  17. <result column="alt" jdbcType="VARCHAR" property="alt" />
  18. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  19. <result column="trigger_times" jdbcType="INTEGER" property="triggerTimes" />
  20. <result column="status" jdbcType="TINYINT" property="status" />
  21. </resultMap>
  22. <sql id="Base_Column_List">
  23. <!--@mbg.generated-->
  24. id, pid, title, val, content, `level`, `type`, lat, lng, alt, create_time, trigger_times,
  25. `status`,company_id
  26. </sql>
  27. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  28. <!--@mbg.generated-->
  29. select
  30. <include refid="Base_Column_List" />
  31. from kws_alarm
  32. where id = #{id,jdbcType=BIGINT}
  33. </select>
  34. <select id="selectByDevicesId" parameterType="java.lang.String" resultType="java.util.Map">
  35. <!--@mbg.generated-->
  36. select count(id) as count,pid,type
  37. from kws_alarm
  38. where 1 = 1
  39. <if test="devicesId != null and devicesId.size()>0">
  40. AND pid IN
  41. <foreach collection="devicesId" open="(" close=")" item="item" separator=",">
  42. #{item}
  43. </foreach>
  44. </if>
  45. group by pid,type
  46. </select>
  47. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  48. <!--@mbg.generated-->
  49. delete from kws_alarm
  50. where id = #{id,jdbcType=BIGINT}
  51. </delete>
  52. <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarm">
  53. <!--@mbg.generated-->
  54. insert into kws_alarm (id, pid, title,
  55. val, content, `level`,
  56. `type`, lat, lng, alt,
  57. create_time, trigger_times, `status`
  58. )
  59. values (#{id,jdbcType=BIGINT}, #{pid,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR},
  60. #{val,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER},
  61. #{type,jdbcType=INTEGER}, #{lat,jdbcType=VARCHAR}, #{lng,jdbcType=VARCHAR}, #{alt,jdbcType=VARCHAR},
  62. #{createTime,jdbcType=TIMESTAMP}, #{triggerTimes,jdbcType=INTEGER}, #{status,jdbcType=TINYINT}
  63. )
  64. </insert>
  65. <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarm">
  66. <!--@mbg.generated-->
  67. insert into kws_alarm
  68. <trim prefix="(" suffix=")" suffixOverrides=",">
  69. <if test="id != null">
  70. id,
  71. </if>
  72. <if test="pid != null">
  73. pid,
  74. </if>
  75. <if test="title != null">
  76. title,
  77. </if>
  78. <if test="val != null">
  79. val,
  80. </if>
  81. <if test="content != null">
  82. content,
  83. </if>
  84. <if test="level != null">
  85. `level`,
  86. </if>
  87. <if test="type != null">
  88. `type`,
  89. </if>
  90. <if test="lat != null">
  91. lat,
  92. </if>
  93. <if test="lng != null">
  94. lng,
  95. </if>
  96. <if test="alt != null">
  97. alt,
  98. </if>
  99. <if test="createTime != null">
  100. create_time,
  101. </if>
  102. <if test="triggerTimes != null">
  103. trigger_times,
  104. </if>
  105. <if test="status != null">
  106. `status`,
  107. </if>
  108. </trim>
  109. <trim prefix="values (" suffix=")" suffixOverrides=",">
  110. <if test="id != null">
  111. #{id,jdbcType=BIGINT},
  112. </if>
  113. <if test="pid != null">
  114. #{pid,jdbcType=BIGINT},
  115. </if>
  116. <if test="title != null">
  117. #{title,jdbcType=VARCHAR},
  118. </if>
  119. <if test="val != null">
  120. #{val,jdbcType=VARCHAR},
  121. </if>
  122. <if test="content != null">
  123. #{content,jdbcType=VARCHAR},
  124. </if>
  125. <if test="level != null">
  126. #{level,jdbcType=INTEGER},
  127. </if>
  128. <if test="type != null">
  129. #{type,jdbcType=INTEGER},
  130. </if>
  131. <if test="lat != null">
  132. #{lat,jdbcType=VARCHAR},
  133. </if>
  134. <if test="lng != null">
  135. #{lng,jdbcType=VARCHAR},
  136. </if>
  137. <if test="alt != null">
  138. #{alt,jdbcType=VARCHAR},
  139. </if>
  140. <if test="createTime != null">
  141. #{createTime,jdbcType=TIMESTAMP},
  142. </if>
  143. <if test="triggerTimes != null">
  144. #{triggerTimes,jdbcType=INTEGER},
  145. </if>
  146. <if test="status != null">
  147. #{status,jdbcType=TINYINT},
  148. </if>
  149. </trim>
  150. </insert>
  151. <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarm">
  152. <!--@mbg.generated-->
  153. update kws_alarm
  154. <set>
  155. <if test="pid != null">
  156. pid = #{pid,jdbcType=BIGINT},
  157. </if>
  158. <if test="title != null">
  159. title = #{title,jdbcType=VARCHAR},
  160. </if>
  161. <if test="val != null">
  162. val = #{val,jdbcType=VARCHAR},
  163. </if>
  164. <if test="content != null">
  165. content = #{content,jdbcType=VARCHAR},
  166. </if>
  167. <if test="level != null">
  168. `level` = #{level,jdbcType=INTEGER},
  169. </if>
  170. <if test="type != null">
  171. `type` = #{type,jdbcType=INTEGER},
  172. </if>
  173. <if test="lat != null">
  174. lat = #{lat,jdbcType=VARCHAR},
  175. </if>
  176. <if test="lng != null">
  177. lng = #{lng,jdbcType=VARCHAR},
  178. </if>
  179. <if test="alt != null">
  180. alt = #{alt,jdbcType=VARCHAR},
  181. </if>
  182. <if test="createTime != null">
  183. create_time = #{createTime,jdbcType=TIMESTAMP},
  184. </if>
  185. <if test="triggerTimes != null">
  186. trigger_times = #{triggerTimes,jdbcType=INTEGER},
  187. </if>
  188. <if test="status != null">
  189. `status` = #{status,jdbcType=TINYINT},
  190. </if>
  191. </set>
  192. where id = #{id,jdbcType=BIGINT}
  193. </update>
  194. <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsAlarm">
  195. <!--@mbg.generated-->
  196. update kws_alarm
  197. set pid = #{pid,jdbcType=BIGINT},
  198. title = #{title,jdbcType=VARCHAR},
  199. val = #{val,jdbcType=VARCHAR},
  200. content = #{content,jdbcType=VARCHAR},
  201. `level` = #{level,jdbcType=INTEGER},
  202. `type` = #{type,jdbcType=INTEGER},
  203. lat = #{lat,jdbcType=VARCHAR},
  204. lng = #{lng,jdbcType=VARCHAR},
  205. alt = #{alt,jdbcType=VARCHAR},
  206. create_time = #{createTime,jdbcType=TIMESTAMP},
  207. trigger_times = #{triggerTimes,jdbcType=INTEGER},
  208. `status` = #{status,jdbcType=TINYINT}
  209. where id = #{id,jdbcType=BIGINT}
  210. </update>
  211. </mapper>