Skip to content

Commit

Permalink
use int instead of long
Browse files Browse the repository at this point in the history
  • Loading branch information
zubaira committed Dec 13, 2023
1 parent af8f091 commit 9b2e6f3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface CustomIconStore {
*/
CustomIcon getIconByKey(String key);

long getCustomIconCount();
int getCustomIconCount();

/**
* Returns a list of custom icons that contain all the specified keywords
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public interface IconService {

List<CustomIcon> getCustomIcons(String[] keywords);

long getIconCount();
int getIconCount();

/**
* Gets the icon associated to a key, if it exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public List<CustomIcon> getCustomIcons(String[] keywords) {

@Override
@Transactional(readOnly = true)
public long getIconCount() {
public int getIconCount() {
return customIconStore.getCustomIconCount();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ public CustomIcon getIconByKey(String key) {
}

@Override
public long getCustomIconCount() {
public int getCustomIconCount() {
final String sql = """
select count(*) from customicon;
""";

Long count = jdbcTemplate.queryForObject(sql, Long.class);
Integer count = jdbcTemplate.queryForObject(sql, Integer.class);

return Optional.ofNullable(count).orElse(0L);
return Optional.ofNullable(count).orElse(0);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void getIconData(@PathVariable String key, HttpServletResponse response)
icons = iconService.getCustomIcons(keywords);
}

long count = iconService.getIconCount();
int count = iconService.getIconCount();

List<IconResponse> iconResponses = icons.stream().map(iconMapper::from).toList();

Expand All @@ -174,7 +174,7 @@ public void getIconData(@PathVariable String key, HttpServletResponse response)
PagingWrapper.Pager.builder()
.pageSize(iconCriteria.getPageSize())
.page(iconCriteria.getPage())
.total(count)
.total((long) count)
.build());

return listPagingWrapper.withInstances(iconResponses);
Expand Down

0 comments on commit 9b2e6f3

Please sign in to comment.