AnalysisSynthesizeMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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.redxun.knowledge.analysis.mapper.AnalysisSynthesizeMapper">
  4. <select id="moduleUserVisits" resultType="com.redxun.knowledge.analysis.entity.vo.AlbumDetailVisitsVo">
  5. select MODULE as name, count (*) as value, round(count (*) / sum (count (*)) over (), 2) percentage
  6. from KM_PV_LOG
  7. group by MODULE
  8. </select>
  9. <select id="organizationVisits" resultType="com.redxun.knowledge.analysis.entity.vo.SynthesizeCompanyVo">
  10. select
  11. companyId as company,NVL(total.total, 0) as total,NVL(knowledge.knowledge, 0) as knowledge,NVL(map.map, 0) as map,
  12. NVL(album.album, 0) as album,NVL(search.search, 0) as search
  13. from (
  14. (select COMPANY_ID as companyId, count(*) total
  15. from KM_PV_LOG
  16. <where>
  17. <if test="firstDay != null and lastDay != null">
  18. TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  19. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  20. </if>
  21. </where>
  22. group by COMPANY_ID) total
  23. full join
  24. (select COMPANY_ID as companyId, count(*) knowledge
  25. from KM_PV_LOG
  26. <where>
  27. MODULE = '知识仓库'
  28. <if test="firstDay != null and lastDay != null">
  29. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  30. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  31. </if>
  32. </where>
  33. group by COMPANY_ID) knowledge
  34. using (companyId)
  35. full join
  36. (select COMPANY_ID as companyId, count(*) map
  37. from KM_PV_LOG
  38. <where>
  39. MODULE = '知识地图'
  40. <if test="firstDay != null and lastDay != null">
  41. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  42. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  43. </if>
  44. </where>
  45. group by COMPANY_ID) map
  46. using (companyId)
  47. full join
  48. (select COMPANY_ID as companyId, count(*) album
  49. from KM_PV_LOG
  50. <where>
  51. MODULE = '知识专辑'
  52. <if test="firstDay != null and lastDay != null">
  53. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  54. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  55. </if>
  56. </where>
  57. group by COMPANY_ID) album
  58. using (companyId)
  59. full join
  60. (select COMPANY_ID as companyId, count(*) search
  61. from KM_PV_LOG
  62. <where>
  63. MODULE = '搜索服务'
  64. <if test="firstDay != null and lastDay != null">
  65. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  66. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  67. </if>
  68. </where>
  69. group by COMPANY_ID) search
  70. using (companyId)
  71. )
  72. <if test="sort == null">
  73. order by total desc
  74. </if>
  75. <if test="sort == 'totaldesc'">
  76. order by total desc
  77. </if>
  78. <if test="sort == 'totalasc'">
  79. order by total
  80. </if>
  81. <if test="sort == 'knowledgedesc'">
  82. order by knowledge desc
  83. </if>
  84. <if test="sort == 'knowledgeasc'">
  85. order by knowledge
  86. </if>
  87. <if test="sort == 'mapdesc'">
  88. order by map desc
  89. </if>
  90. <if test="sort == 'mapasc'">
  91. order by map
  92. </if>
  93. <if test="sort == 'albumdesc'">
  94. order by album desc
  95. </if>
  96. <if test="sort == 'albumasc'">
  97. order by album
  98. </if>
  99. <if test="sort == 'searchdesc'">
  100. order by search desc
  101. </if>
  102. <if test="sort == 'searchasc'">
  103. order by search
  104. </if>
  105. </select>
  106. </mapper>