У меня mybatis resultMap ссылается на класс POJO, как показано ниже.
<resultMap id="FolderResultMap" type="Folder">
<result column="recordcount" property="recordCount" />
<result column="contenttype" property="folderContentType" />
<result column="folderid" property="folderId" />
<result column="folderdesc" property="folderDescription" />
<result column="foldername" property="folderName" />
<result column="foldertype" property="folderType" />
</resultMap>
<select id="findReportFolders" resultMap="FolderResultMap">
some query
</select>
И в моем интерфейсе Mapper
List<Folder> findReportFolders (@Param("name") long id,
@Param("id2") long busid);
Из-за этого я получаю ответ JSON в виде спискаобъектов, где мне нужна карта списка объектов, как указано ниже.
{
"folders": [
{
"recordCount": 7,
"folderContentType": "Reports",
"folderId": 139491,
"folderDescription": null,
"folderName": "AA_TestPrivateFolder1234",
"folderType": "CUSTOM",
"refreshable": true
},
{
"recordCount": 35,
"folderContentType": "Reports",
"folderId": 140109,
"folderDescription": "Default Folder for New Reports",
"folderName": "label.privateReportInboxOverrideName",
"folderType": "INBOX",
"refreshable": true
}]
}
Это то, что я получаю сейчас.Я хотел бы получить ответ, как указано выше.
[{"folderId":359056,"folderName":"BE Shared Report Inbox","folderDescription":"BE Shared Report Inbox","folderType":"INBOX","folderContentType":"SharedReports","recordCount":0,"refreshable":true},{"folderId":363984,"folderName":"Default Inbox Folder","folderDescription":"Default Folder for New Reports","folderType":"INBOX","folderContentType":"Reports","recordCount":0,"refreshable":true}]
Любая идея, как я могу это сделать?