MachineServiceDaoImplMapper.xml 9.1 KB

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