ruifeng_liu há 3 anos atrás
pai
commit
2f5adbd96b
1 ficheiros alterados com 4 adições e 5 exclusões
  1. 4 5
      app/service/patent/patentinfo.js

+ 4 - 5
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 = { $in: ids };
+        newquery.inventor.user_id = { $in: ids };
         delete newquery.code;
       }
     } else if (user_id) {
-      newquery.inventor = { $in: [ ObjectId(user_id) ] };
+      newquery.inventor.user_id = { $in: [ ObjectId(user_id) ] };
     }
 
     return newquery;
@@ -79,7 +79,7 @@ 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': { $in: pids } };
+    const query = { 'inventor.user_id': { $in: pids } };
     if (status) query.status = status;
     if (term) query.term = term;
     console.log(query);
@@ -226,10 +226,9 @@ class PatentinfoService extends CrudService {
         const rList = nList.filter(f => f.name === name);
         if (rList && rList.length > 0) {
           for (const r of rList) {
-            iList.push({ id: r._id, name: r.name });
+            iList.push({ user_id: r._id, name: r.name });
           }
         }
-        // i.user_id = [ ...i.user_id, ...rList.map(i => i._id) ];
       }
       i.inventor = iList;
     }