fix:修复点赞取消点赞产生脏数据Bug
This commit is contained in:
+8
-3
@@ -10,6 +10,7 @@ import com.adc.da.report.vo.ReportDetailThumbUpVo;
|
|||||||
import com.adc.da.report.vo.ReportLogPageVO;
|
import com.adc.da.report.vo.ReportLogPageVO;
|
||||||
import com.adc.da.util.utils.StringUtils;
|
import com.adc.da.util.utils.StringUtils;
|
||||||
import com.adc.da.util.utils.UUID;
|
import com.adc.da.util.utils.UUID;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -167,8 +168,12 @@ public class IReportLogBookServiceImpl extends ServiceImpl<ReportLogBookDao, Rep
|
|||||||
return reportLogBook.getId();
|
return reportLogBook.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void thumbDown(String logId) {
|
private void thumbDown(String reportId) {
|
||||||
removeById(logId);
|
LambdaQueryWrapper<ReportLogBook> reportLogBookLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getReportId, reportId);
|
||||||
|
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getType, 3);
|
||||||
|
reportLogBookLambdaQueryWrapper.eq(ReportLogBook::getUserId, UserUtils.getUserId());
|
||||||
|
remove(reportLogBookLambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -179,7 +184,7 @@ public class IReportLogBookServiceImpl extends ServiceImpl<ReportLogBookDao, Rep
|
|||||||
String logId = thumbUp(reportId);
|
String logId = thumbUp(reportId);
|
||||||
reportDetailThumbUpVo.setLogId(logId);
|
reportDetailThumbUpVo.setLogId(logId);
|
||||||
} else {
|
} else {
|
||||||
thumbDown(entity.getId());
|
thumbDown(reportId);
|
||||||
}
|
}
|
||||||
//计算已有点赞数
|
//计算已有点赞数
|
||||||
Integer count = getThumbUpCount(reportId);
|
Integer count = getThumbUpCount(reportId);
|
||||||
|
|||||||
Reference in New Issue
Block a user