package com.yeshi.fanli.dao.goods;
|
|
import java.util.Date;
|
import java.util.List;
|
|
import org.springframework.data.domain.Sort;
|
import org.springframework.data.mongodb.core.query.Criteria;
|
import org.springframework.data.mongodb.core.query.Query;
|
import org.springframework.data.mongodb.core.query.Update;
|
import org.springframework.stereotype.Repository;
|
|
import com.yeshi.fanli.dao.MongodbBaseDao;
|
import com.yeshi.fanli.entity.goods.FreeGoodsCoupon;
|
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
|
@Repository
|
public class FreeGoodsCouponDao extends MongodbBaseDao<FreeGoodsCoupon> {
|
|
|
/**
|
* 查询免单商品-更新在前
|
* @param start
|
* @param count
|
* @param goodsType
|
* @return
|
*/
|
public List<FreeGoodsCoupon> listByType(int start,int count, Integer goodsType) {
|
Query query = new Query();
|
if (goodsType != null)
|
query.addCriteria(Criteria.where("goodsType").is(goodsType));
|
query.with(new Sort(Sort.Direction.DESC, "updateTime"));
|
query.skip(start).limit(count);
|
return mongoTemplate.find(query, getEntityClass());
|
}
|
|
public long countByType(Integer goodsType) {
|
Query query = new Query();
|
if (goodsType != null)
|
query.addCriteria(Criteria.where("goodsType").is(goodsType));
|
return mongoTemplate.count(query, getEntityClass());
|
}
|
|
|
|
}
|