admin
2020-04-13 dd5b15229cb15459fa7c31ccea77dac28cbfafbd
fanli/src/main/java/com/yeshi/fanli/dao/goods/jd/NYouHuiGoodsDao.java
@@ -16,6 +16,15 @@
@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));
@@ -26,4 +35,37 @@
      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);
   }
}