update lookupdata endpoint
This commit is contained in:
@@ -67,11 +67,12 @@ public class LookUpDataDao {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LookUpDataResponseBean> getLookUpDataByType(LookUpDataTypeEnum type) {
|
public List<LookUpDataResponseBean> getLookUpDataByTypes(List<LookUpDataTypeEnum> types) {
|
||||||
return lookUpDataRepository.findByType(type.getValue())
|
return types.stream()
|
||||||
.stream()
|
.flatMap(type -> lookUpDataRepository.findByType(type.getValue()).stream())
|
||||||
.map(this::convertLookUpDataEntityToResponseBean)
|
.map(this::convertLookUpDataEntityToResponseBean)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ public interface LookUpDataService {
|
|||||||
|
|
||||||
void deleteLookUpData(Long id);
|
void deleteLookUpData(Long id);
|
||||||
|
|
||||||
List<LookUpDataResponseBean> getLookUpDataByType(LookUpDataTypeEnum type);
|
List<LookUpDataResponseBean> getLookUpDataByType(List<LookUpDataTypeEnum> type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class LookUpDataServiceImpl implements LookUpDataService {
|
|||||||
lookUpDataDao.deleteLookUpData(id);
|
lookUpDataDao.deleteLookUpData(id);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public List<LookUpDataResponseBean> getLookUpDataByType(LookUpDataTypeEnum type) {
|
public List<LookUpDataResponseBean> getLookUpDataByType( List<LookUpDataTypeEnum> type) {
|
||||||
return lookUpDataDao.getLookUpDataByType(type);
|
return lookUpDataDao.getLookUpDataByTypes(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,5 +77,5 @@ public interface LookUpDataApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE)}))})
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE)}))})
|
||||||
@GetMapping(value = "/type", produces = "application/json")
|
@GetMapping(value = "/type", produces = "application/json")
|
||||||
ResponseEntity<Response<List<LookUpDataResponseBean>>> getLookUpDataByType(HttpServletRequest request, @RequestParam LookUpDataTypeEnum type);
|
ResponseEntity<Response<List<LookUpDataResponseBean>>> getLookUpDataByType(HttpServletRequest request, @RequestParam List<LookUpDataTypeEnum> types);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class LookUpDataApiController implements LookUpDataApi {
|
|||||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.LOOKUP_DATA_DELETED_SUCCESSFULLY)));
|
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.LOOKUP_DATA_DELETED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<List<LookUpDataResponseBean>>> getLookUpDataByType(HttpServletRequest request, LookUpDataTypeEnum type) {
|
public ResponseEntity<Response<List<LookUpDataResponseBean>>> getLookUpDataByType(HttpServletRequest request, List<LookUpDataTypeEnum> type) {
|
||||||
List<LookUpDataResponseBean> responseBean = lookUpDataService.getLookUpDataByType(type);
|
List<LookUpDataResponseBean> responseBean = lookUpDataService.getLookUpDataByType(type);
|
||||||
if (responseBean != null) {
|
if (responseBean != null) {
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user