方法1
DBObject dbObject = new BasicDBObject();
dbObject.put("status", 1);
DBObject fieldObject = new BasicDBObject();
fieldObject.put("catalogName", true);
fieldObject.put("_id", true);
Query query = new BasicQuery(dbObject, fieldObject);
return MongoPagebleUtil.queryAndPagable(query, pageable, getMongoOperations(), ForeCatalog.class);
方法2
@Query(value = "{‘status‘:?0 }", fields = "{ ‘_id‘ : 1, ‘catalogName‘ : 1}")
List<ForeCatalog> findAllForeCatalogIdAndName(String status);
时间: 2024-11-05 16:34:28