package com.zcloud.primeport.gatewayimpl;

import com.zcloud.primeport.domain.gateway.EVehicleArrivalDepartureInfoGateway;
import com.zcloud.primeport.domain.model.EVehicleArrivalDepartureInfoE;
import com.zcloud.primeport.persistence.dataobject.EVehicleArrivalDepartureInfoDO;
import com.zcloud.primeport.persistence.repository.EVehicleArrivalDepartureInfoRepository;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * web-infrastructure
 *
 * @Author dearLin
 * @Date 2026-05-27 17:45:44
 */
@Service
@AllArgsConstructor
public class EVehicleArrivalDepartureInfoGatewayImpl implements EVehicleArrivalDepartureInfoGateway {
    private final EVehicleArrivalDepartureInfoRepository eVehicleArrivalDepartureInfoRepository;

    @Override
    public Boolean add(EVehicleArrivalDepartureInfoE eVehicleArrivalDepartureInfoE) {
        EVehicleArrivalDepartureInfoDO d = new EVehicleArrivalDepartureInfoDO();
        BeanUtils.copyProperties(eVehicleArrivalDepartureInfoE, d);
        eVehicleArrivalDepartureInfoRepository.save(d);
        return true;
    }

    @Override
    public Boolean update(EVehicleArrivalDepartureInfoE eVehicleArrivalDepartureInfoE) {
        EVehicleArrivalDepartureInfoDO d = new EVehicleArrivalDepartureInfoDO();
        BeanUtils.copyProperties(eVehicleArrivalDepartureInfoE, d);
        eVehicleArrivalDepartureInfoRepository.updateById(d);
        return true;
    }

    @Override
    public Boolean deletedEVehicleArrivalDepartureInfoById(Long id) {
        return eVehicleArrivalDepartureInfoRepository.removeById(id);
    }

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

