ReportOrderStatisticsServiceDaoImplMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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="reportOrderStatisticsServiceDaoImpl">
  6. <!-- 查询投诉单 -->
  7. <select id="getComplaintOrderCount" parameterType="Map" resultType="Map">
  8. select count(1) complaintCount
  9. from complaint t
  10. where 1=1
  11. and t.community_id = #{communityId}
  12. and t.create_time &gt; #{startDate}
  13. and t.create_time &lt; #{endDate}
  14. and t.status_cd = '0'
  15. </select>
  16. <!-- 查询未完成投诉单 -->
  17. <select id="getUndoComplaintOrderCount" parameterType="Map" resultType="Map">
  18. select count(1) complaintCount
  19. from complaint t
  20. where 1=1
  21. and t.community_id = #{communityId}
  22. and t.create_time &gt; #{startDate}
  23. and t.create_time &lt; #{endDate}
  24. and t.status_cd = '0'
  25. and t.state = '10001'
  26. </select>
  27. <!-- 查询已完成投诉单 -->
  28. <select id="getFinishComplaintOrderCount" parameterType="Map" resultType="Map">
  29. select count(1) complaintCount
  30. from complaint t
  31. where 1=1
  32. and t.community_id = #{communityId}
  33. and t.create_time &gt; #{startDate}
  34. and t.create_time &lt; #{endDate}
  35. and t.status_cd = '0'
  36. and t.state = '10002'
  37. </select>
  38. <!-- 查询报修单 -->
  39. <select id="getRepairOrderCount" parameterType="Map" resultType="Map">
  40. select count(1) repairCount
  41. from r_repair_pool t
  42. where 1=1
  43. and t.community_id = #{communityId}
  44. and t.create_time &gt; #{startDate}
  45. and t.create_time &lt; #{endDate}
  46. and t.status_cd = '0'
  47. </select>
  48. <!-- 查询未完成报修单 -->
  49. <select id="getUndoRepairOrderCount" parameterType="Map" resultType="Map">
  50. select count(1) repairCount
  51. from r_repair_pool t
  52. where 1=1
  53. and t.community_id = #{communityId}
  54. and t.create_time &gt; #{startDate}
  55. and t.create_time &lt; #{endDate}
  56. and t.status_cd = '0'
  57. and t.state in ('1000','1100','1200','1300','2001')
  58. </select>
  59. <!-- 查询已完成报修单 -->
  60. <select id="getFinishRepairOrderCount" parameterType="Map" resultType="Map">
  61. select count(1) repairCount
  62. from r_repair_pool t
  63. where 1=1
  64. and t.community_id = #{communityId}
  65. and t.create_time &gt; #{startDate}
  66. and t.create_time &lt; #{endDate}
  67. and t.status_cd = '0'
  68. and t.state in ('1700','1800','1900','2000','1400','1500')
  69. </select>
  70. <!-- 查询巡检单 -->
  71. <select id="getInspectionOrderCount" parameterType="Map" resultType="Map">
  72. select count(1) inspectionCount
  73. from inspection_task t
  74. where 1=1
  75. and t.community_id = #{communityId}
  76. and t.create_time &gt; #{startDate}
  77. and t.create_time &lt; #{endDate}
  78. and t.status_cd = '0'
  79. </select>
  80. <!-- 查询未完成巡检单 -->
  81. <select id="getUndoInspectionOrderCount" parameterType="Map" resultType="Map">
  82. select count(1) inspectionCount
  83. from inspection_task t
  84. where 1=1
  85. and t.community_id = #{communityId}
  86. and t.create_time &gt; #{startDate}
  87. and t.create_time &lt; #{endDate}
  88. and t.status_cd = '0'
  89. and t.state in ('20200405','20200406')
  90. </select>
  91. <!-- 查询已完成巡检单 -->
  92. <select id="getFinishInspectionOrderCount" parameterType="Map" resultType="Map">
  93. select count(1) inspectionCount
  94. from inspection_task t
  95. where 1=1
  96. and t.community_id = #{communityId}
  97. and t.create_time &gt; #{startDate}
  98. and t.create_time &lt; #{endDate}
  99. and t.status_cd = '0'
  100. and t.state = '20200407'
  101. </select>
  102. <!-- 查询保养单 -->
  103. <select id="getMaintainanceOrderCount" parameterType="Map" resultType="Map">
  104. select count(1) maintainanceCount
  105. from maintainance_task t
  106. where 1=1
  107. and t.community_id = #{communityId}
  108. and t.create_time &gt; #{startDate}
  109. and t.create_time &lt; #{endDate}
  110. and t.status_cd = '0'
  111. </select>
  112. <!-- 查询未完成保养单 -->
  113. <select id="getUndoMaintainanceOrderCount" parameterType="Map" resultType="Map">
  114. select count(1) maintainanceCount
  115. from maintainance_task t
  116. where 1=1
  117. and t.community_id = #{communityId}
  118. and t.create_time &gt; #{startDate}
  119. and t.create_time &lt; #{endDate}
  120. and t.status_cd = '0'
  121. and t.state in ('20200405','20200406')
  122. </select>
  123. <!-- 查询已完成保养单 -->
  124. <select id="getFinishMaintainanceOrderCount" parameterType="Map" resultType="Map">
  125. select count(1) maintainanceCount
  126. from maintainance_task t
  127. where 1=1
  128. and t.community_id = #{communityId}
  129. and t.create_time &gt; #{startDate}
  130. and t.create_time &lt; #{endDate}
  131. and t.status_cd = '0'
  132. and t.state = '20200407'
  133. </select>
  134. <!-- 查询保养单 -->
  135. <select id="getNotepadOrderCount" parameterType="Map" resultType="Map">
  136. select count(1) notepadCount
  137. from notepad t
  138. left join building_room br on t.room_id = br.room_id and br.status_cd = '0'
  139. where 1=1
  140. and br.community_id = #{communityId}
  141. and t.create_time &gt; #{startDate}
  142. and t.create_time &lt; #{endDate}
  143. and t.status_cd = '0'
  144. </select>
  145. <!-- 查询未完成保养单 -->
  146. <select id="getChargeMachineOrderCount" parameterType="Map" resultType="Map">
  147. select count(1) chargeMachineCount
  148. from charge_machine_order t
  149. where 1=1
  150. and t.community_id = #{communityId}
  151. and t.create_time &gt; #{startDate}
  152. and t.create_time &lt; #{endDate}
  153. and t.status_cd = '0'
  154. </select>
  155. <!-- 查询已完成保养单 -->
  156. <select id="getChargeMonthOrderCount" parameterType="Map" resultType="Map">
  157. select ifnull(sum(t.received_amount),0.0) chargeMonthMoney
  158. from charge_month_order t
  159. where 1=1
  160. and t.community_id = #{communityId}
  161. and t.create_time &gt; #{startDate}
  162. and t.create_time &lt; #{endDate}
  163. and t.status_cd = '0'
  164. </select>
  165. <select id="getOwnerReserveGoodsCount" parameterType="Map" resultType="Map">
  166. select count(1) count
  167. from (
  168. select t.owner_id,t.name,t.link,count(1) from building_owner t
  169. left join building_owner bom on t.owner_id = bom.owner_id and bom.status_cd = '0'
  170. left join reserve_goods_order rgo on (bom.link = rgo.person_tel or t.link = rgo.person_tel) and rgo.status_cd = '0'
  171. where t.owner_type_cd = '1001'
  172. and t.community_id = #{communityId}
  173. and t.create_time &gt; #{startDate}
  174. and t.create_time &lt; #{endDate}
  175. <if test="name !=null and name != ''">
  176. and t.name like concat('%',#{name},'%')
  177. </if>
  178. <if test="link !=null and link != ''">
  179. and t.link= #{link}
  180. </if>
  181. and t.status_cd = '0'
  182. group by t.owner_id,t.name,t.link
  183. HAVING count(1) > 0
  184. ) a
  185. </select>
  186. <select id="getOwnerReserveGoods" parameterType="Map" resultType="Map">
  187. select t.owner_id ownerId,t.name,t.link,count(1) frequency
  188. from building_owner t
  189. left join building_owner bom on t.owner_id = bom.owner_id and bom.status_cd = '0'
  190. left join reserve_goods_order rgo on (bom.link = rgo.person_tel or t.link = rgo.person_tel) and rgo.status_cd = '0'
  191. where t.owner_type_cd = '1001'
  192. and t.community_id = #{communityId}
  193. and t.create_time &gt; #{startDate}
  194. and t.create_time &lt; #{endDate}
  195. <if test="name !=null and name != ''">
  196. and t.name like concat('%',#{name},'%')
  197. </if>
  198. <if test="link !=null and link != ''">
  199. and t.link= #{link}
  200. </if>
  201. and t.status_cd = '0'
  202. group by t.owner_id,t.name,t.link
  203. HAVING count(1) > 0
  204. <if test="page != -1 and page != null ">
  205. limit #{page}, #{row}
  206. </if>
  207. </select>
  208. </mapper>