InspectionTaskDetailServiceDaoImplMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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,td2.name patrolTypeName
  82. from inspection_task_detail t
  83. left join t_dict td1 on t.state = td1.status_cd and td1.table_name = 'inspection_task_detail' and td1.table_columns = 'state'
  84. left join t_dict td2 on t.patrol_type = td2.status_cd and td2.table_name = 'inspection_task_detail' and td2.table_columns = 'patrol_type'
  85. where 1 =1
  86. <if test="inspectionId !=null and inspectionId != ''">
  87. and t.inspection_id= #{inspectionId}
  88. </if>
  89. <if test="statusCd !=null and statusCd != ''">
  90. and t.status_cd= #{statusCd}
  91. </if>
  92. <if test="inspectionName !=null and inspectionName != ''">
  93. and t.inspection_name= #{inspectionName}
  94. </if>
  95. <if test="state !=null and state != ''">
  96. and t.state= #{state}
  97. </if>
  98. <if test="communityId !=null and communityId != ''">
  99. and t.community_id= #{communityId}
  100. </if>
  101. <if test="bId !=null and bId != ''">
  102. and t.b_id= #{bId}
  103. </if>
  104. <if test="taskId !=null and taskId != ''">
  105. and t.task_id= #{taskId}
  106. </if>
  107. <if test="taskDetailId !=null and taskDetailId != ''">
  108. and t.task_detail_id= #{taskDetailId}
  109. </if>
  110. <if test="patrolType !=null and patrolType != ''">
  111. and t.patrol_type= #{patrolType}
  112. </if>
  113. order by t.create_time desc
  114. <if test="page != -1 and page != null ">
  115. limit #{page}, #{row}
  116. </if>
  117. </select>
  118. <!-- 修改巡检任务明细信息 add by wuxw 2018-07-03 -->
  119. <update id="updateInspectionTaskDetailInfoInstance" parameterType="Map">
  120. update inspection_task_detail t set t.status_cd = #{statusCd}
  121. <if test="newBId != null and newBId != ''">
  122. ,t.b_id = #{newBId}
  123. </if>
  124. <if test="inspectionId !=null and inspectionId != ''">
  125. , t.inspection_id= #{inspectionId}
  126. </if>
  127. <if test="inspectionName !=null and inspectionName != ''">
  128. , t.inspection_name= #{inspectionName}
  129. </if>
  130. <if test="state !=null and state != ''">
  131. , t.state= #{state}
  132. </if>
  133. <if test="communityId !=null and communityId != ''">
  134. , t.community_id= #{communityId}
  135. </if>
  136. <if test="taskId !=null and taskId != ''">
  137. , t.task_id= #{taskId}
  138. </if>
  139. <if test="description !=null and description != ''">
  140. , t.description= #{description}
  141. </if>
  142. <if test="patrolType !=null and patrolType != ''">
  143. , t.patrol_type= #{patrolType}
  144. </if>
  145. where 1=1
  146. <if test="bId !=null and bId != ''">
  147. and t.b_id= #{bId}
  148. </if>
  149. <if test="taskDetailId !=null and taskDetailId != ''">
  150. and t.task_detail_id= #{taskDetailId}
  151. </if>
  152. </update>
  153. <!-- 查询巡检任务明细数量 add by wuxw 2018-07-03 -->
  154. <select id="queryInspectionTaskDetailsCount" parameterType="Map" resultType="Map">
  155. select count(1) count
  156. from inspection_task_detail t
  157. left join t_dict td1 on t.state = td1.status_cd and td1.table_name = 'inspection_task_detail' and td1.table_columns = 'state'
  158. left join t_dict td2 on t.patrol_type = td2.status_cd and td2.table_name = 'inspection_task_detail' and td2.table_columns = 'patrol_type'
  159. where 1 =1
  160. <if test="inspectionId !=null and inspectionId != ''">
  161. and t.inspection_id= #{inspectionId}
  162. </if>
  163. <if test="statusCd !=null and statusCd != ''">
  164. and t.status_cd= #{statusCd}
  165. </if>
  166. <if test="inspectionName !=null and inspectionName != ''">
  167. and t.inspection_name= #{inspectionName}
  168. </if>
  169. <if test="state !=null and state != ''">
  170. and t.state= #{state}
  171. </if>
  172. <if test="communityId !=null and communityId != ''">
  173. and t.community_id= #{communityId}
  174. </if>
  175. <if test="bId !=null and bId != ''">
  176. and t.b_id= #{bId}
  177. </if>
  178. <if test="taskId !=null and taskId != ''">
  179. and t.task_id= #{taskId}
  180. </if>
  181. <if test="taskDetailId !=null and taskDetailId != ''">
  182. and t.task_detail_id= #{taskDetailId}
  183. </if>
  184. <if test="patrolType !=null and patrolType != ''">
  185. and t.patrol_type= #{patrolType}
  186. </if>
  187. </select>
  188. </mapper>