package com.zcloud.basic.info.facade;

import com.alibaba.cola.dto.MultiResponse;
import com.zcloud.basic.info.api.ImgFilesServiceI;
import com.zcloud.basic.info.command.convertor.ImgFilesCoConvertor;
import com.zcloud.basic.info.dto.ImgFilesQryCmd;
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
import com.zcloud.gbscommon.zcloudimgfiles.request.ZcloudImgFilesQryCmd;
import com.zcloud.gbscommon.zcloudimgfiles.response.ZcloudImgFilesCO;
import org.springframework.beans.BeanUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhangyue
 * @date 2025/12/3 10:43
 */
public class ZcloudImgFilesFacadeImpl implements ZcloudImgFilesFacade {
    @Resource
    private ImgFilesServiceI imgFilesService;
    @Resource
    private ImgFilesCoConvertor imgFilesCoConvertor;
    @Override
    public MultiResponse<ZcloudImgFilesCO> listAll(ZcloudImgFilesQryCmd zcloudImgFilesQryCmd) {
        ImgFilesQryCmd imgFilesQryCmd = new ImgFilesQryCmd();
        BeanUtils.copyProperties(zcloudImgFilesQryCmd, imgFilesQryCmd);
        MultiResponse<ImgFilesCO> response = imgFilesService.listAll(imgFilesQryCmd);
        List<ZcloudImgFilesCO> zcloudImgFilesCo = imgFilesCoConvertor.converCOsToDubboCOs(response.getData());
        return MultiResponse.of(zcloudImgFilesCo);
    }
}
