ruifeng_liu преди 3 години
родител
ревизия
e1244b3b84
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      app/service/patent/patentinfo.js

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

@@ -63,12 +63,13 @@ class PatentinfoService extends CrudService {
     return query;
   }
 
-  async queryByOrg({ id, skip = 0, limit = 0 }) {
-    assert(id, '缺少机构信息');
-    let pids = await this.personalModel.find({ pid: id }, { _id: 1 });
+  async queryByOrg({ code, status, skip = 0, limit = 0 }) {
+    assert(code, '缺少机构信息');
+    let pids = await this.personalModel.find({ code }, { _id: 1 });
     if (pids.length <= 0) return { data: [], total: 0 };
     pids = pids.map(i => i._id);
     const query = { $elemMatch: { $in: pids } };
+    if (status) query.status = status;
     const data = await this.model.find(query).skip(parseInt(skip)).limit(parseInt(limit))
       .sort({ 'meta.createdAt': -1 });
     const total = await this.model.count(query);