package com.engine.organization.entity.hrmresource.bo;

import com.engine.organization.entity.hrmresource.po.ResourceChartPO;
import com.engine.organization.entity.hrmresource.vo.ResourceChartVO;
import com.engine.organization.transmethod.HrmResourceTransMethod;
import weaver.general.Util;

import java.util.ArrayList;
import java.util.List;

/**
 * @author:dxfeng
 * @createTime: 2023/07/06
 * @version: 1.0
 */
public class ResourceChartBO {

    public static List<ResourceChartVO> convertToVO(List<ResourceChartPO> resourceChartPOS) {
        List<ResourceChartVO> resourceChartVOS = new ArrayList<>();
        for (ResourceChartPO resourceChartPO : resourceChartPOS) {
            ResourceChartVO resourceChartVO = new ResourceChartVO();
            resourceChartVO.setId(resourceChartPO.getId());
            resourceChartVO.setWorkCode(resourceChartPO.getWorkCode());
            resourceChartVO.setLastName(resourceChartPO.getLastName());
            resourceChartVO.setSex("1".equals(resourceChartPO.getSex()) ? "女" : "男");
            resourceChartVO.setDepartmentName(HrmResourceTransMethod.getDepartmentName(Util.null2String(resourceChartPO.getDepartmentId())));
            resourceChartVO.setSubcompanyName(HrmResourceTransMethod.getCompanyName(Util.null2String(resourceChartPO.getSubcompanyid1())));
            resourceChartVO.setJobTitle(HrmResourceTransMethod.getJobName(Util.null2String(resourceChartPO.getJobTitle())));
            resourceChartVO.setStatus(resourceChartPO.getStatus());
            resourceChartVO.setMobile(resourceChartPO.getMobile());
            resourceChartVOS.add(resourceChartVO);
        }
        return resourceChartVOS;
    }


}
