package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-12-12 11:11:15
 */
@Component
@AllArgsConstructor
public class FireCheckRecordHiddenRemoveExe {
    private final FireCheckRecordHiddenGateway fireCheckRecordHiddenGateway;

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

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

