package com.zcloud.basic.info.command;

import com.zcloud.basic.info.domain.gateway.ProblemFeedbackGateway;
import com.alibaba.cola.exception.BizException;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;


/**
 * web-app
 *
 * @Author SondonYong
 * @Date 2025-12-06 11:26:34
 */
@Component
@AllArgsConstructor
public class ProblemFeedbackRemoveExe {
    private final ProblemFeedbackGateway problemFeedbackGateway;

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

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

