
package org.sky.system.wrapper;

import org.sky.core.mp.support.BaseEntityWrapper;
import org.sky.core.tool.utils.BeanUtil;
import org.sky.system.cache.DictCache;
import org.sky.system.pojo.entity.ApiScope;
import org.sky.system.pojo.enums.DictEnum;
import org.sky.system.pojo.vo.ApiScopeVO;

import java.util.Objects;


/**
 * 包装类,返回视图层所需的字段
 *
  */
public class ApiScopeWrapper extends BaseEntityWrapper<ApiScope, ApiScopeVO> {

	public static ApiScopeWrapper build() {
		return new ApiScopeWrapper();
	}

	@Override
	public ApiScopeVO entityVO(ApiScope dataScope) {
		ApiScopeVO apiScopeVO = Objects.requireNonNull(BeanUtil.copyProperties(dataScope, ApiScopeVO.class));
		String scopeTypeName = DictCache.getValue(DictEnum.API_SCOPE_TYPE, dataScope.getScopeType());
		apiScopeVO.setScopeTypeName(scopeTypeName);
		return apiScopeVO;
	}

}
