diff --git a/ruoyi-admin/src/main/java/com/ruoyi/stock/service/impl/StockInfoServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/stock/service/impl/StockInfoServiceImpl.java index 7b2f31a8..b31c5a40 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/stock/service/impl/StockInfoServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/stock/service/impl/StockInfoServiceImpl.java @@ -120,10 +120,20 @@ public class StockInfoServiceImpl implements IStockInfoService * @param ids 需要删除的数据ID * @return 结果 */ + @Transactional(rollbackFor = Exception.class) @Override public int deleteStockInfoByIds(String ids) { - return stockInfoMapper.deleteStockInfoByIds(Convert.toStrArray(ids)); + SysDiffLog sysDiffLog = new SysDiffLog(); + sysDiffLog.setBusinessId(Long.valueOf(ids)); + sysDiffLog.setBusinessKey(BusinessKeysConstants.STOCK_INFO); + int deleteSysDiffLogByBusiness = diffLogService.deleteSysDiffLogByBusiness(sysDiffLog); + if (deleteSysDiffLogByBusiness <= 0){ + throw new RuntimeException("删除仓库信息数据修改记录失败"); + } + + int result = stockInfoMapper.deleteStockInfoByIds(Convert.toStrArray(ids)); + return result; } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysDiffLogMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysDiffLogMapper.java index 5178dab7..19363369 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysDiffLogMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysDiffLogMapper.java @@ -67,6 +67,16 @@ public interface SysDiffLogMapper */ public int deleteSysDiffLogByIds(String[] diffIds); + + + /** + * 删除数据修改记录日志通过业务信息 + * + * @param sysDiffLog 数据修改记录日志 + * @return 结果 + */ + public int deleteSysDiffLogByBusiness(SysDiffLog sysDiffLog); + /** * 作废数据修改记录日志 * diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysDiffLogService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysDiffLogService.java index bed7a500..9522e693 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysDiffLogService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysDiffLogService.java @@ -78,6 +78,15 @@ public interface ISysDiffLogService */ public int deleteSysDiffLogById(Long diffId); + + /** + * 删除数据修改记录日志通过业务信息 + * + * @param sysDiffLog 数据修改记录日志 + * @return 结果 + */ + public int deleteSysDiffLogByBusiness(SysDiffLog sysDiffLog); + /** * 作废数据修改记录日志 * @param diffId 数据修改记录日志ID diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysDiffLogServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysDiffLogServiceImpl.java index c5f55787..ec954202 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysDiffLogServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysDiffLogServiceImpl.java @@ -170,6 +170,18 @@ public class SysDiffLogServiceImpl implements ISysDiffLogService return sysDiffLogMapper.deleteSysDiffLogById(diffId); } + + /** + * 删除数据修改记录日志通过业务信息 + * + * @param sysDiffLog 数据修改记录日志 + * @return 结果 + */ + @Override + public int deleteSysDiffLogByBusiness(SysDiffLog sysDiffLog) { + return sysDiffLogMapper.deleteSysDiffLogByBusiness(sysDiffLog); + } + /** * 作废数据修改记录日志 * diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysDiffLogMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysDiffLogMapper.xml index 9e4cc6f4..eb9f0081 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysDiffLogMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysDiffLogMapper.xml @@ -89,6 +89,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + delete from sys_diff_log where business_id = #{businessId} + and business_key = #{businessKey} + + update sys_diff_log set del_flag = '1' where diff_id = #{diffId}