package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-12-11 15:32:50
 */
@Component
@AllArgsConstructor
public class FireCheckListUserRemoveExe {
    private final FireCheckListUserGateway fireCheckListUserGateway;

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

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

