【发布时间】:2018-12-29 07:37:32
【问题描述】:
目前我正在使用 SpringData 来构建我的宁静项目。
我正在使用 Page findAll(Pageable pageable, X condition, String... columns); ,这个方法。结果是这样的:
{
"content": [
{
"id": 2,
"ouId": 1,
"pClassId": 3,
"isPublic": 0,
"accessMethod": 3,
"modifierName": null
}
],
"last": true,
"totalPages": 1,
"totalElements": 3,
"number": 0,
"size": 10,
"sort": [
{
"direction": "DESC",
"property": "id",
"ignoreCase": false,
"nullHandling": "NATIVE",
"ascending": false,
"descending": true
}
],
"first": true,
"numberOfElements": 3
}
问题是如何在内容中隐藏一些特定的 json 字段? 而且@JsonIgnore注解不灵活,我在不同API中需要的字段不一样。
我试图写一个注解,但是在处理Page的时候,我发现内容是不可修改的。
所以,希望有人可以帮助我。
【问题讨论】:
标签: spring spring-boot spring-data-jpa spring-data mybatis