package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-11-28 10:32:09
 */
@Component
@AllArgsConstructor
public class FireCheckListRemoveExe {
    private final FireCheckListGateway fireCheckListGateway;

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

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

