添加id转name注解方法

This commit is contained in:
2025-10-24 11:55:19 +08:00
parent 08de61e455
commit cdcd665d43
43 changed files with 341 additions and 47 deletions

View File

@ -0,0 +1,6 @@
package org.dromara.common.core.service;
public interface XzdCustomerinformationService {
String selectNmaeByIds(String id);
}

View File

@ -0,0 +1,6 @@
package org.dromara.common.core.service;
public interface XzdProjectService {
String selectNmaeByIds(String ids);
}

View File

@ -0,0 +1,5 @@
package org.dromara.common.core.service;
public interface XzdPurchaseContractInformationService {
String selectNameByIds(String ids);
}

View File

@ -0,0 +1,6 @@
package org.dromara.common.core.service;
public interface XzdSupplierInfoService {
String selectNmaeByIds(String ids);
}

View File

@ -41,12 +41,20 @@ public interface TransConstant {
/**
* 客户id转名称
*/
String KHXX_ID_TO_NAME = "khxx_id_to_name";
String XZD_KHXX_ID_TO_NAME = "khxx_id_to_name";
/**
* 供应商id转名称
*/
String GYSXX_ID_TO_NAME = "gysxx_id_to_name";
String XZD_GYSXX_ID_TO_NAME = "gysxx_id_to_name";
/**
* 新中大项目id转名称
*/
String XZD_PROJECT_ID_TO_NAME = "xzd_project_id_to_name";
/**
* 采购合同id转名称
*/
String XZD_PURCHASE_CONTRACT_ID_TO_NAME = "xzd_purchase_contract_id_to_name";
}

View File

@ -0,0 +1,24 @@
package org.dromara.common.translation.core.impl;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.XzdCustomerinformationService;
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.XZD_KHXX_ID_TO_NAME)
public class XzdCustomerinformationImpl implements TranslationInterface<String> {
private final XzdCustomerinformationService xzdCustomerinformationService;
@Override
public String translation(Object key, String other) {
if (key instanceof String ids) {
return xzdCustomerinformationService.selectNmaeByIds(ids);
} else if (key instanceof Long id) {
return xzdCustomerinformationService.selectNmaeByIds(id.toString());
}
return null;
}
}

View File

@ -0,0 +1,23 @@
package org.dromara.common.translation.core.impl;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.XzdProjectService;
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.XZD_PROJECT_ID_TO_NAME)
public class XzdProjectImpl implements TranslationInterface<String> {
private final XzdProjectService xzdProjectService;
@Override
public String translation(Object key, String other) {
if (key instanceof String ids) {
return xzdProjectService.selectNmaeByIds(ids);
} else if (key instanceof Long id) {
return xzdProjectService.selectNmaeByIds(id.toString());
}
return null;
}
}

View File

@ -0,0 +1,26 @@
package org.dromara.common.translation.core.impl;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.XzdPurchaseContractInformationService;
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.XZD_PURCHASE_CONTRACT_ID_TO_NAME)
public class XzdPurchaseContractInformationImpl implements TranslationInterface<String> {
private XzdPurchaseContractInformationService xzdCustomerinformationService;
@Override
public String translation(Object key, String other) {
if (key instanceof String ids) {
return xzdCustomerinformationService.selectNameByIds(ids);
} else if (key instanceof Long id) {
return xzdCustomerinformationService.selectNameByIds(id.toString());
}
return null;
}
}

View File

@ -0,0 +1,24 @@
package org.dromara.common.translation.core.impl;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.XzdSupplierInfoService;
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.XZD_GYSXX_ID_TO_NAME)
public class XzdSupplierInfoImpl implements TranslationInterface<String> {
private final XzdSupplierInfoService xzdSupplierInfoService;
@Override
public String translation(Object key, String other) {
if (key instanceof String ids) {
return xzdSupplierInfoService.selectNmaeByIds(ids);
} else if (key instanceof Long id) {
return xzdSupplierInfoService.selectNmaeByIds(id.toString());
}
return null;
}
}

View File

@ -5,3 +5,7 @@ org.dromara.common.translation.core.impl.OssUrlTranslationImpl
org.dromara.common.translation.core.impl.UserNameTranslationImpl
org.dromara.common.translation.core.impl.NicknameTranslationImpl
org.dromara.common.translation.core.impl.ProjectNameTranslationImpl
org.dromara.common.translation.core.impl.XzdCustomerinformationImpl
org.dromara.common.translation.core.impl.XzdProjectImpl
org.dromara.common.translation.core.impl.XzdPurchaseContractInformationImpl
org.dromara.common.translation.core.impl.XzdSupplierInfoImpl