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

import cn.hutool.core.convert.Convert;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.CustomerService;
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.CUSTOMER_ID_TO_NAME)
public class CustomerNameTranslationImpl implements TranslationInterface<String> {

    private final CustomerService customerService;

    @Override
    public String translation(Object key, String other) {
        String userName = customerService.selectUserNameById(Convert.toLong(key));
        return userName;
    }

}
