4
4
import java .util .Collection ;
5
5
import java .util .List ;
6
6
7
+ import javax .persistence .TypedQuery ;
8
+
7
9
import com .labsynch .labseer .domain .DDictValue ;
8
10
import com .labsynch .labseer .dto .CodeTableDTO ;
9
11
import com .labsynch .labseer .exceptions .ErrorMessage ;
@@ -323,7 +325,7 @@ public ResponseEntity<java.lang.String> getDDictValuesByTypeKindFormat(
323
325
@ PathVariable ("lsType" ) String lsType ,
324
326
@ PathVariable ("lsKind" ) String lsKind ,
325
327
@ PathVariable ("format" ) String format ,
326
- @ RequestParam (value = "maxHits" , defaultValue = "100" , required = false ) Integer maxHits ,
328
+ @ RequestParam (value = "maxHits" , required = false ) Integer maxHits ,
327
329
@ RequestParam (value = "shortName" , defaultValue = "" , required = false ) String shortName ,
328
330
@ RequestParam (value = "labelTextSearchTerm" , defaultValue = "" , required = false ) String labelTextSearchTerm ) {
329
331
@@ -344,13 +346,17 @@ public ResponseEntity<java.lang.String> getDDictValuesByTypeKindFormat(
344
346
345
347
List <DDictValue > dDictResults ;
346
348
if (labelTextSearchTerm .isEmpty () && shortName .isEmpty ()) {
347
- dDictResults = DDictValue .findDDictValuesByLsTypeEqualsAndLsKindEquals (lsType , lsKind )
348
- .setMaxResults (maxHits )
349
- .getResultList ();
349
+ TypedQuery <DDictValue > dDictResultsQuery = DDictValue .findDDictValuesByLsTypeEqualsAndLsKindEquals (lsType , lsKind );
350
+ if (maxHits != null ) {
351
+ dDictResultsQuery = dDictResultsQuery .setMaxResults (maxHits );
352
+ }
353
+ dDictResults = dDictResultsQuery .getResultList ();
350
354
} else if (!shortName .isEmpty ()) {
351
- dDictResults = DDictValue .findDDictValuesByLsTypeEqualsAndLsKindEqualsAndShortNameEquals (lsType , lsKind , shortName )
352
- .setMaxResults (maxHits )
353
- .getResultList ();
355
+ TypedQuery <DDictValue > dDictResultsQuery = DDictValue .findDDictValuesByLsTypeEqualsAndLsKindEqualsAndShortNameEquals (lsType , lsKind , shortName );
356
+ if (maxHits != null ) {
357
+ dDictResultsQuery = dDictResultsQuery .setMaxResults (maxHits );
358
+ }
359
+ dDictResults = dDictResultsQuery .getResultList ();
354
360
} else {
355
361
dDictResults = DDictValue .findDDictValuesByLsTypeEqualsAndLsKindEqualsAndLabelTextSearch (lsType , lsKind , labelTextSearchTerm , maxHits );
356
362
}
0 commit comments