package com.zcloud.fire.check.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-11-28 10:32:28
 */
@Component
@AllArgsConstructor
public class FireCheckListItemRemoveExe {
    private final FireCheckListItemGateway fireCheckListItemGateway;

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

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

