package com.zcloud.primeport.gatewayimpl;

import com.zcloud.primeport.domain.gateway.EVehicleBasicInfoGateway;
import com.zcloud.primeport.domain.model.EVehicleBasicInfoE;
import com.zcloud.primeport.persistence.dataobject.EVehicleBasicInfoDO;
import com.zcloud.primeport.persistence.repository.EVehicleBasicInfoRepository;
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-23 10:04:32
 */
@Service
@AllArgsConstructor
public class EVehicleBasicInfoGatewayImpl implements EVehicleBasicInfoGateway {
    private final EVehicleBasicInfoRepository eVehicleBasicInfoRepository;

    @Override
    public Boolean add(EVehicleBasicInfoE eVehicleBasicInfoE) {
        EVehicleBasicInfoDO d = new EVehicleBasicInfoDO();
        BeanUtils.copyProperties(eVehicleBasicInfoE, d);
        eVehicleBasicInfoRepository.save(d);
        return true;
    }

    @Override
    public Boolean update(EVehicleBasicInfoE eVehicleBasicInfoE) {
        EVehicleBasicInfoDO d = new EVehicleBasicInfoDO();
        BeanUtils.copyProperties(eVehicleBasicInfoE, d);
        eVehicleBasicInfoRepository.updateById(d);
        return true;
    }

    @Override
    public Boolean deletedEVehicleBasicInfoById(Long id) {
        return eVehicleBasicInfoRepository.removeById(id);
    }

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

