refactor(project): Reorganize frontend and backend directories

This commit is contained in:
2026-03-18 10:45:15 +08:00
parent cc9eaf4cdf
commit 92a139e470
513 changed files with 28251 additions and 287 deletions
@@ -0,0 +1,72 @@
<?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.RecommendUserBehaviorMapper">
<!-- 获取用户行为记录的视频ID列表 -->
<select id="selectUserBehaviorVideoIds" resultType="java.lang.Long">
SELECT DISTINCT video_id
FROM recommend_user_behavior
WHERE user_id = #{userId}
<if test="behaviorTypes != null and behaviorTypes.size > 0">
AND behavior_type IN
<foreach collection="behaviorTypes" item="type" open="(" separator="," close=")">
#{type}
</foreach>
</if>
ORDER BY create_time DESC
LIMIT #{limit}
</select>
<!-- 统计用户分类行为数量 -->
<select id="countUserCategoryBehaviors" resultType="java.util.Map">
SELECT c.category_id as categoryId, COUNT(1) as count
FROM recommend_user_behavior b
JOIN video_content.content_video v ON b.video_id = v.id
JOIN video_content.content_category c ON v.category_id = c.id
WHERE b.user_id = #{userId}
<if test="startTime != null">
AND b.create_time >= #{startTime}
</if>
GROUP BY c.category_id
</select>
<!-- 统计用户标签行为数量 -->
<select id="countUserTagBehaviors" resultType="java.util.Map">
SELECT vt.tag_id as tagId, COUNT(1) as count
FROM recommend_user_behavior b
JOIN video_content.content_video_tag vt ON b.video_id = vt.video_id
WHERE b.user_id = #{userId}
<if test="startTime != null">
AND b.create_time >= #{startTime}
</if>
GROUP BY vt.tag_id
</select>
<!-- 获取热门视频 -->
<select id="selectHotVideos" resultType="java.util.Map">
SELECT
video_id as videoId,
SUM(
CASE
<foreach collection="weights.entrySet()" item="entry">
WHEN behavior_type = #{entry.key} THEN behavior_weight * #{entry.value}
</foreach>
ELSE behavior_weight
END
) as score
FROM recommend_user_behavior
WHERE
<if test="startTime != null">
create_time >= #{startTime}
</if>
<if test="behaviorTypes != null and behaviorTypes.size > 0">
AND behavior_type IN
<foreach collection="behaviorTypes" item="type" open="(" separator="," close=")">
#{type}
</foreach>
</if>
GROUP BY video_id
ORDER BY score DESC
LIMIT #{limit}
</select>
</mapper>