玩!框架没有按功能分组。这种缺乏功能真的开始让我恼火。我该如何解决这个问题?我想byRouteId
按trip_headsign 分组。简单的原始查询如下所示:
SELECT *
FROM trips
WHERE route_id = 1070
GROUP BY trip_headsign
这是我的 Trip.java
@Entity
@Table(name="trips")
public class Trip extends Model {
@Constraints.Required
public String route_id;
@Constraints.Required
public String service_id;
@Id
public String trip_id;
public String trip_headsign;
public String direction_id;
public String block_id;
public String shape_id;
@ManyToOne
@JoinColumn(name="route_id")
public TRoute troute;
public static List<Trip> byRouteId(String route_id) {
List<Trip> trips =
Trip.find
.fetch("troute") // fetch TRoute properties.
.where().like("route_id", route_id)
.findList();
return trips;
}
public static Finder<String, Trip> find = new Finder(
String.class, Trip.class
);
}