MachineV1ServiceDaoImplMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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="machineV1ServiceDaoImpl">
  6. <!-- 保存设备信息信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveMachineInfo" parameterType="Map">
  8. insert into machine(
  9. heartbeat_time,machine_code,auth_code,location_type_cd,machine_version,machine_name,machine_mac,
  10. machine_id,type_id,state,community_id,location_obj_id,machine_type_cd,machine_ip,direction,b_id
  11. ) values (
  12. #{heartbeatTime},#{machineCode},#{authCode},#{locationTypeCd},#{machineVersion},#{machineName},#{machineMac},
  13. #{machineId},#{typeId},#{state},#{communityId},#{locationObjId},#{machineTypeCd},#{machineIp},#{direction},#{bId}
  14. )
  15. </insert>
  16. <!-- 查询设备信息信息 add by wuxw 2018-07-03 -->
  17. <select id="getMachineInfo" parameterType="Map" resultType="Map">
  18. select t.heartbeat_time,t.heartbeat_time heartbeatTime,t.machine_code,t.machine_code
  19. machineCode,t.auth_code,t.auth_code authCode,t.location_type_cd,t.location_type_cd
  20. locationTypeCd,t.machine_version,t.machine_version machineVersion,t.status_cd,t.status_cd
  21. statusCd,t.machine_name,t.machine_name machineName,t.machine_mac,t.machine_mac
  22. machineMac,t.machine_id,t.machine_id machineId,t.type_id,t.type_id typeId,t.state,t.community_id,t.community_id
  23. communityId,t.location_obj_id,t.location_obj_id locationObjId,t.machine_type_cd,t.machine_type_cd
  24. machineTypeCd,t.machine_ip,t.machine_ip machineIp,t.direction
  25. from machine t
  26. where 1 =1
  27. <if test="heartbeatTime !=null and heartbeatTime != ''">
  28. and t.heartbeat_time= #{heartbeatTime}
  29. </if>
  30. <if test="machineCode !=null and machineCode != ''">
  31. and t.machine_code= #{machineCode}
  32. </if>
  33. <if test="authCode !=null and authCode != ''">
  34. and t.auth_code= #{authCode}
  35. </if>
  36. <if test="locationTypeCd !=null and locationTypeCd != ''">
  37. and t.location_type_cd= #{locationTypeCd}
  38. </if>
  39. <if test="machineVersion !=null and machineVersion != ''">
  40. and t.machine_version= #{machineVersion}
  41. </if>
  42. <if test="statusCd !=null and statusCd != ''">
  43. and t.status_cd= #{statusCd}
  44. </if>
  45. <if test="machineName !=null and machineName != ''">
  46. and t.machine_name= #{machineName}
  47. </if>
  48. <if test="machineMac !=null and machineMac != ''">
  49. and t.machine_mac= #{machineMac}
  50. </if>
  51. <if test="machineId !=null and machineId != ''">
  52. and t.machine_id= #{machineId}
  53. </if>
  54. <if test="typeId !=null and typeId != ''">
  55. and t.type_id= #{typeId}
  56. </if>
  57. <if test="state !=null and state != ''">
  58. and t.state= #{state}
  59. </if>
  60. <if test="communityId !=null and communityId != ''">
  61. and t.community_id= #{communityId}
  62. </if>
  63. <if test="locationObjId !=null and locationObjId != ''">
  64. and t.location_obj_id= #{locationObjId}
  65. </if>
  66. <if test="machineTypeCd !=null and machineTypeCd != ''">
  67. and t.machine_type_cd= #{machineTypeCd}
  68. </if>
  69. <if test="machineIp !=null and machineIp != ''">
  70. and t.machine_ip= #{machineIp}
  71. </if>
  72. <if test="direction !=null and direction != ''">
  73. and t.direction= #{direction}
  74. </if>
  75. order by t.create_time desc
  76. <if test="page != -1 and page != null ">
  77. limit #{page}, #{row}
  78. </if>
  79. </select>
  80. <!-- 修改设备信息信息 add by wuxw 2018-07-03 -->
  81. <update id="updateMachineInfo" parameterType="Map">
  82. update machine t set t.status_cd = #{statusCd}
  83. <if test="newBId != null and newBId != ''">
  84. ,t.b_id = #{newBId}
  85. </if>
  86. <if test="heartbeatTime !=null and heartbeatTime != ''">
  87. , t.heartbeat_time= #{heartbeatTime}
  88. </if>
  89. <if test="machineCode !=null and machineCode != ''">
  90. , t.machine_code= #{machineCode}
  91. </if>
  92. <if test="authCode !=null and authCode != ''">
  93. , t.auth_code= #{authCode}
  94. </if>
  95. <if test="locationTypeCd !=null and locationTypeCd != ''">
  96. , t.location_type_cd= #{locationTypeCd}
  97. </if>
  98. <if test="machineVersion !=null and machineVersion != ''">
  99. , t.machine_version= #{machineVersion}
  100. </if>
  101. <if test="machineName !=null and machineName != ''">
  102. , t.machine_name= #{machineName}
  103. </if>
  104. <if test="machineMac !=null and machineMac != ''">
  105. , t.machine_mac= #{machineMac}
  106. </if>
  107. <if test="typeId !=null and typeId != ''">
  108. , t.type_id= #{typeId}
  109. </if>
  110. <if test="state !=null and state != ''">
  111. , t.state= #{state}
  112. </if>
  113. <if test="communityId !=null and communityId != ''">
  114. , t.community_id= #{communityId}
  115. </if>
  116. <if test="locationObjId !=null and locationObjId != ''">
  117. , t.location_obj_id= #{locationObjId}
  118. </if>
  119. <if test="machineTypeCd !=null and machineTypeCd != ''">
  120. , t.machine_type_cd= #{machineTypeCd}
  121. </if>
  122. <if test="machineIp !=null and machineIp != ''">
  123. , t.machine_ip= #{machineIp}
  124. </if>
  125. <if test="direction !=null and direction != ''">
  126. , t.direction= #{direction}
  127. </if>
  128. where 1=1
  129. <if test="machineId !=null and machineId != ''">
  130. and t.machine_id= #{machineId}
  131. </if>
  132. </update>
  133. <!-- 查询设备信息数量 add by wuxw 2018-07-03 -->
  134. <select id="queryMachinesCount" parameterType="Map" resultType="Map">
  135. select count(1) count
  136. from machine t
  137. where 1 =1
  138. <if test="heartbeatTime !=null and heartbeatTime != ''">
  139. and t.heartbeat_time= #{heartbeatTime}
  140. </if>
  141. <if test="machineCode !=null and machineCode != ''">
  142. and t.machine_code= #{machineCode}
  143. </if>
  144. <if test="authCode !=null and authCode != ''">
  145. and t.auth_code= #{authCode}
  146. </if>
  147. <if test="locationTypeCd !=null and locationTypeCd != ''">
  148. and t.location_type_cd= #{locationTypeCd}
  149. </if>
  150. <if test="machineVersion !=null and machineVersion != ''">
  151. and t.machine_version= #{machineVersion}
  152. </if>
  153. <if test="statusCd !=null and statusCd != ''">
  154. and t.status_cd= #{statusCd}
  155. </if>
  156. <if test="machineName !=null and machineName != ''">
  157. and t.machine_name= #{machineName}
  158. </if>
  159. <if test="machineMac !=null and machineMac != ''">
  160. and t.machine_mac= #{machineMac}
  161. </if>
  162. <if test="machineId !=null and machineId != ''">
  163. and t.machine_id= #{machineId}
  164. </if>
  165. <if test="typeId !=null and typeId != ''">
  166. and t.type_id= #{typeId}
  167. </if>
  168. <if test="state !=null and state != ''">
  169. and t.state= #{state}
  170. </if>
  171. <if test="communityId !=null and communityId != ''">
  172. and t.community_id= #{communityId}
  173. </if>
  174. <if test="locationObjId !=null and locationObjId != ''">
  175. and t.location_obj_id= #{locationObjId}
  176. </if>
  177. <if test="machineTypeCd !=null and machineTypeCd != ''">
  178. and t.machine_type_cd= #{machineTypeCd}
  179. </if>
  180. <if test="machineIp !=null and machineIp != ''">
  181. and t.machine_ip= #{machineIp}
  182. </if>
  183. <if test="direction !=null and direction != ''">
  184. and t.direction= #{direction}
  185. </if>
  186. </select>
  187. </mapper>