package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-11-26 10:12:15
 */
@Component
@AllArgsConstructor
public class FireCheckStandardRemoveExe {
    private final FireCheckStandardGateway fireCheckStandardGateway;

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

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

