package com.zcloud.primeport.gatewayimpl;

import com.zcloud.primeport.domain.gateway.MkmjGateGateway;
import com.zcloud.primeport.domain.model.MkmjGateE;
import com.zcloud.primeport.persistence.dataobject.MkmjGateDO;
import com.zcloud.primeport.persistence.repository.MkmjGateRepository;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Collections;

/**
 * web-infrastructure
 *
 * @Author makejava
 * @Date 2026-03-05 11:33:18
 */
@Service
@AllArgsConstructor
public class MkmjGateGatewayImpl implements MkmjGateGateway {
    private final MkmjGateRepository mkmjGateRepository;

    @Override
    public Boolean add(MkmjGateE mkmjGateE) {
        MkmjGateDO d = new MkmjGateDO();
        BeanUtils.copyProperties(mkmjGateE, d);
        mkmjGateRepository.save(d);
        return true;
    }

    @Override
    public Boolean update(MkmjGateE mkmjGateE) {
        MkmjGateDO d = new MkmjGateDO();
        BeanUtils.copyProperties(mkmjGateE, d);
        mkmjGateRepository.updateById(d);
        return true;
    }

    @Override
    public Boolean deletedMkmjGateById(Long id) {
        return mkmjGateRepository.removeById(id);
    }

    @Override
    public Boolean deletedMkmjGateByIds(Long[] ids) {
        return mkmjGateRepository.removeByIds(Collections.singletonList(ids));
    }
}

