PProjecttaskMapper.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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.daju.mix.dao.mapper.PProjecttaskMapper">
  4. <resultMap id="DaysCountDtoMap" type="com.daju.mix.dto.DaysCountDto"/>
  5. <!-- 首页 查询最近7日已派工单数量-->
  6. <select id="selectSevenDaysCount" resultMap="DaysCountDtoMap">
  7. # SELECT DATE_FORMAT(planstarttime, '%Y-%m-%d') days,
  8. # count(*) count
  9. # FROM (SELECT *
  10. # FROM p_projecttask
  11. # WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> date(planstarttime)
  12. # and executer IS NOT NULL ) as a
  13. # GROUP BY days;
  14. select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as days, ifnull(b.count, 0) as count
  15. from (
  16. SELECT curdate() as timeDay
  17. union all
  18. SELECT date_sub(curdate(), interval 1 day) as timeDay
  19. union all
  20. SELECT date_sub(curdate(), interval 2 day) as timeDay
  21. union all
  22. SELECT date_sub(curdate(), interval 3 day) as timeDay
  23. union all
  24. SELECT date_sub(curdate(), interval 4 day) as timeDay
  25. union all
  26. SELECT date_sub(curdate(), interval 5 day) as timeDay
  27. union all
  28. SELECT date_sub(curdate(), interval 6 day) as timeDayA
  29. ) a
  30. left join (
  31. select date(planstarttime) as time, count(*) count
  32. from p_projecttask o
  33. where executer is not null
  34. group by date(o.planstarttime)
  35. ) b on a.timeDay = b.time
  36. order by days
  37. </select>
  38. <!-- 首页 最近7日催办单数量-->
  39. <select id="selectSevenDaysCountByIsUrge" resultMap="DaysCountDtoMap">
  40. # SELECT DATE_FORMAT(planstarttime, '%Y-%m-%d') days,
  41. # count(*) count
  42. # FROM (SELECT *
  43. # FROM p_projecttask
  44. # WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> date(planstarttime)
  45. # and executer IS NOT NULL
  46. # and isUrge = '1') as a
  47. # GROUP BY days;
  48. # select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as days, ifnull(b.count, 0) as count
  49. # from (
  50. # SELECT curdate() as timeDay
  51. # union all
  52. # SELECT date_sub(curdate(), interval 1 day) as timeDay
  53. # union all
  54. # SELECT date_sub(curdate(), interval 2 day) as timeDay
  55. # union all
  56. # SELECT date_sub(curdate(), interval 3 day) as timeDay
  57. # union all
  58. # SELECT date_sub(curdate(), interval 4 day) as timeDay
  59. # union all
  60. # SELECT date_sub(curdate(), interval 5 day) as timeDay
  61. # union all
  62. # SELECT date_sub(curdate(), interval 6 day) as timeDayA
  63. # ) a
  64. # left join (
  65. # select date(planstarttime) as time, count(*) count
  66. # from p_projecttask o
  67. # where executer is not null
  68. # and isUrge = '1'
  69. # group by date(o.planstarttime)
  70. # ) b on a.timeDay = b.time
  71. # order by days
  72. </select>
  73. <!-- 首页 最近7日预期单数量-->
  74. <select id="selectSevenDaysCountByIsOverdue" resultMap="DaysCountDtoMap">
  75. # SELECT DATE_FORMAT(planstarttime, '%Y-%m-%d') days,
  76. # count(*) count
  77. # FROM (SELECT *
  78. # FROM p_projecttask
  79. # WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> date(planstarttime)
  80. # and executer IS NOT NULL
  81. # and isOverdue = '1') as a
  82. # GROUP BY days;
  83. select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as days, ifnull(b.count, 0) as count
  84. from (
  85. SELECT curdate() as timeDay
  86. union all
  87. SELECT date_sub(curdate(), interval 1 day) as timeDay
  88. union all
  89. SELECT date_sub(curdate(), interval 2 day) as timeDay
  90. union all
  91. SELECT date_sub(curdate(), interval 3 day) as timeDay
  92. union all
  93. SELECT date_sub(curdate(), interval 4 day) as timeDay
  94. union all
  95. SELECT date_sub(curdate(), interval 5 day) as timeDay
  96. union all
  97. SELECT date_sub(curdate(), interval 6 day) as timeDayA
  98. ) a
  99. left join (
  100. select date(planendtime) as time, count(*) count
  101. from p_projecttask o
  102. where executer is not null
  103. and planendtime <![CDATA[ < ]]> now()
  104. and taskstatus <![CDATA[ <> ]]> 10
  105. and taskstatus <![CDATA[ <> ]]> 20
  106. group by date(o.planendtime)
  107. ) b on a.timeDay = b.time
  108. order by days
  109. </select>
  110. <resultMap id="WarningDetailDtoMap" type="com.daju.mix.dto.WarningDetailDto"/>
  111. <select id="indexWarningDetail" resultMap="WarningDetailDtoMap">
  112. select typename type, description content, address area, a.create_date time, a.alarm_level level, status,executer
  113. from t_s_type
  114. inner join (select b.id,
  115. alarm_type_id,
  116. alarm_type,
  117. b.description,
  118. address,
  119. b.create_date,
  120. alarm_level,
  121. status,
  122. executer
  123. from p_projecttask a
  124. left join t_b_car_alarm b on a.sourceid = b.id
  125. where b.id = #{id}) a
  126. where typegroupid = a.alarm_type
  127. and typecode = a.alarm_type_id;
  128. </select>
  129. <resultMap id="WarningDTO" type="com.daju.mix.dto.WarningDTO"/>
  130. <!-- 环境保洁预警-->
  131. <select id="environmentWarnings" resultMap="WarningDTO">
  132. select a.name,c.realname,a.taskstatus status ,alarm_type_id alarmTypeId,planendtime endTime
  133. from p_projecttask a
  134. left join t_b_car_alarm b on a.sourceid = b.id
  135. left join t_s_base_user c on a.executer = c.ID
  136. # where alarm_type_id in (71,72,73,74,75,76,77,20);
  137. where alarm_type_id in (71,73,74,75,76,77,20);
  138. </select>
  139. <select id="securityWarnings" resultMap="WarningDTO">
  140. select a.name,c.realname,a.taskstatus status ,alarm_type_id alarmTypeId,planendtime endTime
  141. from p_projecttask a
  142. left join t_b_car_alarm b on a.sourceid = b.id
  143. left join t_s_base_user c on a.executer = c.ID
  144. where alarm_type_id in (79);
  145. </select>
  146. </mapper>