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

 import java.util.Objects;

/**
 * 岗位表包装类,返回视图层所需的字段
 *
  */
public class PostWrapper extends BaseEntityWrapper<Post, PostVO> {

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

	@Override
	public PostVO entityVO(Post post) {
		PostVO postVO = Objects.requireNonNull(BeanUtil.copyProperties(post, PostVO.class));
		String categoryName = DictCache.getValue(DictEnum.POST_CATEGORY, post.getCategory());
		postVO.setCategoryName(categoryName);
		return postVO;
	}

}
