package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-12-12 11:12:04
 */
@Component
@AllArgsConstructor
public class FireCheckRecordUserRemoveExe {
    private final FireCheckRecordUserGateway fireCheckRecordUserGateway;

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

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

