您好,我有以下实现:
public class Store {
private double[] position;
private String category;
}而这种搜索商店的方法即将出现
public List<Store> fundByLatLong(double latitude, double longitude, Double km) {
mongoTemplate.indexOps(Store.class).ensureIndex(new GeospatialIndex("position"));
Point point= new Point(latitude, longitude);
List<Store> stores= this.storeRepository.findByPositionNear(ponto , new Distance(km, Metrics.KILOMETERS));
return stores;
}但我需要按职位和类别进行搜索。如何为find添加参数类别?
发布于 2014-06-23 19:23:03
这就是你要找的吗?
interface StoreRepository extends Repository<Store, Long> {
List<Store> findByCategoryAndPositionNear(String category,
Point point, Distance distance);
}在reference documentation中有更多关于这类东西的内容。
https://stackoverflow.com/questions/24347255
复制相似问题