TBProposalMapper.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.TBProposalMapper">
  4. <resultMap id="TBProposalMap" type="com.daju.mix.dao.entity.TBProposal"/>
  5. <resultMap id="AlarmCountDtoMap" type="com.daju.mix.dto.AlarmCountDto"/>
  6. <resultMap id="DbfDaysCountDtoMap" type="com.daju.mix.dto.DbfDaysCountDto"/>
  7. <resultMap id="ImprovmentSuggestDtoMap" type="com.daju.mix.dto.ImprovmentSuggestDto"/>
  8. <select id="selectAll" resultMap="TBProposalMap">
  9. select id,user,content from t_b_proposal
  10. </select>
  11. <!--查询 档案当日问题上报数量-->
  12. <select id="selectCountByArchivesId" resultType="int">
  13. select count(id)
  14. from t_b_proposal
  15. where DATEDIFF(now(),create_date) = 0
  16. and type = #{type}
  17. and archives_id = #{archivesId}
  18. </select>
  19. <!--查询 档案昨日日问题上报数量-->
  20. <select id="selectCountByArchivesIdYesterday" resultType="int">
  21. select count(id)
  22. from t_b_proposal
  23. where DATEDIFF(now(),create_date) = 1
  24. and type = #{type}
  25. and archives_id = #{archivesId}
  26. </select>
  27. <!-- 已处理问题量-->
  28. <select id="processedCount" resultType="int">
  29. select count(id) from t_b_proposal where state in (2,3,4) and type = #{type}
  30. </select>
  31. <!-- 中转点最近七日上报 已处理 数量列表-->
  32. <select id="dbfLastSevenDaysCounts" resultMap="DbfDaysCountDtoMap">
  33. select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as date, ifnull(b.count, 0) as issueCount,ifnull(c.count, 0) as processedIssueCount
  34. from (SELECT curdate() as timeDay
  35. union all
  36. SELECT date_sub(curdate(), interval 1 day) as timeDay
  37. union all
  38. SELECT date_sub(curdate(), interval 2 day) as timeDay
  39. union all
  40. SELECT date_sub(curdate(), interval 3 day) as timeDay
  41. union all
  42. SELECT date_sub(curdate(), interval 4 day) as timeDay
  43. union all
  44. SELECT date_sub(curdate(), interval 5 day) as timeDay
  45. union all
  46. SELECT date_sub(curdate(), interval 6 day) as timeDay) a
  47. left join (select date(create_date) as time, count(*) count
  48. from t_b_proposal
  49. where type = 5
  50. and archives_id = #{archiveId}
  51. group by date(create_date)) b on a.timeDay = b.time
  52. left join (select date(b.create_date) as time, count(*) count
  53. from t_b_proposal b
  54. left join p_projecttask a on a.id = b.project_task_id
  55. where type = 5
  56. and archives_id = #{archiveId}
  57. and taskstatus is not null
  58. and taskstatus != 0
  59. group by date(create_date)) c on a.timeDay = c.time
  60. order by date
  61. </select>
  62. </mapper>