123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.redxun.knowledge.analysis.mapper.AnalysisSynthesizeMapper">
- <select id="moduleUserVisits" resultType="com.redxun.knowledge.analysis.entity.vo.AlbumDetailVisitsVo">
- select MODULE as name, count (*) as value, round(count (*) / sum (count (*)) over (), 2) percentage
- from KM_PV_LOG
- group by MODULE
- </select>
- <select id="organizationVisits" resultType="com.redxun.knowledge.analysis.entity.vo.SynthesizeCompanyVo">
- select
- companyId as company,NVL(total.total, 0) as total,NVL(knowledge.knowledge, 0) as knowledge,NVL(map.map, 0) as map,
- NVL(album.album, 0) as album,NVL(search.search, 0) as search
- from (
- (select COMPANY_ID as companyId, count(*) total
- from KM_PV_LOG
- <where>
- <if test="firstDay != null and lastDay != null">
- TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') >= #{firstDay}
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') <= #{lastDay}
- </if>
- </where>
- group by COMPANY_ID) total
- full join
- (select COMPANY_ID as companyId, count(*) knowledge
- from KM_PV_LOG
- <where>
- MODULE = '知识仓库'
- <if test="firstDay != null and lastDay != null">
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') >= #{firstDay}
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') <= #{lastDay}
- </if>
- </where>
- group by COMPANY_ID) knowledge
- using (companyId)
- full join
- (select COMPANY_ID as companyId, count(*) map
- from KM_PV_LOG
- <where>
- MODULE = '知识地图'
- <if test="firstDay != null and lastDay != null">
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') >= #{firstDay}
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') <= #{lastDay}
- </if>
- </where>
- group by COMPANY_ID) map
- using (companyId)
- full join
- (select COMPANY_ID as companyId, count(*) album
- from KM_PV_LOG
- <where>
- MODULE = '知识专辑'
- <if test="firstDay != null and lastDay != null">
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') >= #{firstDay}
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') <= #{lastDay}
- </if>
- </where>
- group by COMPANY_ID) album
- using (companyId)
- full join
- (select COMPANY_ID as companyId, count(*) search
- from KM_PV_LOG
- <where>
- MODULE = '搜索服务'
- <if test="firstDay != null and lastDay != null">
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') >= #{firstDay}
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') <= #{lastDay}
- </if>
- </where>
- group by COMPANY_ID) search
- using (companyId)
- )
- <if test="sort == null">
- order by total desc
- </if>
- <if test="sort == 'totaldesc'">
- order by total desc
- </if>
- <if test="sort == 'totalasc'">
- order by total
- </if>
- <if test="sort == 'knowledgedesc'">
- order by knowledge desc
- </if>
- <if test="sort == 'knowledgeasc'">
- order by knowledge
- </if>
- <if test="sort == 'mapdesc'">
- order by map desc
- </if>
- <if test="sort == 'mapasc'">
- order by map
- </if>
- <if test="sort == 'albumdesc'">
- order by album desc
- </if>
- <if test="sort == 'albumasc'">
- order by album
- </if>
- <if test="sort == 'searchdesc'">
- order by search desc
- </if>
- <if test="sort == 'searchasc'">
- order by search
- </if>
- </select>
- </mapper>
|