SipDeviceMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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.gyjiot.sip.mapper.SipDeviceMapper">
  6. <resultMap type="com.gyjiot.sip.domain.SipDevice" id="SipDeviceResult">
  7. <result property="deviceId" column="device_id"/>
  8. <result property="productId" column="product_id"/>
  9. <result property="productName" column="product_name"/>
  10. <result property="deviceSipId" column="device_sip_id"/>
  11. <result property="deviceName" column="device_name"/>
  12. <result property="manufacturer" column="manufacturer"/>
  13. <result property="model" column="model"/>
  14. <result property="firmware" column="firmware"/>
  15. <result property="transport" column="transport"/>
  16. <result property="streamMode" column="stream_mode"/>
  17. <result property="online" column="online"/>
  18. <result property="registerTime" column="register_time"/>
  19. <result property="lastConnectTime" column="last_connect_time"/>
  20. <result property="activeTime" column="active_time"/>
  21. <result property="ip" column="ip"/>
  22. <result property="port" column="port"/>
  23. <result property="hostAddress" column="host_address"/>
  24. <result property="delFlag" column="del_flag"/>
  25. <result property="createBy" column="create_by"/>
  26. <result property="createTime" column="create_time"/>
  27. <result property="updateBy" column="update_by"/>
  28. <result property="updateTime" column="update_time"/>
  29. <result property="remark" column="remark"/>
  30. </resultMap>
  31. <sql id="selectSipDeviceVo">
  32. select device_id,
  33. product_id,
  34. product_name,
  35. device_sip_id,
  36. device_name,
  37. manufacturer,
  38. model,
  39. firmware,
  40. transport,
  41. stream_mode,
  42. online,
  43. register_time,
  44. last_connect_time,
  45. active_time,
  46. ip,
  47. port,
  48. host_address,
  49. del_flag,
  50. create_by,
  51. create_time,
  52. update_by,
  53. update_time,
  54. remark
  55. from sip_device
  56. </sql>
  57. <select id="selectSipDeviceList" parameterType="SipDevice" resultMap="SipDeviceResult">
  58. <include refid="selectSipDeviceVo"/>
  59. <where>
  60. <if test="productId != null ">and product_id = #{productId}</if>
  61. <if test="productName != null and productName != ''">and product_name like concat('%', #{productName},
  62. '%')
  63. </if>
  64. <if test="deviceSipId != null and deviceSipId != ''">and device_sip_id = #{deviceSipId}</if>
  65. <if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
  66. </if>
  67. <if test="manufacturer != null and manufacturer != ''">and manufacturer = #{manufacturer}</if>
  68. <if test="model != null and model != ''">and model = #{model}</if>
  69. <if test="firmware != null and firmware != ''">and firmware = #{firmware}</if>
  70. <if test="transport != null and transport != ''">and transport = #{transport}</if>
  71. <if test="streamMode != null and streamMode != ''">and stream_mode = #{streamMode}</if>
  72. <if test="online != null and online != ''">and online = #{online}</if>
  73. <if test="registerTime != null ">and register_time = #{registerTime}</if>
  74. <if test="lastConnectTime != null ">and last_connect_time = #{lastConnectTime}</if>
  75. <if test="activeTime != null ">and active_time = #{activeTime}</if>
  76. <if test="ip != null and ip != ''">and ip = #{ip}</if>
  77. <if test="port != null ">and port = #{port}</if>
  78. <if test="hostAddress != null and hostAddress != ''">and host_address = #{hostAddress}</if>
  79. </where>
  80. </select>
  81. <select id="selectSipDeviceByDeviceId" parameterType="Long" resultMap="SipDeviceResult">
  82. <include refid="selectSipDeviceVo"/>
  83. where device_id = #{deviceId}
  84. </select>
  85. <insert id="insertSipDevice" parameterType="SipDevice" useGeneratedKeys="true" keyProperty="deviceId">
  86. insert into sip_device
  87. <trim prefix="(" suffix=")" suffixOverrides=",">
  88. <if test="productId != null">product_id,</if>
  89. <if test="productName != null and productName != ''">product_name,</if>
  90. <if test="deviceSipId != null and deviceSipId != ''">device_sip_id,</if>
  91. <if test="deviceName != null and deviceName != ''">device_name,</if>
  92. <if test="manufacturer != null and manufacturer != ''">manufacturer,</if>
  93. <if test="model != null and model != ''">model,</if>
  94. <if test="firmware != null and firmware != ''">firmware,</if>
  95. <if test="transport != null and transport != ''">transport,</if>
  96. <if test="streamMode != null and streamMode != ''">stream_mode,</if>
  97. <if test="online != null and online != ''">online,</if>
  98. <if test="registerTime != null">register_time,</if>
  99. <if test="lastConnectTime != null">last_connect_time,</if>
  100. <if test="activeTime != null">active_time,</if>
  101. <if test="ip != null">ip,</if>
  102. <if test="port != null">port,</if>
  103. <if test="hostAddress != null">host_address,</if>
  104. <if test="delFlag != null and delFlag != ''">del_flag,</if>
  105. <if test="createBy != null and createBy != ''">create_by,</if>
  106. <if test="createTime != null">create_time,</if>
  107. <if test="updateBy != null">update_by,</if>
  108. <if test="updateTime != null">update_time,</if>
  109. <if test="remark != null">remark,</if>
  110. </trim>
  111. <trim prefix="values (" suffix=")" suffixOverrides=",">
  112. <if test="productId != null">#{productId},</if>
  113. <if test="productName != null and productName != ''">#{productName},</if>
  114. <if test="deviceSipId != null and deviceSipId != ''">#{deviceSipId},</if>
  115. <if test="deviceName != null and deviceName != ''">#{deviceName},</if>
  116. <if test="manufacturer != null and manufacturer != ''">#{manufacturer},</if>
  117. <if test="model != null and model != ''">#{model},</if>
  118. <if test="firmware != null and firmware != ''">#{firmware},</if>
  119. <if test="transport != null and transport != ''">#{transport},</if>
  120. <if test="streamMode != null and streamMode != ''">#{streamMode},</if>
  121. <if test="online != null and online != ''">#{online},</if>
  122. <if test="registerTime != null">#{registerTime},</if>
  123. <if test="lastConnectTime != null">#{lastConnectTime},</if>
  124. <if test="activeTime != null">#{activeTime},</if>
  125. <if test="ip != null">#{ip},</if>
  126. <if test="port != null">#{port},</if>
  127. <if test="hostAddress != null">#{hostAddress},</if>
  128. <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
  129. <if test="createBy != null and createBy != ''">#{createBy},</if>
  130. <if test="createTime != null">#{createTime},</if>
  131. <if test="updateBy != null">#{updateBy},</if>
  132. <if test="updateTime != null">#{updateTime},</if>
  133. <if test="remark != null">#{remark},</if>
  134. </trim>
  135. </insert>
  136. <update id="updateSipDevice" parameterType="SipDevice">
  137. update sip_device
  138. <trim prefix="SET" suffixOverrides=",">
  139. <if test="productId != null">product_id = #{productId},</if>
  140. <if test="productName != null and productName != ''">product_name = #{productName},</if>
  141. <if test="deviceSipId != null and deviceSipId != ''">device_sip_id = #{deviceSipId},</if>
  142. <if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
  143. <if test="manufacturer != null and manufacturer != ''">manufacturer = #{manufacturer},</if>
  144. <if test="model != null and model != ''">model = #{model},</if>
  145. <if test="firmware != null and firmware != ''">firmware = #{firmware},</if>
  146. <if test="transport != null and transport != ''">transport = #{transport},</if>
  147. <if test="streamMode != null and streamMode != ''">stream_mode = #{streamMode},</if>
  148. <if test="online != null and online != ''">online = #{online},</if>
  149. <if test="registerTime != null">register_time = #{registerTime},</if>
  150. <if test="lastConnectTime != null">last_connect_time = #{lastConnectTime},</if>
  151. <if test="activeTime != null">active_time = #{activeTime},</if>
  152. <if test="ip != null">ip = #{ip},</if>
  153. <if test="port != null">port = #{port},</if>
  154. <if test="hostAddress != null">host_address = #{hostAddress},</if>
  155. <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
  156. <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
  157. <if test="createTime != null">create_time = #{createTime},</if>
  158. <if test="updateBy != null">update_by = #{updateBy},</if>
  159. <if test="updateTime != null">update_time = #{updateTime},</if>
  160. <if test="remark != null">remark = #{remark},</if>
  161. </trim>
  162. where device_id = #{deviceId}
  163. </update>
  164. <delete id="deleteSipDeviceByDeviceId" parameterType="Long">
  165. delete
  166. from sip_device
  167. where device_id = #{deviceId}
  168. </delete>
  169. <delete id="deleteSipDeviceByDeviceIds" parameterType="String">
  170. delete from sip_device where device_id in
  171. <foreach item="deviceId" collection="array" open="(" separator="," close=")">
  172. #{deviceId}
  173. </foreach>
  174. </delete>
  175. <update id="updateSipDeviceStatus" parameterType="SipDevice">
  176. update sip_device
  177. <trim prefix="SET" suffixOverrides=",">
  178. <if test="online != null">online = #{online},</if>
  179. <if test="lastConnectTime != null">last_connect_time = #{lastConnectTime},</if>
  180. <if test="activeTime != null">active_time = #{activeTime},</if>
  181. <if test="ip != null">ip = #{ip},</if>
  182. <if test="port != null">port = #{port},</if>
  183. <if test="hostAddress != null">host_address = #{hostAddress},</if>
  184. </trim>
  185. where device_sip_id = #{deviceSipId}
  186. </update>
  187. <select id="selectOfflineSipDevice" parameterType="Integer" resultMap="SipDeviceResult">
  188. <include refid="selectSipDeviceVo"/>
  189. <where>
  190. ${checkTimeCondition}
  191. </where>
  192. </select>
  193. <select id="selectSipDeviceBySipId" parameterType="String" resultMap="SipDeviceResult">
  194. <include refid="selectSipDeviceVo"/>
  195. where device_sip_id = #{deviceSipId}
  196. </select>
  197. <delete id="deleteSipDeviceByByDeviceSipId" parameterType="String">
  198. delete
  199. from sip_device
  200. where device_sip_id = #{deviceSipId}
  201. </delete>
  202. </mapper>