lrf402788946 3 роки тому
батько
коміт
3b3034d1fe
1 змінених файлів з 3 додано та 2 видалено
  1. 3 2
      app/service/patent/patentinfo.js

+ 3 - 2
app/service/patent/patentinfo.js

@@ -442,7 +442,7 @@ class PatentinfoService extends CrudService {
     return data;
   }
 
-  async mechQuery(query) {
+  async mechQuery({ skip = 0, limit = 0, ...query }) {
     const code = _.get(query, 'code');
     assert(code, '缺少机构信息!');
     const { empower_sort, ...others } = query;
@@ -452,7 +452,8 @@ class PatentinfoService extends CrudService {
     if (empower_sort === '0') {
       sort = 'asc';
     }
-    const data = await this.model.find(newQuery).sort({ empower_date: sort });
+    const data = await this.model.find(newQuery).sort({ empower_date: sort }).skip(parseInt(skip))
+      .limit(parseInt(limit));
     const total = await this.model.count(newQuery);
     return { data, total };
   }