package com.zcloud.primeport.command;

import com.zcloud.primeport.domain.gateway.EVehicleArrivalDepartureInfoGateway;
import com.alibaba.cola.exception.BizException;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * web-app
 *
 * @Author dearLin
 * @Date 2026-05-27 17:45:44
 */
@Component
@AllArgsConstructor
public class EVehicleArrivalDepartureInfoRemoveExe {
    private final EVehicleArrivalDepartureInfoGateway eVehicleArrivalDepartureInfoGateway;

    @Transactional(rollbackFor = Exception.class)
    public boolean execute(Long id) {
        boolean res = eVehicleArrivalDepartureInfoGateway.deletedEVehicleArrivalDepartureInfoById(id);
        if (!res) {
            throw new BizException("删除失败");
        }
        return true;
    }

    @Transactional(rollbackFor = Exception.class)
    public boolean execute(List<Long> ids) {
        boolean res = eVehicleArrivalDepartureInfoGateway.deletedEVehicleArrivalDepartureInfoByIds(ids);
        if (!res) {
            throw new BizException("删除失败");
        }
        return true;
    }
}

