package com.zcloud.primeport.command;

import com.zcloud.primeport.domain.gateway.EVehicleBasicInfoGateway;
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-04-23 10:04:33
 */
@Component
@AllArgsConstructor
public class EVehicleBasicInfoRemoveExe {
    private final EVehicleBasicInfoGateway eVehicleBasicInfoGateway;

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

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

