DevopsWorkOrderMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.bizmatics.persistence.mapper.DevopsWorkOrderMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.bizmatics.model.DevopsWorkOrder">
  6. <id column="id" property="id" />
  7. <result column="work_order" property="workOrder" />
  8. <result column="site_id" property="siteId" />
  9. <result column="work_order_type" property="workOrderType" />
  10. <result column="expected_completion_time" property="expectedCompletionTime" />
  11. <result column="team_id" property="teamId" />
  12. <result column="generation_mode" property="generationMode" />
  13. <result column="work_order_status" property="workOrderStatus" />
  14. <result column="picture_path_one" property="picturePathOne" />
  15. <result column="picture_path_two" property="picturePathTwo" />
  16. <result column="picture_path_three" property="picturePathThree" />
  17. <result column="picture_path_four" property="picturePathFour" />
  18. <result column="picture_path_five" property="picturePathFive" />
  19. <result column="picture_path_six" property="picturePathSix" />
  20. <result column="creator" property="creator" />
  21. <result column="create_time" property="createTime" />
  22. <result column="status" property="status" />
  23. <result column="inspection_record_id" property="inspectionRecordId" />
  24. </resultMap>
  25. <select id="devopsWorkOrderList" resultType="com.bizmatics.model.vo.DevopsWorkOrderListVo">
  26. SELECT
  27. a.*,
  28. c.site_name
  29. FROM
  30. devops_work_order AS a
  31. JOIN site AS c ON a.site_id = c.id
  32. <where>
  33. a.status = 1
  34. <if test="generationMode != null and generationMode != 0">
  35. AND a.generation_mode = #{generationMode}
  36. </if>
  37. <if test="workOrderStatus != null and workOrderStatus != 0">
  38. AND a.work_order_status = #{siteId}
  39. </if>
  40. <if test="siteId != null and siteId !=0">
  41. AND a.site_id = #{siteId}
  42. </if>
  43. <if test="workOrderId != null and workOrderId.size() &gt; 0" >
  44. AND a.id IN
  45. <foreach item="item" collection="workOrderId" open="(" separator="," close=")">
  46. #{item.workOrderId}
  47. </foreach>
  48. </if>
  49. </where>
  50. ORDER BY
  51. a.id DESC
  52. <if test="startCurrent != null and current !=0">
  53. LIMIT #{startCurrent},
  54. #{current}
  55. </if>
  56. </select>
  57. <select id="patrolInspectorsVoList" resultType="com.bizmatics.model.vo.PatrolInspectorsVo">
  58. SELECT
  59. b.*,a.work_order_id
  60. FROM
  61. devops_order_inspectors AS a
  62. JOIN patrol_inspectors AS b ON a.inspectors_id = b.id
  63. <where>
  64. a.status = 1
  65. <if test="workOrderId != null and workOrderId != 0">
  66. and a.work_order_id = #{workOrderId}
  67. </if>
  68. </where>
  69. </select>
  70. <select id="patrolInspectionDeviceList" resultType="com.bizmatics.model.vo.PatrolInspectionDeviceDetailsVo">
  71. SELECT
  72. b.*, a.work_order_id
  73. FROM
  74. devops_order_device AS a
  75. JOIN patrol_inspection_device AS b ON a.inspection_device_id = b.id
  76. <where>
  77. a.status = 1
  78. <if test="workOrderId != null and workOrderId != 0">
  79. and a.work_order_id = #{workOrderId}
  80. </if>
  81. </where>
  82. </select>
  83. <select id="devopsWorkOrderDetails" resultType="com.bizmatics.model.vo.DevopsWorkOrderDetailsVo">
  84. SELECT
  85. a.*, b.team_name,
  86. c.site_name
  87. FROM
  88. devops_work_order AS a
  89. JOIN patrol_inspection_team AS b ON a.team_id = b.id
  90. JOIN site AS c ON a.site_id = c.id
  91. <where>
  92. a.status = 1
  93. <if test="id != null and id != 0">
  94. AND a.id = #{id}
  95. </if>
  96. </where>
  97. </select>
  98. <select id="patrolRouteContentList" resultType="com.bizmatics.model.vo.PatrolRouteContentListVo">
  99. SELECT
  100. a.*, c.inspection_content_name,d.inspection_device_name
  101. FROM
  102. patrol_route_content AS a
  103. JOIN patrol_inspection_route AS b ON a.inspection_route_id = b.id
  104. JOIN patrol_inspection_content AS c ON a.inspection_content_id = c.id
  105. join patrol_inspection_device as d on c.inspection_device_id=d.id
  106. <where>
  107. a.status = 1
  108. AND b.status = 1
  109. <if test="inspectionSchemeId != null and inspectionSchemeId != 0">
  110. AND b.inspection_scheme_id = #{inspectionSchemeId}
  111. </if>
  112. <if test="siteId != null and siteId != 0">
  113. and b.site_id = #{siteId}
  114. </if>
  115. </where>
  116. </select>
  117. <select id="patrolInspectorsOneVoList" resultType="com.bizmatics.model.vo.PatrolInspectorsOneVo">
  118. SELECT
  119. a.*, b.team_id
  120. FROM
  121. patrol_inspectors AS a
  122. JOIN patrol_team_inspection AS b ON a.id = b.inspectors_id
  123. </select>
  124. <select id="SiteList" resultType="com.bizmatics.model.Site">
  125. select s.id,s.site_name,s.site_address,s.company_code,s.user_name,s.phone,s.station_area_id,s.route_id,
  126. s.installed_capacity,s.rheological_change,s.longitude,s.latitude,s.region,s.create_time,s.creator,s.enable
  127. from user_site as us
  128. inner join site as s
  129. on us.site_id = s.id
  130. <where>
  131. <if test="userId != null and userId != 0">
  132. and us.user_id = #{userId}
  133. </if>
  134. <if test="name != null and name != ''">
  135. and s.site_name LIKE CONCAT(CONCAT('%', #{name}), '%')
  136. </if>
  137. </where>
  138. </select>
  139. <select id="workloadStatisticsLits" resultType="com.bizmatics.model.vo.ProcessingTime">
  140. SELECT
  141. a.id,
  142. a.inspectors_name,
  143. c.work_order_status,
  144. c.site_id,
  145. COUNT(c.id) as count,
  146. SUM(
  147. IF (
  148. c.work_order_status = 6,
  149. timestampdiff(HOUR, c.create_time, now()),
  150. 0
  151. )
  152. ) as processing_time
  153. FROM
  154. patrol_inspectors AS a
  155. JOIN devops_order_inspectors AS b ON a.id = b.inspectors_id
  156. JOIN devops_work_order AS c ON b.work_order_id = c.id
  157. <where>
  158. a.status = 1
  159. AND b.status = 1
  160. AND c.status = 1
  161. <if test="siteId != null and siteId != 0">
  162. AND c.site_id = #{siteId}
  163. </if>
  164. <if test="endTime != null and startTime != null">
  165. and c.create_time BETWEEN #{startTime} and #{endTime}
  166. </if>
  167. </where>
  168. GROUP BY
  169. a.id,
  170. c.site_id,
  171. c.work_order_status
  172. </select>
  173. </mapper>