InspectionPlanServiceDaoImplMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 c.table_columns = 'inspection_plan_period'
  159. inner join t_dict i on t.sign_type = i.status_cd and i.table_name = 'inspection_plan' and i.table_columns = 'sign_type'
  160. where 1 =1
  161. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  162. and t.inspection_plan_name= #{inspectionPlanName}
  163. </if>
  164. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  165. and t.inspection_route_id= #{inspectionRouteId}
  166. </if>
  167. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  168. and t.inspection_plan_period= #{inspectionPlanPeriod}
  169. </if>
  170. <if test="statusCd !=null and statusCd != ''">
  171. and t.status_cd= #{statusCd}
  172. </if>
  173. <if test="endTime !=null ">
  174. and t.end_time= #{endTime}
  175. </if>
  176. <if test="signType !=null and signType != ''">
  177. and t.sign_type= #{signType}
  178. </if>
  179. <if test="startTime !=null ">
  180. and t.start_time= #{startTime}
  181. </if>
  182. <if test="curTime !=null ">
  183. and t.start_time &lt; #{curTime}
  184. and t.end_time &gt; #{curTime}
  185. </if>
  186. <if test="createUserId !=null and createUserId != ''">
  187. and t.create_user_id= #{createUserId}
  188. </if>
  189. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  190. and t.inspection_plan_id= #{inspectionPlanId}
  191. </if>
  192. <if test="state !=null and state != ''">
  193. and t.state= #{state}
  194. </if>
  195. <if test="communityId !=null and communityId != ''">
  196. and t.community_id= #{communityId}
  197. </if>
  198. <if test="bId !=null and bId != ''">
  199. and t.b_id= #{bId}
  200. </if>
  201. order by t.create_time desc
  202. <if test="page != -1 and page != null ">
  203. limit #{page}, #{row}
  204. </if>
  205. </select>
  206. <!-- 修改巡检计划信息 add by wuxw 2018-07-03 -->
  207. <update id="updateInspectionPlanInfoInstance" parameterType="Map">
  208. update inspection_plan t set t.status_cd = #{statusCd}
  209. <if test="newBId != null and newBId != ''">
  210. ,t.b_id = #{newBId}
  211. </if>
  212. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  213. , t.inspection_plan_name= #{inspectionPlanName}
  214. </if>
  215. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  216. , t.inspection_route_id= #{inspectionRouteId}
  217. </if>
  218. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  219. , t.inspection_plan_period= #{inspectionPlanPeriod}
  220. </if>
  221. <if test="remark !=null and remark != ''">
  222. , t.remark= #{remark}
  223. </if>
  224. <if test="endTime !=null">
  225. , t.end_time= #{endTime}
  226. </if>
  227. <if test="signType !=null and signType != ''">
  228. , t.sign_type= #{signType}
  229. </if>
  230. <if test="startTime !=null">
  231. , t.start_time= #{startTime}
  232. </if>
  233. <if test="state !=null and state != ''">
  234. , t.state= #{state}
  235. </if>
  236. <if test="communityId !=null and communityId != ''">
  237. , t.community_id= #{communityId}
  238. </if>
  239. where 1=1
  240. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  241. and t.inspection_plan_id= #{inspectionPlanId}
  242. </if>
  243. <if test="bId !=null and bId != ''">
  244. and t.b_id= #{bId}
  245. </if>
  246. </update>
  247. <!-- 查询巡检计划数量 add by wuxw 2018-07-03 -->
  248. <select id="queryInspectionPlansCount" parameterType="Map" resultType="Map">
  249. select count(1) count
  250. from inspection_plan t
  251. where 1 =1
  252. <if test="inspectionPlanName !=null and inspectionPlanName != ''">
  253. and t.inspection_plan_name= #{inspectionPlanName}
  254. </if>
  255. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  256. and t.inspection_route_id= #{inspectionRouteId}
  257. </if>
  258. <if test="inspectionPlanPeriod !=null and inspectionPlanPeriod != ''">
  259. and t.inspection_plan_period= #{inspectionPlanPeriod}
  260. </if>
  261. <if test="remark !=null and remark != ''">
  262. and t.remark= #{remark}
  263. </if>
  264. <if test="statusCd !=null and statusCd != ''">
  265. and t.status_cd= #{statusCd}
  266. </if>
  267. <if test="endTime !=null and endTime != ''">
  268. and t.end_time= #{endTime}
  269. </if>
  270. <if test="signType !=null and signType != ''">
  271. and t.sign_type= #{signType}
  272. </if>
  273. <if test="startTime !=null and startTime != ''">
  274. and t.start_time= #{startTime}
  275. </if>
  276. <if test="inspectionPlanId !=null and inspectionPlanId != ''">
  277. and t.inspection_plan_id= #{inspectionPlanId}
  278. </if>
  279. <if test="state !=null and state != ''">
  280. and t.state= #{state}
  281. </if>
  282. <if test="communityId !=null and communityId != ''">
  283. and t.community_id= #{communityId}
  284. </if>
  285. <if test="bId !=null and bId != ''">
  286. and t.b_id= #{bId}
  287. </if>
  288. </select>
  289. </mapper>