后端搭建起来
This commit is contained in:
@@ -24,10 +24,13 @@ class DbService extends Service {
|
||||
}
|
||||
|
||||
async list(table, params = {}) {
|
||||
let {current = 0} = params
|
||||
let {current = 0, size = 10} = params
|
||||
delete params.size
|
||||
delete params.current
|
||||
delete params.total
|
||||
const records = await this.app.mysql.select(table, {
|
||||
where: params,
|
||||
limit: params?.size || 10, // 返回数据量
|
||||
limit: size || 10, // 返回数据量
|
||||
offset: Math.max(--current, 0), // 数据偏移量
|
||||
})
|
||||
const total = (await this.app.mysql.select(table, {where: params}))?.length || 0
|
||||
|
||||
Reference in New Issue
Block a user