12345678910 |
- import {sqlHandle} from "./db.js";
- const PageResult = async (sql, pageNum, pageSize, Entity) => {
- const result = await sqlHandle(sql)
- return {
- data: result.slice((pageNum - 1) * pageSize, pageNum * pageSize).map(v => Entity ? new Entity(v) : v),
- total: result.length
- }
- }
- export default PageResult
|