Commit 6f00085ce7f300fe02a6fec44b9de14cfcc3196f
1 parent
5364863f
Exists in
master
and in
1 other branch
Consultar versão do agente
Showing
1 changed file
with
38 additions
and
0 deletions
Show diff stats
src/Cacic/CommonBundle/Entity/ComputadorRepository.php
| ... | ... | @@ -166,6 +166,44 @@ class ComputadorRepository extends EntityRepository |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * |
| 169 | + * Conta os computadores associados a cada Versão do Agente | |
| 170 | + */ | |
| 171 | + public function countPorVersaoCacic() | |
| 172 | + { | |
| 173 | + $qb = $this->createQueryBuilder('comp') | |
| 174 | + ->select('comp.teVersaoCacic, COUNT(DISTINCT comp.idComputador) as total') | |
| 175 | + ->groupBy('comp.teVersaoCacic'); | |
| 176 | + | |
| 177 | + | |
| 178 | + $qb = $qb->getQuery(); | |
| 179 | + $qb->useResultCache(true); | |
| 180 | + $qb->setResultCacheLifetime(600); | |
| 181 | + | |
| 182 | + return $qb->getResult(); | |
| 183 | + } | |
| 184 | + | |
| 185 | + /** | |
| 186 | + * | |
| 187 | + * Conta os computadores associados a cada Versão do Agente com acesso nos ultimos 30 dias | |
| 188 | + */ | |
| 189 | + public function countPorVersao30dias() | |
| 190 | + { | |
| 191 | + $qb = $this->createQueryBuilder('comp') | |
| 192 | + ->select('comp.teVersaoCacic, COUNT(DISTINCT comp.idComputador) as total') | |
| 193 | + ->innerJoin('CacicCommonBundle:LogAcesso','log', 'WITH', 'log.idComputador = comp.idComputador') | |
| 194 | + ->andWhere( 'log.data >= (current_date() - 30)' ) | |
| 195 | + ->groupBy('comp.teVersaoCacic'); | |
| 196 | + | |
| 197 | + | |
| 198 | + $qb = $qb->getQuery(); | |
| 199 | + $qb->useResultCache(true); | |
| 200 | + $qb->setResultCacheLifetime(600); | |
| 201 | + | |
| 202 | + return $qb->getResult(); | |
| 203 | + } | |
| 204 | + | |
| 205 | + /** | |
| 206 | + * | |
| 169 | 207 | * Conta os computadores associados a cada Sistema Operacional com acesso nos ultimos 30 dias |
| 170 | 208 | */ |
| 171 | 209 | public function countPorSO30Dias() | ... | ... |