| | |
| | | @Repository
|
| | | public class NYouHuiGoodsDao extends MongodbBaseDao<NYouHuiGoods> {
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: selectByName
|
| | | * @Description: 根据名字查询
|
| | | * @param name
|
| | | * @return |
| | | * NYouHuiGoods 返回类型
|
| | | * @throws
|
| | | */
|
| | | public NYouHuiGoods selectByName(String name) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("name").is(name));
|
| | |
| | | return mongoTemplate.findOne(query, NYouHuiGoods.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: list
|
| | | * @Description: 查询列表
|
| | | * @param start
|
| | | * @param count
|
| | | * @return |
| | | * List<NYouHuiGoods> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<NYouHuiGoods> list(int start, int count) {
|
| | | Query query = new Query();
|
| | | List<Order> orders = new ArrayList<>();
|
| | | orders.add(new Order(Direction.DESC, "updateTime"));
|
| | | query.with(new Sort(orders));
|
| | | query.skip(start);
|
| | | query.limit(count);
|
| | | return mongoTemplate.find(query, NYouHuiGoods.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: count
|
| | | * @Description: 查询数量
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long count() {
|
| | | Query query = new Query();
|
| | | return mongoTemplate.count(query, NYouHuiGoods.class);
|
| | | }
|
| | |
|
| | | }
|