package org.dromara.common.translation.core.impl;

import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.EmployeeService;
import org.dromara.common.translation.annotation.TranslationType;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.common.translation.core.TranslationInterface;

/**
 * 员工姓名翻译实现
 */
@AllArgsConstructor
@TranslationType(type = TransConstant.EMPLOYEE_ID_TO_NAME)
public class EmployeeNameTranslationImpl implements TranslationInterface<String> {

    private final EmployeeService employeeService;

    @Override
    public String translation(Object key, String other) {
        String name = employeeService.selectNameById(Convert.toLong(key));
        return name;
    }

}
