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

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

@@ -64,11 +64,11 @@ class PatentinfoService extends CrudService {
       const plist = await this.personalModel.find({ code });
       ids = plist.map(i => i._id);
       if (ids.length > 0) {
-        newquery.inventor.id = { $elemMatch: { $in: ids } };
+        newquery.inventor.id = { $in: ids };
         delete newquery.code;
       }
     } else if (user_id) {
-      newquery.inventor = { $elemMatch: { $in: [ ObjectId(user_id) ] } };
+      newquery.inventor = { $in: [ ObjectId(user_id) ] };
     }
 
     return newquery;
@@ -79,9 +79,10 @@ class PatentinfoService extends CrudService {
     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 = { 'inventor.id': pids };
+    const query = { 'inventor.id': { $in: pids } };
     if (status) query.status = status;
     if (term) query.term = term;
+    console.log(query);
     const data = await this.model
       .find(query)
       .skip(parseInt(skip))