package com.zcloud.basic.info.command;

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


/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-10-29 16:02:27
 */
@Component
@AllArgsConstructor
public class CorpFormRemoveExe {
    private final CorpFormGateway corpFormGateway;

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

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

