|
@@ -4,6 +4,7 @@ const { BusinessError, ErrorCode } = require('naf-core').Error;
|
|
|
const _ = require('lodash');
|
|
|
const assert = require('assert');
|
|
|
const moment = require('moment');
|
|
|
+const { ObjectId } = require('mongoose').Types;
|
|
|
|
|
|
//
|
|
|
class GroupService extends CrudService {
|
|
@@ -99,7 +100,13 @@ class GroupService extends CrudService {
|
|
|
tran.update('Group', group, updateData);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ async beforeQuery(filter) {
|
|
|
+ const gsv = _.get(filter, 'goodsSpec._id');
|
|
|
+ const gv = _.get(filter, 'goods._id');
|
|
|
+ if (gv) filter['goods._id'] = ObjectId(gv);
|
|
|
+ if (gsv) filter['goodsSpec._id'] = ObjectId(gsv);
|
|
|
+ return filter;
|
|
|
+ }
|
|
|
async afterQuery(filter, data) {
|
|
|
data = JSON.parse(JSON.stringify(data));
|
|
|
for (const i of data) {
|