Get a page of records
Example DB Table
smartPanda.mdh.brand
CREATE TABLE `brand`
(
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`logo` text,
`logo_url` varchar(255) DEFAULT NULL,
`website` varchar(255) DEFAULT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
Get paged, filtered and sorted multiple records
db.schema.table.select*
returns the filtered and sorted list pages and the total number of rows { data: [], total: int }
according to the filter specified in the method name, and the paging and sorting specified in the parameters.
API selectBy*
Example Request
{
"method": "smartPanda.mdh.brand.selectByDisabled",
"params": {
"filters": [
0
],
"pagination": {
"current": 1,
"pageSize": 3
},
"sorters": [
{
"field": "id",
"order": "desc"
}
]
}
}
Example response, some parts omitted
{
"data": [
{
"id": 28,
"name": "Brand AB",
"logo": "logo_ab.png",
"logoUrl": "http://example.com/logo_ab.png",
"website": "http://example.com/brand_ab",
"disabled": 0
},
{
"id": 27,
"name": "Brand AA",
"logo": "logo_aa.png",
"logoUrl": "http://example.com/logo_aa.png",
"website": "http://example.com/brand_aa",
"disabled": 0
},
{
"id": 26,
"name": "Brand Z",
"logo": "logo_z.png",
"logoUrl": "http://example.com/logo_z.png",
"website": "http://example.com/brand_z",
"disabled": 0
}
],
"total": 28
}
Script selectBy*
Example Code
var params = {
filters: [
0
],
pagination: {
current: 1,
pageSize: 3
},
sorters: [
{
field: "id",
order: "desc"
}
]
};
var result = luwak.dao("smartPanda.mdh.brand.selectByDisabled", params);