1、验证字段路径是否有效(支持任意深度)优化

This commit is contained in:
zhengyf 2025-07-31 00:44:53 +08:00
parent fa17cd9ac7
commit 89be574f19
1 changed files with 16 additions and 1 deletions

View File

@ -299,7 +299,13 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
*/ */
private boolean isValidFieldPath(String mdmId, String fieldPath) { private boolean isValidFieldPath(String mdmId, String fieldPath) {
String[] pathParts = fieldPath.split("\\."); String[] pathParts = fieldPath.split("\\.");
MdmModuleDbEntity currentDb = queryDb(mdmId, pathParts[0]); MdmModuleDbEntity currentDb=null;
if(mdmId!=null){
currentDb= queryDb(mdmId, pathParts[0]);
}else {
String[] split = pathParts[0].split(":");
currentDb= queryDb( split[0]);
}
if (currentDb == null) { if (currentDb == null) {
return false; return false;
} }
@ -482,6 +488,15 @@ public class AeConfVoucherTemplateServiceImpl extends BaseService<AeConfVoucherT
} }
return dbList.get(0); return dbList.get(0);
} }
public MdmModuleDbEntity queryDb( String remark) {
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setRemark(remark);
List<MdmModuleDbEntity> dbList = mdmModuleDbDao.query(mdmModuleDbEntity);
if (dbList.size() == 0 || dbList.size() > 1) {
return null;
}
return dbList.get(0);
}
/** /**
* 查询字段们 * 查询字段们