@RequestMapping(value="/rest/[modelid]/list", method=GET)
http://localhost:8921/wagby/rest/customer/list
ヒットしたデータ件数すべてではなく、1ページのサイズ(SizePerPage)で指定したデータを取得します。
次のページはnextで求めることができます。前のページはprevで求めることができます。
ページサイズの変更は「検索結果の1ページ当たりの数を設定する」で説明します。これらは後述します。
返戻の内容例を示します。"result" はページ情報です。"entity" は検索結果のモデル情報です。"listp" は一覧表示用の値です。"conditionp" は検索条件です。
{
"result": {
"size": 4,
"next": 2,
"current": 1,
"nextPage": true,
"prevPage": false
},
"errors": {
"jfcinfo": [],
"jfcwarn": [],
"jfcdebug": [],
"jfcerror": []
},
"status":"ShowListCustomerController.input",
"entity": [
{
"customerid": 1001,
"name": "Yamada",
"email": []
},
{
"customerid": 1000,
"name": "Suzuki",
"email": []
}
],
"listp": {
"sortable": "customerid",
"sort": "",
"order": "",
"item": [
{
"customerid":"1001",
"name":"Yamada",
},
{
"customerid":"1000",
"name":"Suzuki",
}
]
},
"conditionp": {
"name": {
"content": null,
"formatted": null,
"errorcode":""
},
"email": {
"content": null,
"formatted": null,
"errorcode":""
}
}
}
パラメータで検索条件を指定する方法です。
http://localhost:8921/wagby/rest/customer/list?customer_cp$002fname=Suzuki
返戻の内容例を示します。
{
"result": {
"size": 1,
"next": 1,
"current": 1,
"nextPage": false,
"prevPage": false
},
"errors": {
"jfcinfo": [],
"jfcwarn": [],
"jfcdebug": [],
"jfcerror": []
},
"status":"ShowListCustomerController.input",
"entity": [
{
"customerid": 1000,
"name": "Suzuki",
"email": []
}
],
"listp": {
"sortable": "customerid",
"sort": "",
"order": "",
"item": [
{
"customerid":"1000",
"name":"Suzuki"
}
]
},
"conditionp": {
"name": {
"content":"Suzuki",
"formatted": null,
"errorcode":""
}
}
}
@RequestMapping(value="/rest/[modelid]/list", method=POST, headers={"Content-Type=application/x-www-form-urlencoded"})
フォーム画面と同様のパラメータをPOSTとして指定します。
例:
customer_cp$002fname=Suzuki
「検索」と同様です。
@RequestMapping(value="/rest/[modelid]/list", method=POST, headers={"Content-Type=application/json"})
Content-Type:application/json
コンディションのプレゼンテーションオブジェクトのJSON表現を指定します。
{
"name": {
"content":"Suzuki"
}
}
チェックボックスとして用意した項目は、選択肢に choose 属性が付与されています。
これを検索条件に含める場合、choose 属性をtrueとしてサーバに送ります。
{
"jgroupid": [
{
"id": "1000",
"choose":true
}
]
}
「検索」と同様です。
@RequestMapping(value="/rest/[modelid]/list/next", method=GET)
「検索」と同様です。
@RequestMapping(value="/rest/[modelid]/list/prev", method=GET)
「検索」と同様です。
@RequestMapping(value="/rest/[modelid]/list/first", method=GET)
「検索」と同様です。
@RequestMapping(value="/rest/[modelid]/list/last", method=GET)
「検索」と同様です。
@RequestMapping(value="/rest/[modelid]/jump/[firstresult]", method=GET)
firstresultに取得する検索結果の開始件数(レコード番号)を指定します。
検索結果の数より大きい数字を指定した場合は、最後のページ(last)を取得します。
例えば、1ページ当たりの数(取得件数)が10の場合、10と指定することで2ページ目、20と指定することで3ページ目が表示されます。
http://localhost:8921/wagby/rest/customer/list/jump/1
1ページ目(1件目から10件目)の検索結果を取得する。0から9までの数字を指定した場合は、1ページ目となる。
http://localhost:8921/wagby/rest/customer/list/jump/10
2ページ目(11件目から20件目)の検索結果を取得する。10から19までの数字を指定した場合は、2ページ目となる。
http://localhost:8921/wagby/rest/customer/list/jump/20
3ページ目(21件目から30件目)の検索結果を取得する。20から29までの数字を指定した場合は、3ページ目となる。
「検索」と同様です。
@RequestMapping(value="/rest/[modelid]/changeSizePerPage", method=POST, headers={"Content-Type=application/x-www-form-urlencoded"}, params="__jfc_size_per_page")
| パラメータ | 説明 |
|---|---|
| __jfc_size_per_page | 1ページ当たりの数 |
「検索」と同様です。
検索パラメータに付与できる制御用パラメータは次のとおりです。
| パラメータ | 説明 |
|---|---|
| pagesizejshparam | 取得件数 |
| firstresultjshparam | 開始件数 |
| sortkeyjshparam | ソートキー |
例1:
firstresultjshparam=0 と設定した場合、検索結果の先頭から、一覧表示の「ページにおける表示数」の分までを取得します。
例2:
firstresultjshparam=10 と設定した場合、検索結果の10件目から、一覧表示の「ページにおける表示数」の分までを取得します。
例3:
pagesizejshparam=100&firstresultjshparam=10 と設定した場合、検索結果の10件目から110件目までを取得します。
例4:
sortkeyjshparam=customerid:DESCと指定した場合、customerid項目を降順でソートした結果を取得します。
JSONオブジェクトの場合は次のようになります。
| パラメータ | 説明 |
|---|---|
| pagesize | 取得件数 |
| firstresult | 開始件数 |
| sortkey | ソートキー |
例:
{
"pagesize": 100,
"firstresult": 10,
"sortkey": "customerid:DESC"
}