[QUESTION] 怎样给一个列表数据批量添加一个额外的field值,并通过fastjson或fastjson2序列化输出?
Open
question
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 请描述您的问题
*询问有关本项目的使用和其他方面的相关问题。*
场景:我有一个列表数据,每个数据里面有一个字典ID,我想在接口返回时添加AOP拦截并为该列表数据添加一个字典ID对应的字典名称属性,最终通过fastjson解析输出json串。
而这个字典名称不是列表数据类的field,是一个额外添加的field。
目前,我所知道的是一个AfterFilter拦截器拦截来一条条数据处理。
但我想先将所有字典ID拿到,一次性获取所有字典ID对应的名称,再一一设置到列表数据中,这样性能会更高一些。
Contributor guide
Research direction
Start by reviewing the AfterFilter mechanism and the fastjson/fastjson2 serialization path described in the issue. Determine whether batch collection of dictionary IDs and adding the resulting names during list serialization is supported; done requires a decided, documented approach or a scoped project change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100