StorageConfigVo.java 913 Bytes
package com.viontech.storage.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.viontech.storage.entity.Context;
import com.viontech.storage.model.StorageConfig;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * .
 *
 * @author 谢明辉
 * @date 2021/11/8
 */

@Getter
@Setter
public class StorageConfigVo extends StorageConfig {

    private List<Context> contexts;

    public static StorageConfigVo copy(StorageConfig storageConfig) {
        if (storageConfig == null) {
            return null;
        }
        StorageConfigVo storageConfigVo = new StorageConfigVo();
        BeanUtil.copyProperties(storageConfig, storageConfigVo, true);
        if (storageConfigVo.getContext() != null) {
            storageConfigVo.setContexts(JSONUtil.toList(storageConfigVo.getContext(), Context.class));
        }
        return storageConfigVo;
    }

}