123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?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.AnalysisMapMapper">
- <select id="typeMapPie" resultType="com.redxun.knowledge.analysis.entity.vo.MapTypeCountVo">
- select type,count(*) maps,round(count(*) / sum(count(*)) over (),2) percentage from KM_MAP
- <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 type
- </select>
- <select id="selectTypeName" resultType="string">
- select NAME_ as name
- FROM LEARNING_SYSTEM_DEV.SYS_DIC
- WHERE TREE_ID_ =
- (select TREE_ID_ from LEARNING_SYSTEM_DEV.SYS_TREE where ALIAS_ = 'KNOWLEDGE_MAP')
- and VALUE_ = #{type}
- </select>
- <select id="mapPageHistogram" resultType="com.redxun.knowledge.analysis.entity.vo.MapPagePvVo">
- select NAME as label, count(*) as pv
- from KM_PV_LOG pvlog
- join KM_MAP map
- on pvlog.USSD = map.PK_ID
- <where>
- MODULE = '知识地图' and SUB_MODULE = '详情'
- <if test="firstDay != null and lastDay != null">
- and TO_CHAR(pvlog.CREATE_TIME_,'yyyy-mm-dd') >= #{firstDay}
- and TO_CHAR(pvlog.CREATE_TIME_,'yyyy-mm-dd') <= #{lastDay}
- </if>
- </where>
- GROUP BY USSD,NAME
- ORDER BY pv desc
- </select>
- <select id="organizationMaps" resultType="com.redxun.knowledge.analysis.entity.vo.MapCompanyVo">
- select companyId as company, NVL(b.map,0) as map, NVL(a.pv,0) as pv
- from (
- (select COMPANY_ID as companyId, count(*) pv 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) a
- full join
- (select users.COMPANY_ID_ as companyId, count(*) map from KM_MAP map
- join LEARNING_USER_DEV.OS_USER users
- on map.CREATE_BY_ = users.USER_ID_
- <where>
- <if test="firstDay != null and lastDay != null">
- and TO_CHAR(map.CREATE_TIME_,'yyyy-mm-dd') >= #{firstDay}
- and TO_CHAR(map.CREATE_TIME_,'yyyy-mm-dd') <= #{lastDay}
- </if>
- </where>
- group by users.COMPANY_ID_) b
- using (companyId)
- )
- order by map desc
- </select>
- <select id="mapAmount" resultType="com.redxun.knowledge.analysis.entity.vo.CreateCountLabel">
- select
- <if test="firstDay == null and lastDay == null">
- concat(concat(substr(to_char(CREATE_TIME_,'yyyy-mm'),1,instr(to_char(CREATE_TIME_,'yyyy-mm'),'-',-1) -
- 1),'年'),
- concat(ltrim(SUBSTR( to_char(CREATE_TIME_,'yyyy-mm'), INSTR( to_char(CREATE_TIME_,'yyyy-mm'), '-', 1 ) + 1
- ),'0'),'月')) name
- </if>
- <if test="firstDay != null and lastDay != null">
- concat(ltrim(to_char(CREATE_TIME_,'mm'),'0'),'月') name
- </if>
- ,count(*) value from KM_MAP
- <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>
- <if test="firstDay == null and lastDay == null">
- group by to_char(CREATE_TIME_,'yyyy-mm')
- order by to_char(CREATE_TIME_,'yyyy-mm')
- </if>
- <if test="firstDay != null and lastDay != null">
- group by to_char(CREATE_TIME_,'mm')
- order by to_char(CREATE_TIME_,'mm')
- </if>
- </select>
- </mapper>
|