Browse Source

统计

develop
wangsixiang 7 months ago
parent
commit
88bd49c1ff
  1. 31
      zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml

31
zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml

@ -185,13 +185,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteDcPublishManageById" parameterType="Long">
delete from dc_publish_manage where id = #{id}
</delete>
<delete id="deleteDcPublishManageEventId">
delete from dc_publish_manage where event_id = #{eventId}
</delete>
<delete id="deleteDcPublishManageByIds" parameterType="String">
delete from dc_publish_manage where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="statisticsPublishManage" resultType="java.util.HashMap">
SELECT
p.publish_channels publishChannels,
@ -248,4 +251,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) AS m ON h.hour = m.hour AND pc.publish_channels = m.publish_channels
ORDER BY h.hour, pc.publish_channels;
</select>
<select id="monthTrendsPublishManage" resultType="java.util.HashMap">
SELECT h.hour, pc.publish_channels, COALESCE(m.number, 0) AS number
FROM (
SELECT 0 AS hour UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL
SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL
SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL
SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL
SELECT 13 UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL
SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 UNION ALL
SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21 UNION ALL
SELECT 22 UNION ALL SELECT 23
) AS h
CROSS JOIN (
SELECT 1 AS publish_channels UNION ALL
SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7
) AS pc
LEFT JOIN (
SELECT HOUR(publish_time) AS hour, publish_channels, COUNT(*) AS number
FROM dc_publish_manage
WHERE YEAR(publish_time) = YEAR(CURDATE())
AND MONTH(publish_time) = MONTH(#{publishTime})
GROUP BY HOUR(publish_time), publish_channels
) AS m ON h.hour = m.hour AND pc.publish_channels = m.publish_channels
ORDER BY h.hour, pc.publish_channels;
</select>
</mapper>
Loading…
Cancel
Save