视频查看量更新
This commit is contained in:
parent
c71a78d39a
commit
2d740c3879
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.learningresources.LearningResourcesDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.learningresources.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
@ -30,4 +31,7 @@ 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);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.llm.service.learningresources;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
@ -102,19 +104,6 @@ public class LearningResourcesServiceImpl implements LearningResourcesService {
|
||||
*/
|
||||
@Override
|
||||
public void videoViewsUpdate(LearningResourcesSaveReqVO updateReqVO) {
|
||||
if (updateReqVO == null) {
|
||||
throw new IllegalArgumentException("传入的LearningResourcesSaveReqVO对象不能为空");
|
||||
}
|
||||
|
||||
Integer downCount = updateReqVO.getDownCount();
|
||||
|
||||
// 如果downCount为空或者小于等于0,则将downCount设置为0
|
||||
if (downCount == null|| downCount < 0) {
|
||||
updateReqVO.setDownCount(0);
|
||||
}else {
|
||||
updateReqVO.setDownCount(downCount + 1);
|
||||
}
|
||||
|
||||
updateLearningResources(updateReqVO);
|
||||
learningResourcesMapper.videoViewsUpdate(updateReqVO.getId());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user