AnalysisMapMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.AnalysisMapMapper">
  4. <select id="typeMapPie" resultType="com.redxun.knowledge.analysis.entity.vo.MapTypeCountVo">
  5. select type,count(*) maps,round(count(*) / sum(count(*)) over (),2) percentage from KM_MAP
  6. <where>
  7. <if test="firstDay != null and lastDay != null">
  8. TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  9. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  10. </if>
  11. </where>
  12. group by type
  13. </select>
  14. <select id="selectTypeName" resultType="string">
  15. select NAME_ as name
  16. FROM LEARNING_SYSTEM_DEV.SYS_DIC
  17. WHERE TREE_ID_ =
  18. (select TREE_ID_ from LEARNING_SYSTEM_DEV.SYS_TREE where ALIAS_ = 'KNOWLEDGE_MAP')
  19. and VALUE_ = #{type}
  20. </select>
  21. <select id="mapPageHistogram" resultType="com.redxun.knowledge.analysis.entity.vo.MapPagePvVo">
  22. select NAME as label, count(*) as pv
  23. from KM_PV_LOG pvlog
  24. join KM_MAP map
  25. on pvlog.USSD = map.PK_ID
  26. <where>
  27. MODULE = '知识地图' and SUB_MODULE = '详情'
  28. <if test="firstDay != null and lastDay != null">
  29. and TO_CHAR(pvlog.CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  30. and TO_CHAR(pvlog.CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  31. </if>
  32. </where>
  33. GROUP BY USSD,NAME
  34. ORDER BY pv desc
  35. </select>
  36. <select id="organizationMaps" resultType="com.redxun.knowledge.analysis.entity.vo.MapCompanyVo">
  37. select companyId as company, NVL(b.map,0) as map, NVL(a.pv,0) as pv
  38. from (
  39. (select COMPANY_ID as companyId, count(*) pv from KM_PV_LOG
  40. <where>
  41. MODULE = '知识地图'
  42. <if test="firstDay != null and lastDay != null">
  43. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  44. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  45. </if>
  46. </where>
  47. group by COMPANY_ID) a
  48. full join
  49. (select users.COMPANY_ID_ as companyId, count(*) map from KM_MAP map
  50. join LEARNING_USER_DEV.OS_USER users
  51. on map.CREATE_BY_ = users.USER_ID_
  52. <where>
  53. <if test="firstDay != null and lastDay != null">
  54. and TO_CHAR(map.CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  55. and TO_CHAR(map.CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  56. </if>
  57. </where>
  58. group by users.COMPANY_ID_) b
  59. using (companyId)
  60. )
  61. order by map desc
  62. </select>
  63. <select id="mapAmount" resultType="com.redxun.knowledge.analysis.entity.vo.CreateCountLabel">
  64. select
  65. <if test="firstDay == null and lastDay == null">
  66. concat(concat(substr(to_char(CREATE_TIME_,'yyyy-mm'),1,instr(to_char(CREATE_TIME_,'yyyy-mm'),'-',-1) -
  67. 1),'年'),
  68. concat(ltrim(SUBSTR( to_char(CREATE_TIME_,'yyyy-mm'), INSTR( to_char(CREATE_TIME_,'yyyy-mm'), '-', 1 ) + 1
  69. ),'0'),'月')) name
  70. </if>
  71. <if test="firstDay != null and lastDay != null">
  72. concat(ltrim(to_char(CREATE_TIME_,'mm'),'0'),'月') name
  73. </if>
  74. ,count(*) value from KM_MAP
  75. <where>
  76. <if test="firstDay != null and lastDay != null">
  77. TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  78. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  79. </if>
  80. </where>
  81. <if test="firstDay == null and lastDay == null">
  82. group by to_char(CREATE_TIME_,'yyyy-mm')
  83. order by to_char(CREATE_TIME_,'yyyy-mm')
  84. </if>
  85. <if test="firstDay != null and lastDay != null">
  86. group by to_char(CREATE_TIME_,'mm')
  87. order by to_char(CREATE_TIME_,'mm')
  88. </if>
  89. </select>
  90. </mapper>