fix: 修正换宿当天查寝归属
All checks were successful
CI / check (pull_request) Successful in 3m8s

This commit is contained in:
2026-07-22 15:18:12 +08:00
parent 7ffc573d2e
commit a9009f86fb
4 changed files with 41 additions and 14 deletions

View File

@@ -8,7 +8,6 @@ import {
Not,
In,
LessThanOrEqual,
MoreThanOrEqual,
} from 'typeorm';
import { Room } from '../entities/room.entity';
@@ -20,6 +19,7 @@ import { CreateRoomDto, UpdateRoomDto } from './dto/room.dto';
import { CreateBedDto, UpdateBedDto, BatchCreateBedDto } from './dto/bed.dto';
import { CreateLockerDto, UpdateLockerDto, BatchCreateLockerDto } from './dto/locker.dto';
import { RoomInspectionsService } from './room-inspections.service';
import { occupancyWhereOnDate } from './room-occupancy-date';
@Injectable()
export class RoomsService {
@@ -246,10 +246,7 @@ export class RoomsService {
});
const occupancies = await this.occRepo.find({
where: [
{ checkInDate: LessThanOrEqual(targetDate), checkOutDate: IsNull() },
{ checkInDate: LessThanOrEqual(targetDate), checkOutDate: MoreThanOrEqual(targetDate) },
],
where: occupancyWhereOnDate(targetDate),
relations: ['student', 'student.organization', 'responsibleOrganization', 'bed'],
order: { checkInDate: 'ASC' },
});