@@ -98,12 +98,12 @@ public BaseVO<DataModelVO> getDataModel(
9898 @ GetMapping ("/dataModel/detail" )
9999 @ ApiOperation ("Get IoTDB data model in detail" )
100100 public BaseVO <DataModelVO > getDataModelDetail (
101- @ PathVariable ("serverId" ) Integer serverId ,
102- @ RequestParam (value = "path" , required = false , defaultValue = "root" ) String path ,
103- @ RequestParam (value = "pageSize" , required = false , defaultValue = "10" ) Integer pageSize ,
104- @ RequestParam (value = "pageNum" , required = false , defaultValue = "1" ) Integer pageNum ,
105- HttpServletRequest request )
106- throws BaseException {
101+ @ PathVariable ("serverId" ) Integer serverId ,
102+ @ RequestParam (value = "path" , required = false , defaultValue = "root" ) String path ,
103+ @ RequestParam (value = "pageSize" , required = false , defaultValue = "10" ) Integer pageSize ,
104+ @ RequestParam (value = "pageNum" , required = false , defaultValue = "1" ) Integer pageNum ,
105+ HttpServletRequest request )
106+ throws BaseException {
107107 check (request , serverId );
108108 Connection connection = connectionService .getById (serverId );
109109 DataModelVO dataModelVO = iotDBService .getDataModelDetail (connection , path , pageSize , pageNum );
@@ -113,11 +113,11 @@ public BaseVO<DataModelVO> getDataModelDetail(
113113 @ GetMapping ("/storageGroups/info" )
114114 @ ApiOperation ("Get information of the storage group list" )
115115 public BaseVO <GroupInfoVO > getAllStorageGroupsInfo (
116- @ PathVariable ("serverId" ) Integer serverId ,
117- @ RequestParam (value = "pageSize" , required = false , defaultValue = "15" ) Integer pageSize ,
118- @ RequestParam (value = "pageNum" , required = false , defaultValue = "1" ) Integer pageNum ,
119- HttpServletRequest request )
120- throws BaseException {
116+ @ PathVariable ("serverId" ) Integer serverId ,
117+ @ RequestParam (value = "pageSize" , required = false , defaultValue = "15" ) Integer pageSize ,
118+ @ RequestParam (value = "pageNum" , required = false , defaultValue = "1" ) Integer pageNum ,
119+ HttpServletRequest request )
120+ throws BaseException {
121121 check (request , serverId );
122122 Connection connection = connectionService .getById (serverId );
123123 List <String > groupNames = iotDBService .getAllStorageGroups (connection );
@@ -162,8 +162,6 @@ public BaseVO<List<StorageGroupVO>> getAllStorageGroups(
162162 String host = connection .getHost ();
163163 for (String groupName : groupNames ) {
164164 StorageGroupVO storageGroupVO = new StorageGroupVO ();
165- Integer id = groupService .getGroupId (host , groupName );
166- storageGroupVO .setGroupId (id );
167165 storageGroupVO .setGroupName (groupName );
168166 storageGroupVOList .add (storageGroupVO );
169167 }
@@ -193,9 +191,9 @@ public BaseVO saveStorageGroup(
193191 Connection connection = connectionService .getById (serverId );
194192 Long ttl = groupDTO .getTtl ();
195193 String ttlUnit = groupDTO .getTtlUnit ();
196- checkTtl (ttl , ttlUnit );
197194 Integer groupId = groupDTO .getGroupId ();
198195 groupDTO .setGroupName (groupName );
196+
199197 List <String > groupNames = iotDBService .getAllStorageGroups (connection );
200198 if (groupId == null ) {
201199 if (!groupNames .contains (groupDTO .getGroupName ())) {
@@ -206,6 +204,7 @@ public BaseVO saveStorageGroup(
206204 groupService .updateStorageGroupInfo (connection , groupDTO );
207205 }
208206 if (ttl != null && ttlUnit != null ) {
207+ checkTtl (ttl , ttlUnit );
209208 if (ttl >= 0 ) {
210209 Long times = switchTime (ttlUnit );
211210 iotDBService .saveGroupTtl (connection , groupName , ttl * times );
@@ -354,12 +353,19 @@ public BaseVO<List<NodeTreeVO>> getDevicesNodeTreeByGroup(
354353 public BaseVO <NodeTreeVO > getDevicesTreeByGroup (
355354 @ PathVariable ("serverId" ) Integer serverId ,
356355 @ PathVariable ("groupName" ) String groupName ,
356+ @ RequestParam (value = "pageSize" , required = false , defaultValue = "10" ) Integer pageSize ,
357+ @ RequestParam (value = "pageNum" , required = false , defaultValue = "1" ) Integer pageNum ,
357358 HttpServletRequest request )
358359 throws BaseException {
359360 checkParameter (groupName );
360361 check (request , serverId );
361362 Connection connection = connectionService .getById (serverId );
362- NodeTreeVO deviceList = iotDBService .getDeviceList (connection , groupName );
363+ NodeTreeVO deviceList = iotDBService .getDeviceList (connection , groupName , pageSize , pageNum );
364+ if (deviceList == null ) {
365+ deviceList = new NodeTreeVO (groupName );
366+ }
367+ deviceList .setPageNum (pageNum );
368+ deviceList .setPageSize (pageSize );
363369 return BaseVO .success ("Get successfully" , deviceList );
364370 }
365371
@@ -461,8 +467,8 @@ public BaseVO<MeasuremtnInfoVO> getMeasurementsByDeviceName(
461467 @ PathVariable ("serverId" ) Integer serverId ,
462468 @ PathVariable ("groupName" ) String groupName ,
463469 @ PathVariable ("deviceName" ) String deviceName ,
464- @ RequestParam ("pageSize" ) Integer pageSize ,
465- @ RequestParam ("pageNum" ) Integer pageNum ,
470+ @ RequestParam (value = "pageSize" , required = false , defaultValue = "10 " ) Integer pageSize ,
471+ @ RequestParam (value = "pageNum" , required = false , defaultValue = "1 " ) Integer pageNum ,
466472 @ RequestParam (value = "keyword" , required = false ) String keyword ,
467473 HttpServletRequest request )
468474 throws BaseException {
@@ -475,17 +481,26 @@ public BaseVO<MeasuremtnInfoVO> getMeasurementsByDeviceName(
475481 List <MeasurementVO > measurementVOList = new ArrayList <>();
476482 String host = connection .getHost ();
477483 if (measurementDTOList != null ) {
484+ List <String > timeseriesList = new ArrayList <>();
485+ for (MeasurementDTO measurementDTO : measurementDTOList ) {
486+ timeseriesList .add (measurementDTO .getTimeseries ());
487+ }
488+ List <String > batchNewValue =
489+ iotDBService .getBatchLastMeasurementValue (connection , timeseriesList );
490+ List <String > batchDataCount =
491+ iotDBService .getBatchDataCount (connection , deviceName , timeseriesList );
492+ int index = 0 ;
478493 for (MeasurementDTO measurementDTO : measurementDTOList ) {
479494 MeasurementVO measurementVO = new MeasurementVO ();
480495 BeanUtils .copyProperties (measurementDTO , measurementVO );
481496 String description =
482497 measurementService .getDescription (host , measurementDTO .getTimeseries ());
483- String newValue =
484- iotDBService . getLastMeasurementValue ( connection , measurementDTO . getTimeseries ( ));
485- Integer dataCount =
486- iotDBService . getOneDataCount ( connection , deviceName , measurementDTO . getTimeseries ());
487- measurementVO .setDataCount (dataCount );
488- measurementVO . setNewValue ( newValue );
498+ if ( batchNewValue . size () != 0 ) {
499+ measurementVO . setNewValue ( batchNewValue . get ( index ));
500+ }
501+ if ( batchDataCount . size () != 0 ) {
502+ measurementVO .setDataCount (Integer . parseInt ( batchDataCount . get ( index )) );
503+ }
489504 measurementVO .setDescription (description );
490505 ObjectMapper mapper = new ObjectMapper ();
491506 List <List <String >> tags = new ArrayList <>();
@@ -519,6 +534,7 @@ public BaseVO<MeasuremtnInfoVO> getMeasurementsByDeviceName(
519534 throw new BaseException (ErrorCode .GET_MSM_FAIL , ErrorCode .GET_MSM_FAIL_MSG );
520535 }
521536 measurementVOList .add (measurementVO );
537+ index ++;
522538 }
523539 }
524540 MeasuremtnInfoVO measuremtnInfoVO = new MeasuremtnInfoVO ();
0 commit comments