2025-12-04 优化改造
This commit is contained in:
@@ -42,6 +42,7 @@ import com.jeelowcode.framework.utils.utils.FuncBase;
|
||||
import com.jeelowcode.framework.utils.utils.JeeLowCodeUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.jsqlparser.JSQLParserException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -1625,7 +1626,27 @@ public class FrameServiceImpl implements IFrameService {
|
||||
continue;
|
||||
}
|
||||
dataMap.put(key, valStr);
|
||||
dataMap.put(key.replace("Id","") + "Name", val);
|
||||
//dataMap.put(key.replace("Id","") + "Name", val);
|
||||
String newKey = getNewKey(key);
|
||||
|
||||
dataMap.put(newKey, val);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getNewKey(String key) {
|
||||
String newKey;
|
||||
String lower = key.toLowerCase();
|
||||
if (lower.endsWith("_id")) {
|
||||
// dept_id -> dept_name
|
||||
newKey = key.substring(0, key.length() - 3) + "_name";
|
||||
} else if (lower.endsWith("id")) {
|
||||
// companyId / deptId -> companyName / deptName
|
||||
newKey = key.substring(0, key.length() - 2) + "Name";
|
||||
} else {
|
||||
// 其他情况按原 key 处理,或根据需要自行决定
|
||||
newKey = key;
|
||||
}
|
||||
return newKey;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user