InspectionServiceDaoImplMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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="inspectionServiceDaoImpl">
  6. <!-- 保存巡检点信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessInspectionInfo" parameterType="Map">
  8. insert into business_inspection_point
  9. (inspection_id,machine_id,operate,remark,inspection_name,community_id,b_id)
  10. values
  11. (#{inspectionId},#{machineId},#{operate},#{remark},#{inspectionName},#{communityId},#{bId})
  12. </insert>
  13. <!-- 查询巡检点信息(Business) add by wuxw 2018-07-03 -->
  14. <select id="getBusinessInspectionInfo" parameterType="Map" resultType="Map">
  15. select t.inspection_id,t.inspection_id inspectionId,t.machine_id,t.machine_id
  16. machineId,t.operate,t.remark,t.inspection_name,t.inspection_name inspectionName,t.community_id,t.community_id
  17. communityId,t.b_id,t.b_id bId
  18. from business_inspection_point t
  19. where 1 =1
  20. <if test="inspectionId !=null and inspectionId != ''">
  21. and t.inspection_id= #{inspectionId}
  22. </if>
  23. <if test="machineId !=null and machineId != ''">
  24. and t.machine_id= #{machineId}
  25. </if>
  26. <if test="operate !=null and operate != ''">
  27. and t.operate= #{operate}
  28. </if>
  29. <if test="remark !=null and remark != ''">
  30. and t.remark= #{remark}
  31. </if>
  32. <if test="inspectionName !=null and inspectionName != ''">
  33. and t.inspection_name like concat('%',#{inspectionName},'%')
  34. </if>
  35. <if test="communityId !=null and communityId != ''">
  36. and t.community_id= #{communityId}
  37. </if>
  38. <if test="bId !=null and bId != ''">
  39. and t.b_id= #{bId}
  40. </if>
  41. </select>
  42. <!-- 保存巡检点信息至 instance表中 add by wuxw 2018-07-03 -->
  43. <insert id="saveInspectionInfoInstance" parameterType="Map">
  44. insert into
  45. inspection_point(
  46. inspection_id,machine_id,remark,status_cd,inspection_name,community_id,b_id
  47. ) select t.inspection_id,t.machine_id,t.remark,'0',t.inspection_name,t.community_id,t.b_id from
  48. business_inspection_point t where 1=1
  49. <if test="inspectionId !=null and inspectionId != ''">
  50. and t.inspection_id= #{inspectionId}
  51. </if>
  52. <if test="machineId !=null and machineId != ''">
  53. and t.machine_id= #{machineId}
  54. </if>
  55. and t.operate= 'ADD'
  56. <if test="remark !=null and remark != ''">
  57. and t.remark= #{remark}
  58. </if>
  59. <if test="inspectionName !=null and inspectionName != ''">
  60. and t.inspection_name= #{inspectionName}
  61. </if>
  62. <if test="communityId !=null and communityId != ''">
  63. and t.community_id= #{communityId}
  64. </if>
  65. <if test="bId !=null and bId != ''">
  66. and t.b_id= #{bId}
  67. </if>
  68. </insert>
  69. <!-- 查询巡检点信息 add by wuxw 2018-07-03 -->
  70. <select id="getInspectionInfo" parameterType="Map" resultType="Map">
  71. select
  72. t.inspection_id,t.inspection_id inspectionId,t.machine_id,
  73. t.machine_id machineId,t.remark,t.status_cd,t.status_cd statusCd,
  74. t.inspection_name,t.inspection_name inspectionName,t.community_id,
  75. t.community_id communityId,t.b_id,t.b_id bId,
  76. m.machine_code machineCode,m.machine_name machineName,location_type_cd locationTypeCd,location_obj_id
  77. locationObjId,m.machine_id machineId,
  78. d.name locationTypeName
  79. from inspection_point t
  80. inner join machine m on t.machine_id = m.machine_id and m.status_cd = 0
  81. inner join t_dict d on d.status_cd = m.location_type_cd
  82. <if test="inspectionRouteId != null and inspectionRouteId != ''">
  83. left join inspection_route_point_rel c on t.inspection_id = c.inspection_id
  84. and c.status_cd = '0'
  85. and c.inspection_route_id is null
  86. </if>
  87. where 1 =1
  88. <if test="inspectionId !=null and inspectionId != ''">
  89. and t.inspection_id= #{inspectionId}
  90. </if>
  91. <if test="machineCode !=null and machineCode != ''">
  92. and m.machine_code= #{machineCode}
  93. </if>
  94. <if test="remark !=null and remark != ''">
  95. and t.remark= #{remark}
  96. </if>
  97. <if test="statusCd !=null and statusCd != ''">
  98. and t.status_cd= #{statusCd}
  99. </if>
  100. <if test="inspectionName !=null and inspectionName != ''">
  101. and t.inspection_name like concat('%',#{inspectionName},'%')
  102. </if>
  103. <if test="communityId !=null and communityId != ''">
  104. and t.community_id= #{communityId}
  105. </if>
  106. <if test="bId !=null and bId != ''">
  107. and t.b_id= #{bId}
  108. </if>
  109. group by t.inspection_id
  110. order by t.create_time desc
  111. <if test="page != -1 and page != null ">
  112. limit #{page}, #{row}
  113. </if>
  114. </select>
  115. <!-- 修改巡检点信息 add by wuxw 2018-07-03 -->
  116. <update id="updateInspectionInfoInstance" parameterType="Map">
  117. update inspection_point t set t.status_cd = #{statusCd}
  118. <if test="newBId != null and newBId != ''">
  119. ,t.b_id = #{newBId}
  120. </if>
  121. <if test="machineId !=null and machineId != ''">
  122. , t.machine_id= #{machineId}
  123. </if>
  124. <if test="remark !=null and remark != ''">
  125. , t.remark= #{remark}
  126. </if>
  127. <if test="inspectionName !=null and inspectionName != ''">
  128. , t.inspection_name= #{inspectionName}
  129. </if>
  130. <if test="communityId !=null and communityId != ''">
  131. , t.community_id= #{communityId}
  132. </if>
  133. where 1=1
  134. <if test="inspectionId !=null and inspectionId != ''">
  135. and t.inspection_id= #{inspectionId}
  136. </if>
  137. <if test="bId !=null and bId != ''">
  138. and t.b_id= #{bId}
  139. </if>
  140. </update>
  141. <!-- 查询巡检点数量 add by wuxw 2018-07-03 -->
  142. <select id="queryInspectionsCount" parameterType="Map" resultType="Map">
  143. select count(1) count
  144. from inspection_point t
  145. <if test="inspectionRouteId != null and inspectionRouteId != ''">
  146. left join inspection_route_point_rel c on t.inspection_id = c.inspection_id
  147. and c.status_cd = '0'
  148. and c.inspection_route_id is null
  149. </if>
  150. where 1 =1
  151. <if test="inspectionId !=null and inspectionId != ''">
  152. and t.inspection_id= #{inspectionId}
  153. </if>
  154. <if test="machineId !=null and machineId != ''">
  155. and t.machine_id= #{machineId}
  156. </if>
  157. <if test="remark !=null and remark != ''">
  158. and t.remark= #{remark}
  159. </if>
  160. <if test="statusCd !=null and statusCd != ''">
  161. and t.status_cd= #{statusCd}
  162. </if>
  163. <if test="inspectionName !=null and inspectionName != ''">
  164. and t.inspection_name= #{inspectionName}
  165. </if>
  166. <if test="communityId !=null and communityId != ''">
  167. and t.community_id= #{communityId}
  168. </if>
  169. <if test="bId !=null and bId != ''">
  170. and t.b_id= #{bId}
  171. </if>
  172. </select>
  173. <!-- 查询巡检点信息 add by wuxw 2018-07-03 -->
  174. <select id="getInspectionRelationShipInfo" parameterType="Map" resultType="Map">
  175. select
  176. t.inspection_id,t.inspection_id inspectionId,t.machine_id,
  177. t.machine_id machineId,t.remark,t.status_cd,t.status_cd statusCd,
  178. t.inspection_name,t.inspection_name inspectionName,t.community_id,
  179. t.community_id communityId,t.b_id,t.b_id bId,
  180. m.machine_code machineCode,m.machine_name machineName,location_type_cd locationTypeCd,location_obj_id
  181. locationObjId,m.machine_id machineId,
  182. d.name locationTypeName
  183. from inspection_point t
  184. inner join machine m on t.machine_id = m.machine_id and m.status_cd = 0
  185. inner join t_dict d on d.status_cd = m.location_type_cd
  186. left join inspection_route_point_rel c on t.inspection_id = c.inspection_id and c.status_cd = '0' and c.inspection_route_id = #{inspectionRouteId}
  187. where 1 =1
  188. <if test="relationship != null and relationship == 1">
  189. and c.inspection_id is not null
  190. </if>
  191. <if test="relationship != null and relationship == 0">
  192. and c.inspection_route_id = #{inspectionRouteId}
  193. and c.inspection_id is null
  194. </if>
  195. <if test="inspectionId !=null and inspectionId != ''">
  196. and t.inspection_id= #{inspectionId}
  197. </if>
  198. <if test="machineCode !=null and machineCode != ''">
  199. and m.machine_code= #{machineCode}
  200. </if>
  201. <if test="remark !=null and remark != ''">
  202. and t.remark= #{remark}
  203. </if>
  204. <if test="statusCd !=null and statusCd != ''">
  205. and t.status_cd= #{statusCd}
  206. </if>
  207. <if test="inspectionName !=null and inspectionName != ''">
  208. and t.inspection_name like concat('%',#{inspectionName},'%')
  209. </if>
  210. <if test="communityId !=null and communityId != ''">
  211. and t.community_id= #{communityId}
  212. </if>
  213. <if test="bId !=null and bId != ''">
  214. and t.b_id= #{bId}
  215. </if>
  216. group by t.inspection_id
  217. order by t.create_time desc
  218. <if test="page != -1 and page != null ">
  219. limit #{page}, #{row}
  220. </if>
  221. </select>
  222. <!-- 查询巡检点数量 add by wuxw 2018-07-03 -->
  223. <select id="queryInspectionsRelationShipCount" parameterType="Map" resultType="Map">
  224. select count(1) count
  225. from inspection_point t
  226. inner join machine m on t.machine_id = m.machine_id and m.status_cd = 0
  227. inner join t_dict d on d.status_cd = m.location_type_cd
  228. left join inspection_route_point_rel c on t.inspection_id = c.inspection_id
  229. and c.status_cd = '0'
  230. and c.inspection_route_id = #{inspectionRouteId}
  231. where 1 =1
  232. <if test="relationship != null and relationship == 1">
  233. and c.inspection_id is not null
  234. </if>
  235. <if test="relationship != null and relationship == 0">
  236. and c.inspection_route_id = #{inspectionRouteId}
  237. and c.inspection_id is null
  238. </if>
  239. <if test="inspectionId !=null and inspectionId != ''">
  240. and t.inspection_id= #{inspectionId}
  241. </if>
  242. <if test="machineId !=null and machineId != ''">
  243. and t.machine_id= #{machineId}
  244. </if>
  245. <if test="remark !=null and remark != ''">
  246. and t.remark= #{remark}
  247. </if>
  248. <if test="statusCd !=null and statusCd != ''">
  249. and t.status_cd= #{statusCd}
  250. </if>
  251. <if test="inspectionName !=null and inspectionName != ''">
  252. and t.inspection_name= #{inspectionName}
  253. </if>
  254. <if test="communityId !=null and communityId != ''">
  255. and t.community_id= #{communityId}
  256. </if>
  257. <if test="bId !=null and bId != ''">
  258. and t.b_id= #{bId}
  259. </if>
  260. </select>
  261. </mapper>