package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-12-12 11:10:20
 */
@Component
@AllArgsConstructor
public class FireCheckRecordPointRemoveExe {
    private final FireCheckRecordPointGateway fireCheckRecordPointGateway;

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

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

