|
@@ -50,23 +50,58 @@
|
|
|
#{updateTime})
|
|
|
</insert>
|
|
|
|
|
|
- <select id="selectYearTotal" resultType="int">
|
|
|
- select count(*) from KM_PV_LOG
|
|
|
- where
|
|
|
- TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') >= #{firstYearDate}
|
|
|
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') <= #{lastYearDate}
|
|
|
- </select>
|
|
|
+ <resultMap id="searchVisitHistogram" type="com.redxun.knowledge.analysis.entity.vo.SearchVisitHistogramVo">
|
|
|
+ <result column="total" property="total"/>
|
|
|
+ <collection property="lables" resultMap="lablesVo"/>
|
|
|
+ </resultMap>
|
|
|
|
|
|
- <select id="selectSearchVisitHistogramByMonth" resultType="int">
|
|
|
- select count(*)
|
|
|
+ <resultMap id="lablesVo" type="com.redxun.knowledge.analysis.entity.vo.LablesVo">
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <collection property="values" ofType="map">
|
|
|
+ <result column="legend" property="legend"/>
|
|
|
+ <result column="value" property="value"/>
|
|
|
+ <result column="percentage" property="percentage"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+ <select id="searchVisitHistogram" resultMap="searchVisitHistogram">
|
|
|
+ select nvl(value,0) value , s2.name, s2.legend, nvl(percentage,0.00) percentage,sum(value) over () total
|
|
|
+ from (
|
|
|
+ select value, concat(ltrim(to_char(dates, 'mm'), '0'), '月') name, legend, percentage
|
|
|
+ from (
|
|
|
+ select nvl(value, 0) value, to_date(monthlist, 'yyyy-mm') dates, legend, percentage
|
|
|
+ from (
|
|
|
+ select count(*) value,
|
|
|
+ round(count(*) / sum(count(*)) over (partition by to_char(CREATE_TIME_, 'yyyy-mm')),
|
|
|
+ 2) percentage,
|
|
|
+ to_char(CREATE_TIME_, 'yyyy-mm') name,
|
|
|
+ PLATFORM legend
|
|
|
from KM_PV_LOG
|
|
|
- <where>
|
|
|
- TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') >= #{firstOfMonth}
|
|
|
- and TO_CHAR(CREATE_TIME_,'yyyy-mm-dd') <= #{lastOfMonth}
|
|
|
- <if test="platform != null">
|
|
|
- and PLATFORM = #{platform}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ where to_char(CREATE_TIME_, 'yyyy-mm') <= #{lastDay}
|
|
|
+ and to_char(CREATE_TIME_, 'yyyy-mm') >= #{firstDay}
|
|
|
+ group by to_char(CREATE_TIME_, 'yyyy-mm'), PLATFORM
|
|
|
+ ) t1
|
|
|
+ right join (SELECT TO_CHAR(ADD_MONTHS(TO_DATE(#{firstDay}, 'yyyy-MM'), ROWNUM - 1),
|
|
|
+ 'yyyy-MM') as monthlist
|
|
|
+ FROM DUAL
|
|
|
+ CONNECT BY ROWNUM <=
|
|
|
+ months_between(to_date(#{lastDay}, 'yyyy-MM'),
|
|
|
+ to_date(#{firstDay}, 'yyyy-MM')) + 1) t2
|
|
|
+ on t1.name = t2.monthlist
|
|
|
+ order by dates)) s1
|
|
|
+ right join (
|
|
|
+ select concat(ltrim(to_char(monthlist, 'mm'), '0'), '月') name, legend,monthlist
|
|
|
+ from (
|
|
|
+ SELECT ADD_MONTHS(TO_DATE(#{firstDay}, 'yyyy-MM'), ROWNUM - 1) as monthlist
|
|
|
+ FROM DUAL
|
|
|
+ CONNECT BY ROWNUM <=
|
|
|
+ months_between(to_date(#{lastDay}, 'yyyy-MM'),
|
|
|
+ to_date(#{firstDay}, 'yyyy-MM')) + 1 order by monthlist),
|
|
|
+ (SELECT dic.NAME_ legend,
|
|
|
+ dic.VALUE_ legendValue
|
|
|
+ FROM LEARNING_SYSTEM_DEV.SYS_TREE tree
|
|
|
+ INNER JOIN LEARNING_SYSTEM_DEV.SYS_DIC dic ON tree.TREE_ID_ = dic.TREE_ID_
|
|
|
+ WHERE ALIAS_ = 'KNOWLEDGE_PLATFORM') order by monthlist
|
|
|
+ ) s2 on s1.name = s2.name and s1.legend = s2.legend order by s2.monthlist
|
|
|
</select>
|
|
|
|
|
|
<select id="albumDetailVisits" resultType="com.redxun.knowledge.analysis.entity.vo.AlbumDetailVisitsVo">
|