package com.zcloud.basic.info.command;

import com.zcloud.basic.info.domain.gateway.RzUserGateway;
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-02 17:15:56
 */
@Component
@AllArgsConstructor
public class RzUserRemoveExe {
    private final RzUserGateway rzUserGateway;

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

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

