| Line 33... |
Line 33... |
| 33 |
|
33 |
|
| 34 |
@Autowired
|
34 |
@Autowired
|
| 35 |
BrandRepository brandRepository;
|
35 |
BrandRepository brandRepository;
|
| 36 |
|
36 |
|
| 37 |
@RequestMapping(value = ProfitMandiConstants.URL_BRAND_ALL, method=RequestMethod.GET)
|
37 |
@RequestMapping(value = ProfitMandiConstants.URL_BRAND_ALL, method=RequestMethod.GET)
|
| 38 |
public ResponseEntity<?> getAll(HttpServletRequest request){
|
38 |
public ResponseEntity<?> getAll(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PAGE_NUMBER) int pageNumber, @RequestParam(name = ProfitMandiConstants.PAGE_SIZE) int pageSize){
|
| 39 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
39 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 40 |
List<Brand> brands = brandRepository.selectAll();
|
40 |
List<Brand> brands = brandRepository.selectAll(pageNumber, pageSize);
|
| 41 |
List<Category> categories = new ArrayList<>();
|
41 |
List<Category> categories = new ArrayList<>();
|
| 42 |
for(Brand brand : brands){
|
42 |
for(Brand brand : brands){
|
| 43 |
Category category = new Category();
|
43 |
Category category = new Category();
|
| 44 |
category.setId(brand.getCategoryId());
|
44 |
category.setId(brand.getCategoryId());
|
| 45 |
if(!categories.contains(category)){
|
45 |
if(!categories.contains(category)){
|