package com.pusong.common.translation.core.impl;

import com.pusong.common.core.service.DeptService;
import com.pusong.common.core.service.PostService;
import com.pusong.common.translation.annotation.TranslationType;
import com.pusong.common.translation.constant.TransConstant;
import com.pusong.common.translation.core.TranslationInterface;
import lombok.AllArgsConstructor;

/**
 * 岗位翻译实现
 *
 * @author Lion Li
 */
@AllArgsConstructor
@TranslationType(type = TransConstant.POST_ID_TO_NAME)
public class PostNameTranslationImpl implements TranslationInterface<String> {

    private final PostService postService;

    @Override
    public String translation(Object key, String other) {
        if (key instanceof String ids) {
            return postService.selectPostNameByIds(ids);
        } else if (key instanceof Long id) {
            return postService.selectPostNameByIds(id.toString());
        }
        return null;
    }
}
