InspectionTaskDetailServiceDaoImplMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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="inspectionTaskDetailServiceDaoImpl">
  6. <!-- 保存巡检任务明细信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessInspectionTaskDetailInfo" parameterType="Map">
  8. insert into business_inspection_task_detail(
  9. inspection_id,operate,inspection_name,state,community_id,b_id,task_id,task_detail_id,patrol_type,description
  10. ) values (
  11. #{inspectionId},#{operate},#{inspectionName},#{state},#{communityId},#{bId},#{taskId},#{taskDetailId},#{patrolType},#{description}
  12. )
  13. </insert>
  14. <!-- 查询巡检任务明细信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessInspectionTaskDetailInfo" parameterType="Map" resultType="Map">
  16. select t.inspection_id,t.inspection_id inspectionId,t.operate,t.inspection_name,t.inspection_name
  17. inspectionName,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.task_id,t.task_id
  18. taskId,t.task_detail_id,t.task_detail_id taskDetailId,t.patrol_type,t.description,t.patrol_type patrolType
  19. from business_inspection_task_detail t
  20. where 1 =1
  21. <if test="inspectionId !=null and inspectionId != ''">
  22. and t.inspection_id= #{inspectionId}
  23. </if>
  24. <if test="operate !=null and operate != ''">
  25. and t.operate= #{operate}
  26. </if>
  27. <if test="inspectionName !=null and inspectionName != ''">
  28. and t.inspection_name= #{inspectionName}
  29. </if>
  30. <if test="state !=null and state != ''">
  31. and t.state= #{state}
  32. </if>
  33. <if test="communityId !=null and communityId != ''">
  34. and t.community_id= #{communityId}
  35. </if>
  36. <if test="bId !=null and bId != ''">
  37. and t.b_id= #{bId}
  38. </if>
  39. <if test="taskId !=null and taskId != ''">
  40. and t.task_id= #{taskId}
  41. </if>
  42. <if test="taskDetailId !=null and taskDetailId != ''">
  43. and t.task_detail_id= #{taskDetailId}
  44. </if>
  45. </select>
  46. <!-- 保存巡检任务明细信息至 instance表中 add by wuxw 2018-07-03 -->
  47. <insert id="saveInspectionTaskDetailInfoInstance" parameterType="Map">
  48. insert into inspection_task_detail(
  49. inspection_id,status_cd,inspection_name,state,community_id,b_id,task_id,task_detail_id,patrol_type,description
  50. ) select t.inspection_id,'0',t.inspection_name,t.state,t.community_id,t.b_id,t.task_id,t.task_detail_id,t.patrol_type,t.description
  51. from
  52. business_inspection_task_detail t where 1=1
  53. <if test="inspectionId !=null and inspectionId != ''">
  54. and t.inspection_id= #{inspectionId}
  55. </if>
  56. and t.operate= 'ADD'
  57. <if test="inspectionName !=null and inspectionName != ''">
  58. and t.inspection_name= #{inspectionName}
  59. </if>
  60. <if test="state !=null and state != ''">
  61. and t.state= #{state}
  62. </if>
  63. <if test="communityId !=null and communityId != ''">
  64. and t.community_id= #{communityId}
  65. </if>
  66. <if test="bId !=null and bId != ''">
  67. and t.b_id= #{bId}
  68. </if>
  69. <if test="taskId !=null and taskId != ''">
  70. and t.task_id= #{taskId}
  71. </if>
  72. <if test="taskDetailId !=null and taskDetailId != ''">
  73. and t.task_detail_id= #{taskDetailId}
  74. </if>
  75. </insert>
  76. <!-- 查询巡检任务明细信息 add by wuxw 2018-07-03 -->
  77. <select id="getInspectionTaskDetailInfo" parameterType="Map" resultType="Map">
  78. select t.inspection_id,t.inspection_id inspectionId,t.status_cd,t.status_cd
  79. statusCd,t.inspection_name,t.inspection_name inspectionName,t.state,t.community_id,t.community_id
  80. communityId,t.b_id,t.b_id bId,t.task_id,t.task_id taskId,t.task_detail_id,t.task_detail_id taskDetailId,
  81. td1.name stateName,t.patrol_type,t.description,t.patrol_type patrolType
  82. from inspection_task_detail t,t_dict td1
  83. where 1 =1
  84. and t.state = td1.status_cd
  85. and td1.table_name = 'inspection_task_detail'
  86. and td1.table_columns = 'state'
  87. <if test="inspectionId !=null and inspectionId != ''">
  88. and t.inspection_id= #{inspectionId}
  89. </if>
  90. <if test="statusCd !=null and statusCd != ''">
  91. and t.status_cd= #{statusCd}
  92. </if>
  93. <if test="inspectionName !=null and inspectionName != ''">
  94. and t.inspection_name= #{inspectionName}
  95. </if>
  96. <if test="state !=null and state != ''">
  97. and t.state= #{state}
  98. </if>
  99. <if test="communityId !=null and communityId != ''">
  100. and t.community_id= #{communityId}
  101. </if>
  102. <if test="bId !=null and bId != ''">
  103. and t.b_id= #{bId}
  104. </if>
  105. <if test="taskId !=null and taskId != ''">
  106. and t.task_id= #{taskId}
  107. </if>
  108. <if test="taskDetailId !=null and taskDetailId != ''">
  109. and t.task_detail_id= #{taskDetailId}
  110. </if>
  111. <if test="patrolType !=null and patrolType != ''">
  112. and t.patrol_type= #{patrolType}
  113. </if>
  114. order by t.create_time desc
  115. <if test="page != -1 and page != null ">
  116. limit #{page}, #{row}
  117. </if>
  118. </select>
  119. <!-- 修改巡检任务明细信息 add by wuxw 2018-07-03 -->
  120. <update id="updateInspectionTaskDetailInfoInstance" parameterType="Map">
  121. update inspection_task_detail t set t.status_cd = #{statusCd}
  122. <if test="newBId != null and newBId != ''">
  123. ,t.b_id = #{newBId}
  124. </if>
  125. <if test="inspectionId !=null and inspectionId != ''">
  126. , t.inspection_id= #{inspectionId}
  127. </if>
  128. <if test="inspectionName !=null and inspectionName != ''">
  129. , t.inspection_name= #{inspectionName}
  130. </if>
  131. <if test="state !=null and state != ''">
  132. , t.state= #{state}
  133. </if>
  134. <if test="communityId !=null and communityId != ''">
  135. , t.community_id= #{communityId}
  136. </if>
  137. <if test="taskId !=null and taskId != ''">
  138. , t.task_id= #{taskId}
  139. </if>
  140. <if test="description !=null and description != ''">
  141. , t.description= #{description}
  142. </if>
  143. <if test="patrolType !=null and patrolType != ''">
  144. , t.patrol_type= #{patrolType}
  145. </if>
  146. where 1=1
  147. <if test="bId !=null and bId != ''">
  148. and t.b_id= #{bId}
  149. </if>
  150. <if test="taskDetailId !=null and taskDetailId != ''">
  151. and t.task_detail_id= #{taskDetailId}
  152. </if>
  153. </update>
  154. <!-- 查询巡检任务明细数量 add by wuxw 2018-07-03 -->
  155. <select id="queryInspectionTaskDetailsCount" parameterType="Map" resultType="Map">
  156. select count(1) count
  157. from inspection_task_detail t,t_dict td1
  158. where 1 =1
  159. and t.state = td1.status_cd
  160. and td1.table_name = 'inspection_task_detail'
  161. and td1.table_columns = 'state'
  162. <if test="inspectionId !=null and inspectionId != ''">
  163. and t.inspection_id= #{inspectionId}
  164. </if>
  165. <if test="statusCd !=null and statusCd != ''">
  166. and t.status_cd= #{statusCd}
  167. </if>
  168. <if test="inspectionName !=null and inspectionName != ''">
  169. and t.inspection_name= #{inspectionName}
  170. </if>
  171. <if test="state !=null and state != ''">
  172. and t.state= #{state}
  173. </if>
  174. <if test="communityId !=null and communityId != ''">
  175. and t.community_id= #{communityId}
  176. </if>
  177. <if test="bId !=null and bId != ''">
  178. and t.b_id= #{bId}
  179. </if>
  180. <if test="taskId !=null and taskId != ''">
  181. and t.task_id= #{taskId}
  182. </if>
  183. <if test="taskDetailId !=null and taskDetailId != ''">
  184. and t.task_detail_id= #{taskDetailId}
  185. </if>
  186. <if test="patrolType !=null and patrolType != ''">
  187. and t.patrol_type= #{patrolType}
  188. </if>
  189. </select>
  190. </mapper>