DefectManageMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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.welampiot.dao.DefectManageDao">
  4. <insert id="addDefectManage" keyProperty="id" useGeneratedKeys="true" parameterType="DefectManageDTO">
  5. insert into defect_manage(open_time, location, dev_type, dev_name, script, create_time, `level`, user_id, longitude, latitude, sectionid)
  6. values (#{openTime},#{location},#{devType},#{devName},#{script},#{createTime},#{level},#{userid},#{longitude},#{latitude},#{sectionId})
  7. </insert>
  8. <update id="updateDefectManage" parameterType="DefectManageDTO">
  9. update defect_manage d
  10. set
  11. d.open_time = #{openTime},
  12. d.location = #{location},
  13. d.dev_type = #{devType},
  14. d.dev_name = #{devName},
  15. d.script = #{script},
  16. d.create_time = #{createTime},
  17. d.level = #{level},
  18. d.user_id = #{userid},
  19. d.longitude = #{longitude},
  20. d.latitude = #{latitude},
  21. d.sectionId = #{sectionId}
  22. where d.id = #{id}
  23. </update>
  24. <!-- 更新工单状态 -->
  25. <update id="updateDefectManageStatus" parameterType="DefectManageDTO">
  26. update defect_manage d
  27. set
  28. d.status = #{status}
  29. where d.id = #{id}
  30. </update>
  31. <select id="getUseridById" resultType="Integer">
  32. select d.user_id as userid
  33. from defect_manage d
  34. where d.id = #{id}
  35. </select>
  36. <select id="getDefectManageListByVO" resultType="DefectManageDTO" parameterType="DefectManageVO">
  37. select d.id,d.number,d.open_time openTime,d.script,d.location,d.status,
  38. d.level,d.work_name as workName
  39. from defect_manage d
  40. left join defect_manage_file dmf on d.id = dmf.defect_manage_id
  41. left join section s on d.sectionId = s.id
  42. left join global_location gl on s.pid = gl.id
  43. left join global_location gl1 on gl.pid = gl1.id
  44. left join global_location gl2 on gl1.pid = gl2.id
  45. where 1=1
  46. <if test="sectionList != null and !sectionList.isEmpty()">
  47. and d.sectionId in
  48. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  49. #{item}
  50. </foreach>
  51. </if>
  52. <if test="sectionId != null and sectionId != 0">
  53. and s.id = #{sectionId}
  54. </if>
  55. <if test="areaId != null and areaId != 0">
  56. and gl.id = #{areaId}
  57. </if>
  58. <if test="cityId != null and cityId != 0">
  59. and gl1.id = #{cityId}
  60. </if>
  61. <if test="provinceId != null and provinceId != 0">
  62. and gl2.id = #{provinceId}
  63. </if>
  64. <if test="keyword != null and keyword != ''">
  65. and d.number like '%${keyword}%'
  66. </if>
  67. <choose>
  68. <when test="status == 4">
  69. and d.status = 4
  70. </when>
  71. <when test="status == 3">
  72. and d.status = 3
  73. </when>
  74. <when test="status == 2">
  75. and d.status = 2
  76. </when>
  77. <when test="status == 1">
  78. and d.status = 1
  79. </when>
  80. <otherwise>
  81. and d.status = 0
  82. </otherwise>
  83. </choose>
  84. <if test="page >= 0 and count > 0">
  85. limit #{page},#{count}
  86. </if>
  87. </select>
  88. <!-- 总数 -->
  89. <select id="getDefectManageTotal" resultType="Integer" parameterType="DefectManageVO">
  90. select count(d.id) as total
  91. from defect_manage d
  92. left join section s on d.sectionId = s.id
  93. left join global_location gl on s.pid = gl.id
  94. left join global_location gl1 on gl.pid = gl1.id
  95. left join global_location gl2 on gl1.pid = gl2.id
  96. <if test="sectionList != null and !sectionList.isEmpty()">
  97. where d.sectionId in
  98. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  99. #{item}
  100. </foreach>
  101. </if>
  102. </select>
  103. <!-- 未派发数 -->
  104. <select id="getDefectManageTotal2" resultType="Integer" parameterType="DefectManageVO">
  105. select count(d.id) as total
  106. from defect_manage d
  107. left join section s on d.sectionId = s.id
  108. left join global_location gl on s.pid = gl.id
  109. left join global_location gl1 on gl.pid = gl1.id
  110. left join global_location gl2 on gl1.pid = gl2.id
  111. where d.status = 0
  112. <if test="sectionList != null and !sectionList.isEmpty()">
  113. and d.sectionId in
  114. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  115. #{item}
  116. </foreach>
  117. </if>
  118. </select>
  119. <!-- 处理中数 -->
  120. <select id="getDefectManageTotal3" resultType="Integer" parameterType="DefectManageVO">
  121. select count(d.id) as total
  122. from defect_manage d
  123. left join section s on d.sectionId = s.id
  124. left join global_location gl on s.pid = gl.id
  125. left join global_location gl1 on gl.pid = gl1.id
  126. left join global_location gl2 on gl1.pid = gl2.id
  127. where d.status = 1
  128. <if test="sectionList != null and !sectionList.isEmpty()">
  129. and d.sectionId in
  130. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  131. #{item}
  132. </foreach>
  133. </if>
  134. </select>
  135. <!-- 复核数 -->
  136. <select id="getDefectManageTotal4" resultType="Integer" parameterType="DefectManageVO">
  137. select count(d.id) as total
  138. from defect_manage d
  139. left join section s on d.sectionId = s.id
  140. left join global_location gl on s.pid = gl.id
  141. left join global_location gl1 on gl.pid = gl1.id
  142. left join global_location gl2 on gl1.pid = gl2.id
  143. where d.status = 2
  144. <if test="sectionList != null and !sectionList.isEmpty()">
  145. and d.sectionId in
  146. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  147. #{item}
  148. </foreach>
  149. </if>
  150. </select>
  151. <!-- 结案数 -->
  152. <select id="getDefectManageTotal5" resultType="Integer" parameterType="DefectManageVO">
  153. select count(d.id) as total
  154. from defect_manage d
  155. left join section s on d.sectionId = s.id
  156. left join global_location gl on s.pid = gl.id
  157. left join global_location gl1 on gl.pid = gl1.id
  158. left join global_location gl2 on gl1.pid = gl2.id
  159. where d.status = 3
  160. <if test="sectionList != null and !sectionList.isEmpty()">
  161. and d.sectionId in
  162. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  163. #{item}
  164. </foreach>
  165. </if>
  166. </select>
  167. <!-- 归档数 -->
  168. <select id="getDefectManageTotal6" resultType="Integer" parameterType="DefectManageVO">
  169. select count(d.id) as total
  170. from defect_manage d
  171. left join section s on d.sectionId = s.id
  172. left join global_location gl on s.pid = gl.id
  173. left join global_location gl1 on gl.pid = gl1.id
  174. left join global_location gl2 on gl1.pid = gl2.id
  175. where d.status = 4
  176. <if test="sectionList != null and !sectionList.isEmpty()">
  177. and d.sectionId in
  178. <foreach collection="sectionList" item="item" open="(" separator="," close=")">
  179. #{item}
  180. </foreach>
  181. </if>
  182. </select>
  183. <!-- 工单详情 -->
  184. <select id="getDefectManageInfoById" resultType="DefectManageDTO">
  185. select d.id,d.number,d.open_time openTime,d.script,
  186. d.level,d.location,d.longitude,d.latitude
  187. from defect_manage d
  188. where d.id = #{id}
  189. </select>
  190. </mapper>