AnalysisCommonMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.AnalysisCommonMapper">
  4. <select id="knowledgeTotalAmount" resultType="int">
  5. select count(*) from KM_KNOWLEDGE where APPROVAL_STATUS = 5
  6. </select>
  7. <select id="mapTotalAmount" resultType="int">
  8. select count(*) from KM_MAP
  9. </select>
  10. <select id="albumTotalAmount" resultType="int">
  11. select count(distinct ALBUM_ID) from KM_ALBUM_VERSION where APPROVAL_STATE = 5
  12. </select>
  13. <select id="knowledgeTotalByType" resultType="int">
  14. select count(*)
  15. from KM_KNOWLEDGE
  16. where APPROVAL_STATUS = 5 and TYPE = #{type}
  17. </select>
  18. <select id="searchParticipleWordCloud"
  19. resultType="com.redxun.knowledge.analysis.entity.vo.SearchParticipleWordCloudVo">
  20. select PARTICIPLE as participle, count(PARTICIPLE) as frequency
  21. from KM_SEARCH_PARTICIPLE_LOG
  22. group by participle
  23. order by frequency desc
  24. </select>
  25. <select id="knowledgeTypeVisitProportion" resultType="string">
  26. select USSD from KM_PV_LOG
  27. <where>
  28. MODULE = '知识仓库' and SUB_MODULE = '详情'
  29. <if test="firstDay != null and lastDay != null">
  30. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  31. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  32. </if>
  33. </where>
  34. </select>
  35. <select id="level1Knowledge" resultType="string">
  36. select PK_ID
  37. from KM_KNOWLEDGE_CATEGORY
  38. where PARENT = '0' and IS_DEL = 0
  39. </select>
  40. <select id="level1KnowledgeHistogram" resultType="int">
  41. select type
  42. from KM_KNOWLEDGE
  43. <where>
  44. CATEGORY_ID IN (
  45. SELECT c.PK_ID FROM KM_KNOWLEDGE_CATEGORY c START WITH c.PK_ID = #{categoryId} CONNECT BY PRIOR c.PK_ID =
  46. c.PARENT
  47. )
  48. <if test="firstDay != null and lastDay != null">
  49. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  50. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  51. </if>
  52. and IS_DRAFT = 1
  53. </where>
  54. </select>
  55. <select id="selectCategoryName" resultType="string">
  56. select NAME from KM_KNOWLEDGE_CATEGORY where PK_ID = #{pkId}
  57. </select>
  58. <resultMap id="info" type="com.redxun.knowledge.analysis.entity.dao.KnowledgeDao">
  59. <result column="name" property="companyId"/>
  60. <collection property="counts" ofType="map">
  61. <result column="type" property="type"/>
  62. <result column="count" property="count"/>
  63. </collection>
  64. </resultMap>
  65. <select id="organizationKnowledges" resultMap="info">
  66. select NAME_ as name,count(*) as count,TYPE as type
  67. from KM_KNOWLEDGE ai
  68. join LEARNING_USER_DEV.OS_USER users on ai.CREATE_BY_ = users.USER_ID_
  69. join LEARNING_USER_DEV.OS_GROUP groups on users.COMPANY_ID_ = groups.GROUP_ID_
  70. <where>
  71. <if test="firstDay != null and lastDay != null">
  72. TO_CHAR(ai.CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  73. and TO_CHAR(ai.CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  74. </if>
  75. </where>
  76. group by users.COMPANY_ID_,TYPE,NAME_
  77. </select>
  78. <select id="organizationVisit" resultMap="info">
  79. select count(*) as count,TYPE as type
  80. from KM_KNOWLEDGE
  81. <where>
  82. <if test="organizationId != null">
  83. CREATE_DEP_ID_ in (
  84. select GROUP_ID_ from LEARNING_USER_DEV.OS_GROUP where GROUP_ID_ in(
  85. SELECT GROUP_ID_ FROM LEARNING_USER_DEV.OS_GROUP c
  86. START WITH c.GROUP_ID_ = #{organizationId} CONNECT BY PRIOR c.GROUP_ID_ = c.PARENT_ID_
  87. )
  88. )
  89. </if>
  90. <if test="firstDay != null and lastDay != null">
  91. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  92. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  93. </if>
  94. and IS_DRAFT = 1
  95. </where>
  96. group by TYPE
  97. </select>
  98. <select id="personKnowledgeValue" resultType="int">
  99. select type
  100. from KM_KNOWLEDGE
  101. <where>
  102. <if test="round == 1">
  103. CREATE_BY_ = #{id}
  104. </if>
  105. <if test="round == 2">
  106. CREATE_DEP_ID_ in (
  107. select GROUP_ID_ from LEARNING_USER_DEV.OS_GROUP where GROUP_ID_ in(
  108. SELECT GROUP_ID_ FROM LEARNING_USER_DEV.OS_GROUP c
  109. START WITH c.GROUP_ID_ = #{id} CONNECT BY PRIOR c.GROUP_ID_ = c.PARENT_ID_
  110. )
  111. )
  112. </if>
  113. <if test="firstDay != null and lastDay != null">
  114. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &gt;= #{firstDay}
  115. and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') &lt;= #{lastDay}
  116. </if>
  117. and IS_DRAFT = 1
  118. </where>
  119. </select>
  120. <select id="knowledgeSum" resultType="int">
  121. select count(*)
  122. from KM_KNOWLEDGE
  123. <where>
  124. APPROVAL_STATUS = 5
  125. <if test="userId != null">
  126. and CREATE_BY_ = #{userId}
  127. </if>
  128. </where>
  129. </select>
  130. <select id="yelpSum" resultType="int">
  131. select count(*)
  132. from KM_ALBUM_YELP
  133. <where>
  134. APPROVAL_STATE = 5
  135. <if test="userId != null">
  136. and CREATE_BY_ = #{userId}
  137. </if>
  138. </where>
  139. </select>
  140. </mapper>