'use strict'; const { CrudService } = require('naf-framework-mongoose/lib/service'); const _ = require('lodash'); // 行政区划 class XzqhService extends CrudService { constructor(ctx) { super(ctx, 'xzqh'); this.model = this.ctx.model.Xzqh; this.util = this.ctx.service.util; } async query(query, opts) { const condition = this.util.queryReset(query, opts); const { filter, options } = condition; const { skip, limit, sort, projection } = options; filter.disabled = false; if (!_.get(filter, 'pcode')) { filter.pcode = { $exists: false }; } const res = await this.model.find(filter, projection, { skip, limit, sort }); return res; } } module.exports = XzqhService;