|
@@ -31,14 +31,6 @@ class PatentearlyService extends CrudService {
|
|
async resetCode(query) {
|
|
async resetCode(query) {
|
|
let newquery = _.cloneDeep(query);
|
|
let newquery = _.cloneDeep(query);
|
|
newquery = this.ctx.service.util.util.dealQuery(newquery);
|
|
newquery = this.ctx.service.util.util.dealQuery(newquery);
|
|
- const { type } = newquery;
|
|
|
|
- if (type === 'else') {
|
|
|
|
- newquery.$and = [
|
|
|
|
- { type: { $ne: '发明' } },
|
|
|
|
- { type: { $ne: '实用新型' } },
|
|
|
|
- ];
|
|
|
|
- delete newquery.type;
|
|
|
|
- }
|
|
|
|
const { code, user_id } = newquery;
|
|
const { code, user_id } = newquery;
|
|
let ids = [];
|
|
let ids = [];
|
|
if (code) {
|
|
if (code) {
|
|
@@ -54,6 +46,21 @@ class PatentearlyService extends CrudService {
|
|
|
|
|
|
return newquery;
|
|
return newquery;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ async queryByOrg({ code, 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 = { user_id: { $elemMatch: { $in: pids } } };
|
|
|
|
+ const data = await this.model
|
|
|
|
+ .find(query)
|
|
|
|
+ .skip(parseInt(skip))
|
|
|
|
+ .limit(parseInt(limit))
|
|
|
|
+ .sort({ 'meta.createdAt': -1 });
|
|
|
|
+ const total = await this.model.count(query);
|
|
|
|
+ return { data, total };
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 产生警告
|
|
* 产生警告
|
|
*/
|
|
*/
|