This commit is contained in:
wangliwen 2022-06-10 09:27:00 +08:00
parent 18e27f3038
commit 8b295bcbcb
1 changed files with 1 additions and 1 deletions

View File

@ -241,7 +241,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public void updateVisits(Long id) {
ResourceEntity resourceEntity = resourceDao.selectById(id);
ResourceEntity entity = new ResourceEntity();
entity.setVisits(resourceEntity.getVisits() + 1);
entity.setVisits((resourceEntity.getVisits() == null ? 0 : resourceEntity.getVisits()) + 1);
UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda()
.eq(ResourceEntity::getId, resourceEntity.getId())