fix: 微信小程序接口对接,测试问题修复。
This commit is contained in:
@@ -25,6 +25,12 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.intc.fishery.mapper.DeviceMapper;
|
||||
import com.intc.fishery.mapper.DeviceSwitchMapper;
|
||||
import com.intc.fishery.domain.Device;
|
||||
import com.intc.fishery.domain.DeviceSwitch;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
|
||||
/**
|
||||
* 塘口管理Service业务层处理
|
||||
@@ -41,6 +47,10 @@ public class PondServiceImpl implements IPondService {
|
||||
|
||||
private final FishMapper fishMapper;
|
||||
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
private final DeviceSwitchMapper deviceSwitchMapper;
|
||||
|
||||
/**
|
||||
* 查询塘口管理
|
||||
*
|
||||
@@ -206,6 +216,7 @@ public class PondServiceImpl implements IPondService {
|
||||
|
||||
/**
|
||||
* 校验并批量删除塘口管理信息
|
||||
* 删除时会级联删除关联的设备和开关
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
@@ -216,6 +227,23 @@ public class PondServiceImpl implements IPondService {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
|
||||
// 删除前先级联删除关联数据
|
||||
for (Long pondId : ids) {
|
||||
// 1. 删除关联的设备
|
||||
deviceMapper.delete(
|
||||
new LambdaQueryWrapper<Device>()
|
||||
.eq(Device::getPondId, pondId)
|
||||
);
|
||||
|
||||
// 2. 删除关联的开关
|
||||
deviceSwitchMapper.delete(
|
||||
new LambdaQueryWrapper<DeviceSwitch>()
|
||||
.eq(DeviceSwitch::getPondId, pondId)
|
||||
);
|
||||
}
|
||||
|
||||
// 删除塘口
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user