 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.DataScope;
 import org.sky.system.pojo.enums.DictEnum;
 import org.sky.system.pojo.vo.DataScopeVO;

 import java.util.Objects;


/**
 * 包装类,返回视图层所需的字段
 *
 * @author Chill
 */
public class DataScopeWrapper extends BaseEntityWrapper<DataScope, DataScopeVO> {

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

	@Override
	public DataScopeVO entityVO(DataScope dataScope) {
		DataScopeVO dataScopeVO = Objects.requireNonNull(BeanUtil.copyProperties(dataScope, DataScopeVO.class));
		String scopeTypeName = DictCache.getValue(DictEnum.DATA_SCOPE_TYPE, dataScope.getScopeType());
		dataScopeVO.setScopeTypeName(scopeTypeName);
		return dataScopeVO;
	}

}
