package com.engine.organization.transmethod;

import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.hrm.User;

/**
 * @author:dxfeng
 * @createTime: 2022/06/21
 * @version: 1.0
 */
public class HrmResourceTransMethod {

    public static String getDepartmentName(String departmentId) {
        return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Integer.parseInt(departmentId));
    }

    public static String getCompanyName(String companyId) {
        return MapperProxyFactory.getProxy(CompMapper.class).listById(Integer.parseInt(companyId)).getSubCompanyName();
    }

    public static String getJobName(String jobTitle) {
        return JobBO.getJobTitleNameByEcJobTitle(jobTitle);
    }

    public static String getManagerName(String managerId) {
        return new User(Integer.parseInt(managerId)).getLastname();
    }

    public static String getScDepartmentName(String departmentId) {
        return MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(departmentId);
    }

    public static String getScCompanyName(String subCompanyId) {
        return MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(subCompanyId);
    }

    public static String getScManagerName(String managerId) {
        if ("0".equals(managerId)) {
            return "";
        }
        return MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(managerId);
    }
}
