how to implement retrieval of DB records by two params?

hey guys. i want to ask you for advice. so im coding an api which takes two params (season of the year, distance of the hike) and returns a list of items that i should put in my backpack. in DB i have one table
Items
with three columns
id
,
name
,
season
,
distance
. but i was wondering how to incorporate these two criterias in my code. like how to approach it? i have this service now:
@Service
public class ItemService {
    private ItemRepository itemRepository;
    public ItemService(ItemRepository itemRepository) {
        this.itemRepository = itemRepository;
    }
    public String getItemsBySeason(String season) {
        //call repo, etc
        return "Get items";
    }
}

and idk how to add
get by distance
functionality. i dont want to have two separate methods (one for retrieving items by season, and one for filtering those records by distance). I can have just one method (obviously). but idk if having
public List<Item> getItemsBySeasonAndDistance(String season, double distance)
method makes sense. what do u guys think? thanks
Was this page helpful?