Browse Source

[fix] 基础资料模块

通用修改记录模块,新增根据businessId和businessKey删除后端修改记录表中数据的接口
修改仓库信息的删除方法,新增删除仓库信息的同时,删除这条数据在修改记录表中对应的数据,并且加上事务处理
dev
liuxiaoxu 1 month ago
parent
commit
37ac33d233
  1. 12
      ruoyi-admin/src/main/java/com/ruoyi/stock/service/impl/StockInfoServiceImpl.java
  2. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysDiffLogMapper.java
  3. 9
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysDiffLogService.java
  4. 12
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysDiffLogServiceImpl.java
  5. 5
      ruoyi-admin/src/main/resources/mapper/system/SysDiffLogMapper.xml

12
ruoyi-admin/src/main/java/com/ruoyi/stock/service/impl/StockInfoServiceImpl.java

@ -120,10 +120,20 @@ public class StockInfoServiceImpl implements IStockInfoService
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public int deleteStockInfoByIds(String ids) 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;
} }
/** /**

10
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysDiffLogMapper.java

@ -67,6 +67,16 @@ public interface SysDiffLogMapper
*/ */
public int deleteSysDiffLogByIds(String[] diffIds); public int deleteSysDiffLogByIds(String[] diffIds);
/**
* 删除数据修改记录日志通过业务信息
*
* @param sysDiffLog 数据修改记录日志
* @return 结果
*/
public int deleteSysDiffLogByBusiness(SysDiffLog sysDiffLog);
/** /**
* 作废数据修改记录日志 * 作废数据修改记录日志
* *

9
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysDiffLogService.java

@ -78,6 +78,15 @@ public interface ISysDiffLogService
*/ */
public int deleteSysDiffLogById(Long diffId); public int deleteSysDiffLogById(Long diffId);
/**
* 删除数据修改记录日志通过业务信息
*
* @param sysDiffLog 数据修改记录日志
* @return 结果
*/
public int deleteSysDiffLogByBusiness(SysDiffLog sysDiffLog);
/** /**
* 作废数据修改记录日志 * 作废数据修改记录日志
* @param diffId 数据修改记录日志ID * @param diffId 数据修改记录日志ID

12
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); return sysDiffLogMapper.deleteSysDiffLogById(diffId);
} }
/**
* 删除数据修改记录日志通过业务信息
*
* @param sysDiffLog 数据修改记录日志
* @return 结果
*/
@Override
public int deleteSysDiffLogByBusiness(SysDiffLog sysDiffLog) {
return sysDiffLogMapper.deleteSysDiffLogByBusiness(sysDiffLog);
}
/** /**
* 作废数据修改记录日志 * 作废数据修改记录日志
* *

5
ruoyi-admin/src/main/resources/mapper/system/SysDiffLogMapper.xml

@ -89,6 +89,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<delete id="deleteSysDiffLogByBusiness" parameterType="SysDiffLog">
delete from sys_diff_log where business_id = #{businessId}
and business_key = #{businessKey}
</delete>
<update id="cancelSysDiffLogById" parameterType="Long"> <update id="cancelSysDiffLogById" parameterType="Long">
update sys_diff_log set del_flag = '1' where diff_id = #{diffId} update sys_diff_log set del_flag = '1' where diff_id = #{diffId}
</update> </update>

Loading…
Cancel
Save