package com.zcloud.primeport.gatewayimpl;

import com.zcloud.primeport.domain.gateway.MkmjSwipeCardRecordGateway;
import com.zcloud.primeport.domain.model.MkmjSwipeCardRecordE;
import com.zcloud.primeport.persistence.dataobject.MkmjSwipeCardRecordDO;
import com.zcloud.primeport.persistence.repository.MkmjSwipeCardRecordRepository;
import lombok.AllArgsConstructor;
import com.zcloud.gbscommon.utils.Tools;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * web-infrastructure
 *
 * @Author dearLin
 * @Date 2026-04-22 17:04:00
 */
@Service
@AllArgsConstructor
public class MkmjSwipeCardRecordGatewayImpl implements MkmjSwipeCardRecordGateway {
    private final MkmjSwipeCardRecordRepository mkmjSwipeCardRecordRepository;

    @Override
    public Boolean add(MkmjSwipeCardRecordE mkmjSwipeCardRecordE) {
        MkmjSwipeCardRecordDO d = new MkmjSwipeCardRecordDO();
        BeanUtils.copyProperties(mkmjSwipeCardRecordE, d);
        mkmjSwipeCardRecordRepository.save(d);
        return true;
    }

    @Override
    public Boolean update(MkmjSwipeCardRecordE mkmjSwipeCardRecordE) {
        MkmjSwipeCardRecordDO d = new MkmjSwipeCardRecordDO();
        BeanUtils.copyProperties(mkmjSwipeCardRecordE, d);
        mkmjSwipeCardRecordRepository.updateById(d);
        return true;
    }

    @Override
    public Boolean deletedMkmjSwipeCardRecordById(Long id) {
        return mkmjSwipeCardRecordRepository.removeById(id);
    }

    @Override
    public Boolean deletedMkmjSwipeCardRecordByIds(List<Long> ids) {
        return mkmjSwipeCardRecordRepository.removeByIds(ids);
    }
}

