package com.zcloud.primeport.command;

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

import java.util.List;


/**
 * web-app
 *
 * @Author dearLin
 * @Date 2026-04-22 17:04:01
 */
@Component
@AllArgsConstructor
public class MkmjSwipeCardRecordRemoveExe {
    private final MkmjSwipeCardRecordGateway mkmjSwipeCardRecordGateway;

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

    @Transactional(rollbackFor = Exception.class)
    public boolean execute(List<Long> ids) {
        boolean res = mkmjSwipeCardRecordGateway.deletedMkmjSwipeCardRecordByIds(ids);
        if (!res) {
            throw new BizException("删除失败");
        }
        return true;
    }
}

