package com.zcloud.basic.info.command;

import com.zcloud.basic.info.domain.gateway.RzUserRecordGateway;
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-05 14:00:37
 */
@Component
@AllArgsConstructor
public class RzUserRecordRemoveExe {
    private final RzUserRecordGateway rzUserRecordGateway;

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

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

