java – I have query to database which has filters ,sorting ,limit, offset value and I need make code more effective

I have method that fetches sorted and filtered data from Mysql Database, Firstly I had done It by using Java. Now I did it by Mysql but I don’t like the way the code looks

I have entity that named Order and It looks like this

public class Order implements Serializable {
    private int orderId;
    private int userId;
    private int carId;
    private String userAddress;
    private String userDestination;
    private double orderCost;
    @JsonSerialize(using = CustomLocalDateTimeJsonSerializer.class)
    private LocalDateTime orderDate;
//getters, setters
}

Method that performs all work

@Override
    public List<Order> findFilSortOrders(Map<String, String> filters, String sortedColumn, boolean descending, int startRow, int rowsPerPage) {
    StringBuilder query = new StringBuilder("SELECT*FROM (SELECT*FROM user_order ");
    ResultSet resultSet = null;
    LinkedHashMap<String,String> filterToQuery;
    List<String> values = new ArrayList<>();
    List<String> keys = new ArrayList<>();
        List<Order> orders = new ArrayList<>();
        if(filters!=null){
            query.append("WHERE ");
            filterToQuery = new LinkedHashMap<>(filters);
            values = new ArrayList<>(filterToQuery.values());
            keys = new ArrayList<>(filterToQuery.keySet());
            keys.forEach(key->
        {
            if(key.equals("orderDate")){
                query.append("date_format(").append(key).append(",'%Y-%m-%d %H:%i') = ? AND ");
            }else{
                query.append(key).append(" = ? AND ");
            }
        });
            query.setLength(query.length()-4);
    }
        query.append(" LIMIT ?, ?) a").append(" ORDER BY ").append(sortedColumn).append(" ").append(descending?"DESC":"ASC;");
    try(Connection connection = MySQLDAOFactory.getConnection();
    PreparedStatement statement = connection.prepareStatement(query.toString())){
       for (int i=0;i<values.size();i++){
           switch (keys.get(i)){
               case "orderId":
               case "userId":
               case "carId":{
                   statement.setInt(i+1, Integer.parseInt(values.get(i)));
                   break;
               }
               case "orderDate":
               case "userAddress":
               case "userDestination":{
                  statement.setString(i+1,values.get(i));
                   break;
               }
               case "orderCost":{
                   statement.setDouble(i+1,Double.parseDouble(values.get(i)));
                   break;
               }
           }
       }
       statement.setInt(values.size()+1,startRow);
       statement.setInt(values.size()+2,rowsPerPage);
        resultSet = statement.executeQuery();
        while(resultSet.next()){
            Order order = new Order();
            order.setCarId(resultSet.getInt("carId"));
            order.setOrderId(resultSet.getInt("orderId"));
            order.setUserId(resultSet.getInt("userId"));
            order.setUserAddress(resultSet.getString("userAddress"));
            order.setUserDestination(resultSet.getString("userDestination"));
            order.setOrderCost(resultSet.getDouble("orderCost"));
            order.setOrderDate(resultSet.getTimestamp("orderDate").toLocalDateTime());
            orders.add(order);
        }
    }catch (SQLException e){
        LOGGER.error(e);
        try {
            if (resultSet != null) {
                resultSet.close();
            }
        } catch (SQLException throwables) {
            LOGGER.error(throwables);
        }
    }
     return orders;
    }

This code works but I dont like it looks If you could help me improve the code, I would be very grateful. Thanks for answering.