package com.zcloud.primeport.command;

import com.zcloud.primeport.domain.gateway.ClosedAreaGateway;
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-19 10:27:51
*/
@Component
@AllArgsConstructor
public class ClosedAreaRemoveExe {
    private final ClosedAreaGateway closedAreaGateway;

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

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

