@ -85,4 +85,31 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo>
@@ -85,4 +85,31 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo>
return R . ok ( ) . put ( "data" , resultList ) ;
}
@Override
public R getCount ( ) {
List < Map < String , Object > > map = baseMapper . selectAllAlea ( ) ;
Map < String , Object > result = new HashMap < > ( ) ;
// 区域名称
List < String > stnms = new ArrayList < > ( ) ;
// 各个区域在线的设备
List < Integer > zx = new ArrayList < > ( ) ;
// 各个区域离线的设备
List < Integer > lx = new ArrayList < > ( ) ;
for ( Map < String , Object > m : map ) {
Integer aleaId = ( Integer ) m . get ( "alea_id" ) ;
// 查询各个区域在线的设备
Integer zxCount = baseMapper . selectZXAndLXCount ( 1 , aleaId ) ;
// 查询各个区域离线的设备
Integer lxCount = baseMapper . selectZXAndLXCount ( 0 , aleaId ) ;
zx . add ( zxCount ) ;
lx . add ( lxCount ) ;
stnms . add ( ( String ) m . get ( "alea_name" ) ) ;
}
result . put ( "stnms" , stnms ) ;
result . put ( "zx" , zx ) ;
result . put ( "lx" , lx ) ;
return R . ok ( ) . put ( "data" , result ) ;
}
}