|
|
@@ -0,0 +1,23 @@
|
|
|
+package cn.vber.common.translation.core.impl;
|
|
|
+
|
|
|
+import cn.vber.common.core.service.ChickenCoopService;
|
|
|
+import cn.vber.common.core.service.UnitService;
|
|
|
+import cn.vber.common.translation.annotation.TranslationType;
|
|
|
+import cn.vber.common.translation.constant.TransConstant;
|
|
|
+import cn.vber.common.translation.core.TranslationInterface;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+
|
|
|
+@AllArgsConstructor
|
|
|
+@TranslationType(type = TransConstant.UNIT_ID_TO_NAME)
|
|
|
+public class UnitTranslationImpl implements TranslationInterface<String> {
|
|
|
+
|
|
|
+ private final UnitService unitService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String translation(Object key, String other) {
|
|
|
+ if (key instanceof Long id) {
|
|
|
+ return unitService.getUnitNameById(id);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|