modified get findActive
This commit is contained in:
@@ -21,13 +21,32 @@ export class EquipoService {
|
|||||||
findActive() {
|
findActive() {
|
||||||
return this.equipoRepository
|
return this.equipoRepository
|
||||||
.createQueryBuilder('equipo')
|
.createQueryBuilder('equipo')
|
||||||
.where('equipo.activo = :activo', { activo: 1 })
|
.select([
|
||||||
.innerJoinAndSelect('equipo.plataforma', 'p')
|
'equipo.id_equipo AS id_equipo',
|
||||||
.innerJoinAndSelect('equipo.areaUbicacion', 'a')
|
'equipo.nombre_equipo AS nombre_equipo',
|
||||||
|
'equipo.ubicacion AS ubicacion',
|
||||||
|
'equipo.ip AS ip',
|
||||||
|
'p.nombre AS plataforma',
|
||||||
|
'a.area AS area',
|
||||||
|
`
|
||||||
|
EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM bitacora b
|
||||||
|
WHERE b.id_equipo = equipo.id_equipo
|
||||||
|
AND TIMESTAMPDIFF(
|
||||||
|
SECOND,
|
||||||
|
NOW(),
|
||||||
|
DATE_ADD(b.tiempo_entrada, INTERVAL b.tiempo_asignado MINUTE)
|
||||||
|
) > 0
|
||||||
|
) AS ocupado
|
||||||
|
`,
|
||||||
|
])
|
||||||
|
.innerJoin('equipo.plataforma', 'p')
|
||||||
|
.innerJoin('equipo.areaUbicacion', 'a')
|
||||||
|
.where('equipo.activo = 1')
|
||||||
.orderBy('equipo.ubicacion', 'ASC')
|
.orderBy('equipo.ubicacion', 'ASC')
|
||||||
.getMany();
|
.getRawMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
findDisable() {
|
findDisable() {
|
||||||
return this.equipoRepository
|
return this.equipoRepository
|
||||||
.createQueryBuilder('equipo')
|
.createQueryBuilder('equipo')
|
||||||
|
|||||||
Reference in New Issue
Block a user