添加id转name注解方法

This commit is contained in:
2025-10-24 17:05:11 +08:00
parent 9e8cff931b
commit a1af8711ef
32 changed files with 269 additions and 431 deletions

View File

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

View File

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

View File

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

View File

@ -57,4 +57,16 @@ public interface TransConstant {
* 采购合同id转名称
*/
String XZD_PURCHASE_CONTRACT_ID_TO_NAME = "xzd_purchase_contract_id_to_name";
/**
* 综合服务合同id转名称
*/
String XZD_CS_CONTRACT_INFORMATION_ID_TO_NAME = "xzd_cs_contract_information_id_to_name";
/**
* 结算-采购合同竣工结算id转名称
*/
String XZD_JS_CG_JUNGON_ID_TO_NAME = "xzd_js_cg_jungon_id_to_name";
/**
* 新中大供应商信息-开户银行id转银行名称
*/
String XZD_SUPPLIER_OPEN_BANK_ID_TO_NAME = "xzd_supplier_open_bank_id_to_name";
}

View File

@ -0,0 +1,26 @@
package org.dromara.common.translation.core.impl;
import lombok.AllArgsConstructor;
import org.dromara.common.core.service.XzdCsContractInformationService;
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_CS_CONTRACT_INFORMATION_ID_TO_NAME)
public class XzdCsContractInformationImpl implements TranslationInterface<String> {
private final XzdCsContractInformationService xzdCsContractInformationService;
@Override
public String translation(Object key, String other) {
if (key instanceof String ids) {
return xzdCsContractInformationService.selectNameByIds(ids);
} else if (key instanceof Long id) {
return xzdCsContractInformationService.selectNameByIds(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.XzdJsCgJungonService;
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_JS_CG_JUNGON_ID_TO_NAME)
public class XzdJsCgJungonImpl implements TranslationInterface<String> {
private final XzdJsCgJungonService xzdJsCgJungonService;
@Override
public String translation(Object key, String other) {
if (key instanceof String ids) {
return xzdJsCgJungonService.selectNameByIds(ids);
} else if (key instanceof Long id) {
return xzdJsCgJungonService.selectNameByIds(id.toString());
}
return null;
}
}

View File

@ -11,7 +11,7 @@ import org.dromara.common.translation.core.TranslationInterface;
@TranslationType(type = TransConstant.XZD_PURCHASE_CONTRACT_ID_TO_NAME)
public class XzdPurchaseContractInformationImpl implements TranslationInterface<String> {
private XzdPurchaseContractInformationService xzdCustomerinformationService;
private final XzdPurchaseContractInformationService xzdCustomerinformationService;
@Override

View File

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

View File

@ -9,3 +9,6 @@ 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
org.dromara.common.translation.core.impl.XzdJsCgJungonImpl
org.dromara.common.translation.core.impl.XzdCsContractInformationImpl
org.dromara.common.translation.core.impl.XzdSupplierOpenBankImpl