Commit 67f7ef9c by 阳浪

消息优化

parent 4640e7ae
......@@ -21,6 +21,10 @@ public interface EventTrackMapper extends BaseMapper<EventTrack> {
EventTrackDayNumVo getTodayNum(@Param("date") String date);
EventTrackDayNumVo getTodayNumByLogin(@Param("date") String date);
DayNumVo getNumByLogin(@Param("date") String date,@Param("dateString") String dateString);
DayNumVo getNumByType(@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types);
DayNumVo getTgNumByType(@Param("date") String date,@Param("dateString") String dateString);
......
......@@ -15,6 +15,7 @@
case when e.type in (11,12,13) and DATE_SUB(DATE_FORMAT(e.create_time, '%Y-%m-%d'), INTERVAL -1 DAY) = #{date} then 1 else 0 end as admirePreNum
from event_track e where e.deleted =0) a
</select>
<select id="queryNumByType" resultType="com.yizhi.site.application.vo.site.EventTrackTypeNumVo">
select
e.type,e.sub_type as subType,count(1) as num from event_track e
......@@ -99,10 +100,10 @@
DATE_SUB(DATE_FORMAT(e.create_time, '%Y-%m-%d'), INTERVAL -1 DAY) = #{dateString}
</if>
<if test="date==2">
DATE_FORMAT(DATE_SUB(DATE_FORMAT(now(), '%Y-%m-%d'), INTERVAL 1 MONTH),'%Y-%m') = #{dateString}
DATE_FORMAT(DATE_SUB(DATE_FORMAT(e.create_time, '%Y-%m-%d'), INTERVAL 1 MONTH),'%Y-%m') = #{dateString}
</if>
<if test="date==1">
DATE_FORMAT(DATE_SUB(DATE_FORMAT(now(), '%Y-%m-%d'), INTERVAL 1 YEAR),'%Y') = #{dateString}
DATE_FORMAT(DATE_SUB(DATE_FORMAT(e.create_time, '%Y-%m-%d'), INTERVAL 1 YEAR),'%Y') = #{dateString}
</if>
then 1 else
0 end as preNum from event_track e
......@@ -140,10 +141,10 @@
DATE_SUB(DATE_FORMAT(e.create_time, '%Y-%m-%d'), INTERVAL -1 DAY) = #{dateString}
</if>
<if test="date==2">
DATE_FORMAT(DATE_SUB(DATE_FORMAT(now(), '%Y-%m-%d'), INTERVAL 1 MONTH),'%Y-%m') = #{dateString}
DATE_FORMAT(DATE_SUB(DATE_FORMAT(e.create_time, '%Y-%m-%d'), INTERVAL 1 MONTH),'%Y-%m') = #{dateString}
</if>
<if test="date==1">
DATE_FORMAT(DATE_SUB(DATE_FORMAT(now(), '%Y-%m-%d'), INTERVAL 1 YEAR),'%Y') = #{dateString}
DATE_FORMAT(DATE_SUB(DATE_FORMAT(e.create_time, '%Y-%m-%d'), INTERVAL 1 YEAR),'%Y') = #{dateString}
</if>
then 1 else
0 end as preNum from publication e
......@@ -198,4 +199,45 @@
and state != 0
and DATE_FORMAT(create_time, '%Y') = #{year})
</select>
<select id="getTodayNumByLogin" resultType="com.yizhi.site.application.vo.site.EventTrackDayNumVo">
select sum(loginNum) loginNum,sum(loginPreNum) loginPreNum from (
SELECT count(distinct account_id) loginNum,0 loginPreNum FROM cloud_system.login_log where login_type =2
and DATE_FORMAT(login_date, '%Y-%m-%d') = #{date}
union all
SELECT 0 loginNum,count(distinct account_id) loginPreNum FROM cloud_system.login_log where login_type =2
and DATE_SUB(DATE_FORMAT(login_date, '%Y-%m-%d'), INTERVAL -1 DAY) = #{date}
) a
</select>
<select id="getNumByLogin" resultType="com.yizhi.site.application.vo.site.DayNumVo">
select sum(loginNum) num,sum(loginPreNum) preNum from (
SELECT count(distinct account_id) loginNum,0 loginPreNum FROM cloud_system.login_log where login_type =2
<if test="date==4">
and WEEK(login_date) = WEEK(now()) and DATE_FORMAT(login_date, '%Y') = DATE_FORMAT(now(), '%Y')
</if>
<if test="date==3">
and DATE_FORMAT(login_date, '%Y-%m-%d') = #{dateString}
</if>
<if test="date==2">
and DATE_FORMAT(login_date, '%Y-%m') = #{dateString}
</if>
<if test="date==1">
and DATE_FORMAT(login_date, '%Y') = #{dateString}
</if>
union all
SELECT 0 loginNum,count(distinct account_id) loginPreNum FROM cloud_system.login_log where login_type =2
and DATE_SUB(DATE_FORMAT(login_date, '%Y-%m-%d'), INTERVAL -1 DAY) = #{date}
<if test="date==4">
and WEEK(login_date) = WEEK(DATE_SUB(DATE_FORMAT(now(), '%Y-%m-%d'), INTERVAL 7 DAY)) and DATE_FORMAT(login_date, '%Y') = #{dateString}
</if>
<if test="date==3">
and DATE_SUB(DATE_FORMAT(login_date, '%Y-%m-%d'), INTERVAL -1 DAY) = #{dateString}
</if>
<if test="date==2">
and DATE_FORMAT(DATE_SUB(DATE_FORMAT(login_date, '%Y-%m-%d'), INTERVAL 1 MONTH),'%Y-%m') = #{dateString}
</if>
<if test="date==1">
and DATE_FORMAT(DATE_SUB(DATE_FORMAT(login_date, '%Y-%m-%d'), INTERVAL 1 YEAR),'%Y') = #{dateString}
</if>
) a
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment