InspectionPlanServiceDaoImplMapper.xml 13 KB

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