34 lines
1.2 KiB
XML
34 lines
1.2 KiB
XML
<?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.nuaa.video.recommend.mapper.RecommendHotVideoMapper">
|
|
|
|
<!-- 获取热门视频ID列表 -->
|
|
<select id="selectHotVideoIds" resultType="java.lang.Long">
|
|
SELECT video_id
|
|
FROM recommend_hot_video
|
|
WHERE period_type = #{periodType}
|
|
ORDER BY hot_score DESC
|
|
LIMIT #{limit}
|
|
</select>
|
|
|
|
<!-- 批量插入热门视频 -->
|
|
<insert id="batchInsert">
|
|
INSERT INTO recommend_hot_video (
|
|
video_id, hot_score, period_type,
|
|
created_by, updated_by, create_time, update_time
|
|
)
|
|
VALUES
|
|
<foreach collection="hotVideos" item="item" separator=",">
|
|
(
|
|
#{item.videoId}, #{item.hotScore}, #{item.periodType},
|
|
#{item.createdBy}, #{item.updatedBy}, NOW(), NOW()
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 删除指定周期的热门视频 -->
|
|
<delete id="deleteByPeriodType">
|
|
DELETE FROM recommend_hot_video
|
|
WHERE period_type = #{periodType}
|
|
</delete>
|
|
</mapper> |