package com.zcloud.basic.info.gatewayimpl;

import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
import com.zcloud.basic.info.domain.model.ImgFilesE;
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
import com.zcloud.basic.info.persistence.repository.ImgFilesRepository;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
* web-infrastructure
* @Author zhangyue
* @Date 2025-10-30 16:10:06
*/
@Service
@AllArgsConstructor
public class ImgFilesGatewayImpl implements ImgFilesGateway {
    private final ImgFilesRepository imgFilesRepository;

    @Override
    public Boolean add(ImgFilesE imgFilesE) {
        ImgFilesDO d = new ImgFilesDO();
        BeanUtils.copyProperties(imgFilesE, d);
        imgFilesRepository.save(d);
        return true;
    }

    @Override
    public Boolean update(ImgFilesE imgFilesE) {
        ImgFilesDO d = new ImgFilesDO();
        BeanUtils.copyProperties(imgFilesE, d);
        imgFilesRepository.updateById(d);
        return true;
    }

    @Override
    public Boolean deletedImgFilesById(Long id) {
        return imgFilesRepository.removeById(id);
    }

    @Override
    public Boolean deletedImgFilesByIds(Long[] ids) {

        return imgFilesRepository.removeByIds(Arrays.asList(ids));
    }
}

