视频查看量更新修改

This commit is contained in:
Liuyang 2025-01-13 12:59:46 +08:00
parent 2d740c3879
commit 3ac407d062
2 changed files with 13 additions and 3 deletions

View File

@ -32,6 +32,4 @@ public interface LearningResourcesMapper extends BaseMapperX<LearningResourcesDO
@Update("update llm_learning_resources set down_count = down_count + 1 where id = #{id}")
void updateDownCount(LearningResourcesDO learningResourcesDO);
@Update("update llm_learning_resources set down_count = down_count + 1 where id = #{id}")
void videoViewsUpdate(@Param("id") Long id);
}

View File

@ -104,6 +104,18 @@ public class LearningResourcesServiceImpl implements LearningResourcesService {
*/
@Override
public void videoViewsUpdate(LearningResourcesSaveReqVO updateReqVO) {
learningResourcesMapper.videoViewsUpdate(updateReqVO.getId());
Long id = updateReqVO.getId();
if (id == null) {
throw exception(LEARNING_RESOURCES_NOT_EXISTS);
}
// 校验存在
validateLearningResourcesExists(id);
// 更新
learningResourcesMapper.update(new UpdateWrapper<LearningResourcesDO>()
.setSql("down_count = down_count + 1")
.eq("id", id));
}
}