Browse Source

修改查询

zs 1 year ago
parent
commit
8d0befbded
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/service/car.service.ts

+ 6 - 1
src/service/car.service.ts

@@ -10,7 +10,12 @@ export class CarService extends BaseService<modelType> {
   @InjectEntityModel(Car)
   model: modelType;
   async queryList(filter) {
-    const { skip = 0, limit, ...info } = filter;
+    const { skip = 0, limit, money, ...info } = filter;
+    // 处理价格
+    if (money) {
+      const mon = money.substr(0, money.length - 1);
+      info.total_money = { $gt: mon.match(/(\S*)-/)[1], $lt: mon.match(/-(\S*)/)[1] };
+    }
     const pipes: any[] = [
       { $match: info },
       {