package com.zcloud.primeport.command;

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


/**
 * web-app
 *
 * @Author dearLin
 * @Date 2026-03-20 10:07:14
 */
@Component
@AllArgsConstructor
public class ClosedAreaCarApplyRemoveExe {
    private final ClosedAreaCarApplyGateway closedAreaCarApplyGateway;

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

    @Transactional(rollbackFor = Exception.class)
    public boolean execute(Long[] ids) {
        boolean res = closedAreaCarApplyGateway.deletedClosedAreaCarApplyByIds(ids);
        if (!res) {
            throw new BizException("删除失败");
        }
        return true;
    }
}

