/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称: 大恒泰山系统
 * 创建日期:2022/8/22
 */
package org.springblade.modules.business.project.base.wrapper;

import org.springblade.common.cache.DictBizCache;
import org.springblade.common.cache.DictCache;
import org.springblade.common.enums.DictBizEnum;
import org.springblade.common.enums.DictEnum;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.business.desk.entity.NoticeEntity;
import org.springblade.modules.business.desk.vo.NoticeVO;
import org.springblade.modules.business.desk.wrapper.NoticeWrapper;
import org.springblade.modules.business.project.base.entity.ProjectInfoEntity;
import org.springblade.modules.business.project.base.vo.ProjectInfoVO;
import org.springblade.modules.system.entity.DictBiz;

import java.util.Objects;

/***
 * Date:2022/8/22
 * Title:文件所属模块（必须填写）
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
public class ProjectInfoWrapper extends BaseEntityWrapper<ProjectInfoEntity, ProjectInfoVO> {
	public static ProjectInfoWrapper build() {
		return new ProjectInfoWrapper();
	}

	@Override
	public ProjectInfoVO entityVO(ProjectInfoEntity entity) {

		ProjectInfoVO projectInfoVO = Objects.requireNonNull(BeanUtil.copy(entity, ProjectInfoVO.class));
		if (entity.getAgreementId() != null){
			DictBiz biz = DictBizCache.getById(entity.getAgreementId());
			if (null != biz){
				projectInfoVO.setAgreementName(biz.getDictValue());
			}
		}
		if (entity.getPowerTypeId() != null){
			DictBiz biz = DictBizCache.getById(entity.getPowerTypeId());
			if (null != biz){
				projectInfoVO.setPowerTypeName(biz.getDictValue());
			}
		}


		return projectInfoVO;
	}
}
