package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-12-12 11:10:59
 */
@Component
@AllArgsConstructor
public class FireCheckRecordRemoveExe {
    private final FireCheckRecordGateway fireCheckRecordGateway;

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

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

