update 删除矿机新增订单校验
This commit is contained in:
@@ -7,10 +7,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.m2pool.lease.dto.*;
|
||||
import com.m2pool.lease.dto.v2.*;
|
||||
import com.m2pool.lease.entity.LeaseMachine;
|
||||
import com.m2pool.lease.entity.LeaseMachineConfig;
|
||||
import com.m2pool.lease.entity.LeaseMachinePrice;
|
||||
import com.m2pool.lease.entity.LeaseShop;
|
||||
import com.m2pool.lease.entity.*;
|
||||
import com.m2pool.lease.exception.MachineException;
|
||||
import com.m2pool.lease.mapper.*;
|
||||
import com.m2pool.lease.service.LeaseMachineConfigService;
|
||||
@@ -61,6 +58,9 @@ public class LeaseMachineServiceImpl extends ServiceImpl<LeaseMachineMapper, Lea
|
||||
@Resource
|
||||
private LeaseMachinePriceService leaseMachinePriceService;
|
||||
|
||||
@Resource
|
||||
private LeaseOrderItemMapper leaseOrderItemMapper;
|
||||
|
||||
public LeaseShop getShopById() {
|
||||
return leaseShopMapper.selectOne(new LambdaQueryWrapper<LeaseShop>().eq(LeaseShop::getUserEmail, SecurityUtils.getUsername())
|
||||
.eq(LeaseShop::getDel, false));
|
||||
@@ -443,7 +443,12 @@ public class LeaseMachineServiceImpl extends ServiceImpl<LeaseMachineMapper, Lea
|
||||
|
||||
@Override
|
||||
public Result<String> deleteMachine(BaseVo baseVo) {
|
||||
//TODO 删除之前需要判断是否存在订单
|
||||
//删除之前需要判断是否存在订单
|
||||
Long l = leaseOrderItemMapper.selectCount(new LambdaQueryWrapper<LeaseOrderItem>()
|
||||
.eq(LeaseOrderItem::getProductMachineId, baseVo.getId()).eq(LeaseOrderItem::getStatus, 1));
|
||||
if (l > 0){
|
||||
return Result.fail("删除失败,该矿机有订单正进行中");
|
||||
}
|
||||
leaseMachineMapper.updateById(LeaseMachine.builder().id(baseVo.getId()).del(true).build());
|
||||
//删除售价
|
||||
leaseMachinePriceMapper.update(LeaseMachinePrice.builder().del(true).build(),new LambdaQueryWrapper<LeaseMachinePrice>()
|
||||
|
||||
Reference in New Issue
Block a user