InspectionPlanServiceDaoImplMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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="inspectionPlanServiceDaoImpl">
  6. <!-- 保存巡检计划信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessInspectionPlanInfo" parameterType="Map">
  8. insert into
  9. business_inspection_plan
  10. (inspection_plan_name,
  11. inspection_route_id,
  12. inspection_plan_period,
  13. remark,
  14. end_time,
  15. operate,
  16. sign_type,
  17. start_time,
  18. inspection_plan_id,
  19. state,
  20. community_id,
  21. b_id,
  22. create_user_id,
  23. create_user_name)
  24. values (#{inspectionPlanName},#{inspectionRouteId},#{inspectionPlanPeriod},#{remark},
  25. #{endTime},#{operate},#{signType},#{startTime},
  26. #{inspectionPlanId},#{state},#{communityId},#{bId},#{createUserId},
  27. #{createUserName})
  28. </insert>
  29. <!-- 查询巡检计划信息(Business) add by wuxw 2018-07-03 -->
  30. <select id="getBusinessInspectionPlanInfo" parameterType="Map" resultType="Map">
  31. select
  32. t.inspection_plan_name inspectionPlanName,
  33. t.inspection_route_id inspectionRouteId,
  34. t.inspection_plan_period inspectionPlanPeriod,
  35. t.remark,t.end_time endTime,
  36. t.operate,t.sign_type signType,
  37. t.start_time startTime,t.create_user_id createUserId,
  38. t.inspection_plan_id inspectionPlanId,t.state,
  39. t.community_id communityId,t.b_id bId
  40. from business_inspection_plan t
  41. where 1 =1
  42. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  43. and t.inspection_plan_name= #{inspectionPlanName}
  44. </if>
  45. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  46. and t.inspection_route_id= #{inspectionRouteId}
  47. </if>
  48. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  49. and t.inspection_plan_period= #{inspectionPlanPeriod}
  50. </if>
  51. <if test="remark !=null and remark != ''">
  52. and t.remark= #{remark}
  53. </if>
  54. <if test="endTime !=null and endTime != ''">
  55. and t.end_time= #{endTime}
  56. </if>
  57. <if test="operate !=null and operate != ''">
  58. and t.operate= #{operate}
  59. </if>
  60. <if test="signType !=null and signType != ''">
  61. and t.sign_type= #{signType}
  62. </if>
  63. <if test="startTime !=null and startTime != ''">
  64. and t.start_time= #{startTime}
  65. </if>
  66. <if test="createUser !=null and createUser != ''">
  67. and t.create_user= #{createUser}
  68. </if>
  69. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  70. and t.inspection_plan_id= #{inspectionPlanId}
  71. </if>
  72. <if test="state !=null and state != ''">
  73. and t.state= #{state}
  74. </if>
  75. <if test="communityId !=null and communityId != ''">
  76. and t.community_id= #{communityId}
  77. </if>
  78. <if test="bId !=null and bId != ''">
  79. and t.b_id= #{bId}
  80. </if>
  81. </select>
  82. <!-- 保存巡检计划信息至 instance表中 add by wuxw 2018-07-03 -->
  83. <insert id="saveInspectionPlanInfoInstance" parameterType="Map">
  84. insert into
  85. inspection_plan(
  86. inspection_plan_name,inspection_route_id,
  87. inspection_plan_period,remark,status_cd,end_time,
  88. sign_type,start_time,create_user_id,create_user_name,
  89. inspection_plan_id,state,community_id,b_id
  90. ) select
  91. t.inspection_plan_name,t.inspection_route_id,t.inspection_plan_period,t.remark,'0',
  92. t.end_time,t.sign_type,t.start_time,t.create_user_id,t.create_user_name,
  93. t.inspection_plan_id,t.state,
  94. t.community_id,t.b_id
  95. from business_inspection_plan t where 1=1
  96. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  97. and t.inspection_plan_name= #{inspectionPlanName}
  98. </if>
  99. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  100. and t.inspection_route_id= #{inspectionRouteId}
  101. </if>
  102. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  103. and t.inspection_plan_period= #{inspectionPlanPeriod}
  104. </if>
  105. <if test="remark !=null and remark != ''">
  106. and t.remark= #{remark}
  107. </if>
  108. <if test="endTime !=null and endTime != ''">
  109. and t.end_time= #{endTime}
  110. </if>
  111. and t.operate= 'ADD'
  112. <if test="signType !=null and signType != ''">
  113. and t.sign_type= #{signType}
  114. </if>
  115. <if test="startTime !=null and startTime != ''">
  116. and t.start_time= #{startTime}
  117. </if>
  118. <if test="createUser !=null and createUser != ''">
  119. and t.create_user= #{createUser}
  120. </if>
  121. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  122. and t.inspection_plan_id= #{inspectionPlanId}
  123. </if>
  124. <if test="state !=null and state != ''">
  125. and t.state= #{state}
  126. </if>
  127. <if test="communityId !=null and communityId != ''">
  128. and t.community_id= #{communityId}
  129. </if>
  130. <if test="bId !=null and bId != ''">
  131. and t.b_id= #{bId}
  132. </if>
  133. </insert>
  134. <!-- 查询巡检计划信息 add by wuxw 2018-07-03 -->
  135. <select id="getInspectionPlanInfo" parameterType="Map" resultType="Map">
  136. select
  137. t.inspection_plan_name inspectionPlanName,
  138. t.inspection_route_id inspectionRouteId,
  139. t.inspection_plan_period inspectionPlanPeriod,
  140. t.remark,
  141. t.status_cd statusCd,
  142. t.end_time endTime,
  143. t.sign_type signType,
  144. t.start_time startTime,
  145. t.create_user_id createUserId,
  146. t.create_user_name createUserName,
  147. t.inspection_plan_id inspectionPlanId,
  148. t.state,
  149. t.community_id communityId,
  150. t.b_id bId,
  151. t.create_time createTime,
  152. d.name stateName,
  153. c.name inspectionPlanPeriodName,
  154. i.name signTypeName
  155. from
  156. inspection_plan t
  157. inner join t_dict d on t.state = d.status_cd and d.table_name = 'inspection_plan' and d.table_columns = 'state'
  158. inner join t_dict c on t.inspection_plan_period = c.status_cd and c.table_name = 'inspection_plan' and
  159. c.table_columns = 'inspection_plan_period'
  160. inner join t_dict i on t.sign_type = i.status_cd and i.table_name = 'inspection_plan' and i.table_columns =
  161. 'sign_type'
  162. where 1 =1
  163. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  164. and t.inspection_plan_name like '%${inspectionPlanName}%'
  165. </if>
  166. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  167. and t.inspection_route_id= #{inspectionRouteId}
  168. </if>
  169. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  170. and t.inspection_plan_period= #{inspectionPlanPeriod}
  171. </if>
  172. <if test="statusCd !=null and statusCd != ''">
  173. and t.status_cd= #{statusCd}
  174. </if>
  175. <if test="endTime !=null ">
  176. and t.end_time= #{endTime}
  177. </if>
  178. <if test="signType !=null and signType != ''">
  179. and t.sign_type= #{signType}
  180. </if>
  181. <if test="startTime !=null ">
  182. and t.start_time= #{startTime}
  183. </if>
  184. <if test="curTime !=null ">
  185. and t.start_time &lt; #{curTime}
  186. and t.end_time &gt; #{curTime}
  187. </if>
  188. <if test="createUserId !=null and createUserId != ''">
  189. and t.create_user_id= #{createUserId}
  190. </if>
  191. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  192. and t.inspection_plan_id= #{inspectionPlanId}
  193. </if>
  194. <if test="state !=null and state != ''">
  195. and t.state= #{state}
  196. </if>
  197. <if test="communityId !=null and communityId != ''">
  198. and t.community_id= #{communityId}
  199. </if>
  200. <if test="bId !=null and bId != ''">
  201. and t.b_id= #{bId}
  202. </if>
  203. order by t.create_time desc
  204. <if test="page != -1 and page != null ">
  205. limit #{page}, #{row}
  206. </if>
  207. </select>
  208. <!-- 修改巡检计划信息 add by wuxw 2018-07-03 -->
  209. <update id="updateInspectionPlanInfoInstance" parameterType="Map">
  210. update inspection_plan t set t.status_cd = #{statusCd}
  211. <if test="newBId != null and newBId != ''">
  212. ,t.b_id = #{newBId}
  213. </if>
  214. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  215. , t.inspection_plan_name= #{inspectionPlanName}
  216. </if>
  217. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  218. , t.inspection_route_id= #{inspectionRouteId}
  219. </if>
  220. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  221. , t.inspection_plan_period= #{inspectionPlanPeriod}
  222. </if>
  223. <if test="remark !=null and remark != ''">
  224. , t.remark= #{remark}
  225. </if>
  226. <if test="endTime !=null">
  227. , t.end_time= #{endTime}
  228. </if>
  229. <if test="signType !=null and signType != ''">
  230. , t.sign_type= #{signType}
  231. </if>
  232. <if test="startTime !=null">
  233. , t.start_time= #{startTime}
  234. </if>
  235. <if test="state !=null and state != ''">
  236. , t.state= #{state}
  237. </if>
  238. <if test="communityId !=null and communityId != ''">
  239. , t.community_id= #{communityId}
  240. </if>
  241. where 1=1
  242. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  243. and t.inspection_plan_id= #{inspectionPlanId}
  244. </if>
  245. <if test="bId !=null and bId != ''">
  246. and t.b_id= #{bId}
  247. </if>
  248. </update>
  249. <!-- 查询巡检计划数量 add by wuxw 2018-07-03 -->
  250. <select id="queryInspectionPlansCount" parameterType="Map" resultType="Map">
  251. select count(1) count
  252. from inspection_plan t
  253. where 1 =1
  254. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  255. and t.inspection_plan_name like '%${inspectionPlanName}%'
  256. </if>
  257. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  258. and t.inspection_route_id= #{inspectionRouteId}
  259. </if>
  260. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  261. and t.inspection_plan_period= #{inspectionPlanPeriod}
  262. </if>
  263. <if test="remark !=null and remark != ''">
  264. and t.remark= #{remark}
  265. </if>
  266. <if test="statusCd !=null and statusCd != ''">
  267. and t.status_cd= #{statusCd}
  268. </if>
  269. <if test="endTime !=null and endTime != ''">
  270. and t.end_time= #{endTime}
  271. </if>
  272. <if test="signType !=null and signType != ''">
  273. and t.sign_type= #{signType}
  274. </if>
  275. <if test="startTime !=null and startTime != ''">
  276. and t.start_time= #{startTime}
  277. </if>
  278. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  279. and t.inspection_plan_id= #{inspectionPlanId}
  280. </if>
  281. <if test="state !=null and state != ''">
  282. and t.state= #{state}
  283. </if>
  284. <if test="communityId !=null and communityId != ''">
  285. and t.community_id= #{communityId}
  286. </if>
  287. <if test="bId !=null and bId != ''">
  288. and t.b_id= #{bId}
  289. </if>
  290. </select>
  291. </mapper>