InspectionRoutePointRelServiceDaoImplMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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="inspectionRoutePointRelServiceDaoImpl">
  6. <!-- 保存巡检路线巡检点关系信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessInspectionRoutePointRelInfo" parameterType="Map">
  8. insert into business_inspection_route_point_rel(
  9. inspection_id,operate,inspection_route_id,irp_rel_id,community_id,b_id,point_start_time,point_end_time,sort_number
  10. ) values (
  11. #{inspectionId},#{operate},#{inspectionRouteId},#{irpRelId},#{communityId},#{bId},#{pointStartTime},#{pointEndTime},#{sortNumber}
  12. )
  13. </insert>
  14. <!-- 查询巡检路线巡检点关系信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessInspectionRoutePointRelInfo" parameterType="Map" resultType="Map">
  16. select t.inspection_id,t.inspection_id inspectionId,t.operate,t.inspection_route_id,t.inspection_route_id
  17. inspectionRouteId,t.irp_rel_id,t.irp_rel_id irpRelId,t.community_id,t.community_id
  18. communityId,t.b_id,t.b_id bId,t.point_start_time,t.point_start_time pointStartTime,t.point_end_time,t.point_end_time pointEndTime,t.sort_number,t.sort_number sortNumber
  19. from business_inspection_route_point_rel 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="inspectionRouteId !=null and inspectionRouteId != ''">
  28. and t.inspection_route_id= #{inspectionRouteId}
  29. </if>
  30. <if test="irpRelId !=null and irpRelId != ''">
  31. and t.irp_rel_id= #{irpRelId}
  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. </select>
  40. <!-- 保存巡检路线巡检点关系信息至 instance表中 add by wuxw 2018-07-03 -->
  41. <insert id="saveInspectionRoutePointRelInfoInstance" parameterType="Map">
  42. insert into inspection_route_point_rel(
  43. inspection_id,inspection_route_id,irp_rel_id,status_cd,community_id,b_id,point_start_time,point_end_time,sort_number
  44. ) select t.inspection_id,t.inspection_route_id,t.irp_rel_id,'0',t.community_id,t.b_id,t.point_start_time,t.point_end_time,t.sort_number from
  45. business_inspection_route_point_rel t where 1=1
  46. <if test="inspectionId !=null and inspectionId != ''">
  47. and t.inspection_id= #{inspectionId}
  48. </if>
  49. and t.operate= 'ADD'
  50. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  51. and t.inspection_route_id= #{inspectionRouteId}
  52. </if>
  53. <if test="irpRelId !=null and irpRelId != ''">
  54. and t.irp_rel_id= #{irpRelId}
  55. </if>
  56. <if test="communityId !=null and communityId != ''">
  57. and t.community_id= #{communityId}
  58. </if>
  59. <if test="bId !=null and bId != ''">
  60. and t.b_id= #{bId}
  61. </if>
  62. </insert>
  63. <!-- 查询巡检路线巡检点关系信息 add by wuxw 2018-07-03 -->
  64. <select id="getInspectionRoutePointRelInfo" parameterType="Map" resultType="Map">
  65. select t.inspection_id,t.inspection_id inspectionId,t.inspection_route_id,t.inspection_route_id
  66. inspectionRouteId,t.irp_rel_id,t.irp_rel_id irpRelId,t.status_cd,t.status_cd
  67. statusCd,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
  68. ip.inspection_id inspectionId,ip.remark,td.name pointTypeName,
  69. ip.inspection_name inspectionName,ip.point_obj_type,ip.point_obj_id,ip.point_obj_name,
  70. ip.point_obj_type pointObjType,ip.point_obj_id pointObjId,ip.point_obj_name pointObjName,
  71. t.point_start_time,t.point_start_time pointStartTime,t.point_end_time,t.point_end_time pointEndTime,t.sort_number,t.sort_number sortNumber
  72. from inspection_route_point_rel t,inspection_point ip
  73. left join t_dict td on ip.point_obj_type = td.status_cd and td.table_name = 'inspection_point'
  74. and td.table_columns = 'point_obj_type'
  75. where 1 =1
  76. and t.inspection_id = ip.inspection_id
  77. and ip.status_cd = '0'
  78. <if test="inspectionId !=null and inspectionId != ''">
  79. and t.inspection_id= #{inspectionId}
  80. </if>
  81. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  82. and t.inspection_route_id= #{inspectionRouteId}
  83. </if>
  84. <if test="irpRelId !=null and irpRelId != ''">
  85. and t.irp_rel_id= #{irpRelId}
  86. </if>
  87. <if test="statusCd !=null and statusCd != ''">
  88. and t.status_cd= #{statusCd}
  89. </if>
  90. <if test="communityId !=null and communityId != ''">
  91. and t.community_id= #{communityId}
  92. and ip.community_id = #{communityId}
  93. </if>
  94. <if test="bId !=null and bId != ''">
  95. and t.b_id= #{bId}
  96. </if>
  97. order by t.sort_number desc
  98. <if test="page != -1 and page != null ">
  99. limit #{page}, #{row}
  100. </if>
  101. </select>
  102. <!-- 修改巡检路线巡检点关系信息 add by wuxw 2018-07-03 -->
  103. <update id="updateInspectionRoutePointRelInfoInstance" parameterType="Map">
  104. update inspection_route_point_rel t set t.status_cd = #{statusCd}
  105. <if test="newBId != null and newBId != ''">
  106. ,t.b_id = #{newBId}
  107. </if>
  108. <if test="inspectionId !=null and inspectionId != ''">
  109. , t.inspection_id= #{inspectionId}
  110. </if>
  111. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  112. , t.inspection_route_id= #{inspectionRouteId}
  113. </if>
  114. <if test="communityId !=null and communityId != ''">
  115. , t.community_id= #{communityId}
  116. </if>
  117. <if test="pointStartTime !=null and pointStartTime != ''">
  118. , t.point_start_time= #{pointStartTime}
  119. </if>
  120. <if test="pointEndTime !=null and pointEndTime != ''">
  121. , t.point_end_time= #{pointEndTime}
  122. </if>
  123. <if test="sortNumber !=null and sortNumber != ''">
  124. , t.sort_number= #{sortNumber}
  125. </if>
  126. where 1=1
  127. <if test="irpRelId !=null and irpRelId != ''">
  128. and t.irp_rel_id= #{irpRelId}
  129. </if>
  130. <if test="bId !=null and bId != ''">
  131. and t.b_id= #{bId}
  132. </if>
  133. </update>
  134. <!-- 查询巡检路线巡检点关系数量 add by wuxw 2018-07-03 -->
  135. <select id="queryInspectionRoutePointRelsCount" parameterType="Map" resultType="Map">
  136. select count(1) count
  137. from inspection_route_point_rel t,inspection_point ip
  138. where 1 =1
  139. and t.inspection_id = ip.inspection_id
  140. and ip.status_cd = '0'
  141. <if test="inspectionId !=null and inspectionId != ''">
  142. and t.inspection_id= #{inspectionId}
  143. </if>
  144. <if test="inspectionRouteId !=null and inspectionRouteId != ''">
  145. and t.inspection_route_id= #{inspectionRouteId}
  146. </if>
  147. <if test="irpRelId !=null and irpRelId != ''">
  148. and t.irp_rel_id= #{irpRelId}
  149. </if>
  150. <if test="statusCd !=null and statusCd != ''">
  151. and t.status_cd= #{statusCd}
  152. </if>
  153. <if test="communityId !=null and communityId != ''">
  154. and t.community_id= #{communityId}
  155. and ip.community_id = #{communityId}
  156. </if>
  157. <if test="bId !=null and bId != ''">
  158. and t.b_id= #{bId}
  159. </if>
  160. </select>
  161. </mapper>