|
|
@@ -1,4 +1,4 @@
|
|
|
-import { DataSource, In, LessThanOrEqual, MoreThanOrEqual } from 'typeorm';
|
|
|
+import { DataSource, In, LessThanOrEqual, MoreThanOrEqual, Between } from 'typeorm';
|
|
|
import { GenericCrudService } from '@/server/utils/generic-crud.service';
|
|
|
import { RouteEntity } from './route.entity';
|
|
|
import { VehicleType, TravelMode } from './route.schema';
|
|
|
@@ -88,10 +88,11 @@ export class RouteService extends GenericCrudService<RouteEntity> {
|
|
|
}
|
|
|
|
|
|
// 价格筛选
|
|
|
- if (minPrice !== undefined) {
|
|
|
+ if (minPrice !== undefined && maxPrice !== undefined) {
|
|
|
+ where.price = Between(minPrice, maxPrice);
|
|
|
+ } else if (minPrice !== undefined) {
|
|
|
where.price = MoreThanOrEqual(minPrice);
|
|
|
- }
|
|
|
- if (maxPrice !== undefined) {
|
|
|
+ } else if (maxPrice !== undefined) {
|
|
|
where.price = LessThanOrEqual(maxPrice);
|
|
|
}
|
|
|
|