|
@@ -1,7 +1,6 @@
|
|
|
package com.chelvc.cloud.vehicle.server.service.impl;
|
|
|
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
-import com.baomidou.lock.annotation.Lock4j;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -310,12 +309,10 @@ public class DynamicContentServiceImpl implements DynamicContentService, com.che
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void deleteByIds(Long id, Long userId) {
|
|
|
- DynamicContent DynamicContent = baseMapper.selectById(id);
|
|
|
- if (DynamicContent == null || userId == null ||
|
|
|
- !DynamicContent.getUserId().equals(userId)) {
|
|
|
- throw new ResourceUnavailableException("动态删除失败");
|
|
|
- }
|
|
|
- boolean b = baseMapper.deleteById(id) > 0;
|
|
|
+ LambdaQueryWrapper<DynamicContent> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(DynamicContent::getId, id);
|
|
|
+ wrapper.eq(DynamicContent::getUserId, userId);
|
|
|
+ boolean b = baseMapper.delete(wrapper) > 0;
|
|
|
if (!b) {
|
|
|
throw new ResourceUnavailableException("动态删除失败");
|
|
|
}
|
|
@@ -326,7 +323,6 @@ public class DynamicContentServiceImpl implements DynamicContentService, com.che
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Lock4j(keys = {"#dynamicId"})
|
|
|
public void addComment(Long dynamicId) {
|
|
|
int i = baseMapper.addComment(dynamicId);
|
|
|
if (i != 1) {
|
|
@@ -335,7 +331,6 @@ public class DynamicContentServiceImpl implements DynamicContentService, com.che
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Lock4j(keys = {"#dynamicId"})
|
|
|
public void reduceComment(Long dynamicId, int num) {
|
|
|
int i = baseMapper.reduceComment(dynamicId, num);
|
|
|
if (i != 1) {
|
|
@@ -344,7 +339,6 @@ public class DynamicContentServiceImpl implements DynamicContentService, com.che
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Lock4j(keys = {"#contentId"})
|
|
|
public void addNum(Integer dynamicStatus, Long contentId) {
|
|
|
if (Objects.equals(DynamicStatusType.GOOD.getValue(), dynamicStatus)) {
|
|
|
int i = baseMapper.addGoodNum(contentId);
|
|
@@ -360,7 +354,6 @@ public class DynamicContentServiceImpl implements DynamicContentService, com.che
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Lock4j(keys = {"#contentId"})
|
|
|
public void reduceNum(Integer dynamicStatus, Long contentId) {
|
|
|
if (Objects.equals(DynamicStatusType.GOOD.getValue(), dynamicStatus)) {
|
|
|
int i = baseMapper.reduceGoodNum(contentId);
|