修改了病例交流的物理删除

This commit is contained in:
wucongxing8150 2025-08-12 16:45:14 +08:00
parent 7c91ce170f
commit dc2b451911

View File

@ -21,10 +21,7 @@ import net.lab1024.sa.admin.module.business.caseExchange.dao.CaseExchangeDao;
import net.lab1024.sa.admin.module.business.caseExchange.dao.CaseExchangeLabelDao;
import net.lab1024.sa.admin.module.business.caseExchange.dao.StatsCaseExchangeDao;
import net.lab1024.sa.admin.module.business.caseExchange.dao.StatsCaseExchangeUserDao;
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.CaseExchangeEntity;
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.CaseExchangeLabelEntity;
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.StatsCaseExchangeEntity;
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.StatsCaseExchangeUserEntity;
import net.lab1024.sa.admin.module.business.caseExchange.domain.entity.*;
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeAddForm;
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeQueryForm;
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.CaseExchangeUpdateForm;
@ -46,6 +43,7 @@ import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
/**
* 病例库-病例交流 Service
@ -213,7 +211,22 @@ public class CaseExchangeService {
return ResponseDTO.ok();
}
caseExchangeDao.deleteBatchIds(idList);
for (Long id : idList){
// 获取评论数据
CaseExchangeEntity caseExchange = caseExchangeDao.selectById(id);
if (null == caseExchange) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResponseDTO.userErrorParam("操作失败");
}
caseExchange.setDeleteStatus(1);
caseExchangeDao.deleteById(id);
// 修改统计数量
DecCaseExchangeStats(String.valueOf(caseExchange.getExchangeId()),4,1);
}
return ResponseDTO.ok();
}
@ -225,7 +238,20 @@ public class CaseExchangeService {
return ResponseDTO.ok();
}
// 获取评论数据
CaseExchangeEntity caseExchange = caseExchangeDao.selectById(exchangeId);
if (null == caseExchange) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResponseDTO.userErrorParam("操作失败");
}
caseExchange.setDeleteStatus(1);
caseExchangeDao.deleteById(exchangeId);
// 修改统计数量
DecCaseExchangeStats(String.valueOf(caseExchange.getExchangeId()),4,1);
return ResponseDTO.ok();
}