From 146dbd5ed24c1fe63766aa45e0ce602caa39748e Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 25 八月 2022 17:53:10 +0800 Subject: [PATCH] 商品ID字符串化 --- fanli/src/main/java/com/yeshi/fanli/dao/taobao/TLJFreeBuyGoodsDao.java | 75 ++++++++++++++++++------------------- 1 files changed, 37 insertions(+), 38 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/taobao/TLJFreeBuyGoodsDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/taobao/TLJFreeBuyGoodsDao.java index 5c6b2b4..8b887cc 100644 --- a/fanli/src/main/java/com/yeshi/fanli/dao/taobao/TLJFreeBuyGoodsDao.java +++ b/fanli/src/main/java/com/yeshi/fanli/dao/taobao/TLJFreeBuyGoodsDao.java @@ -2,6 +2,7 @@ import java.util.List; +import com.yeshi.fanli.util.taobao.TaoBaoUtil; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; @@ -13,47 +14,45 @@ @Repository public class TLJFreeBuyGoodsDao extends MongodbBaseDao<TLJFreeBuyGoods> { - public List<TLJFreeBuyGoods> listByDay(String day, int page, int pageSize) { - Query query = new Query(); - Criteria ca = Criteria.where("day").is(day); - query.addCriteria(ca); - query.limit(pageSize); - query.skip((page - 1) * pageSize).with(new Sort(Sort.Direction.DESC, "updateTime")); - return mongoTemplate.find(query, TLJFreeBuyGoods.class); - } + public List<TLJFreeBuyGoods> listByDay(String day, int page, int pageSize) { + Query query = new Query(); + Criteria ca = Criteria.where("day").is(day); + query.addCriteria(ca); + query.limit(pageSize); + query.skip((page - 1) * pageSize).with(new Sort(Sort.Direction.DESC, "updateTime")); + return mongoTemplate.find(query, TLJFreeBuyGoods.class); + } - public long countByDay(String day) { - Query query = new Query(); - Criteria ca = Criteria.where("day").is(day); - query.addCriteria(ca); - return mongoTemplate.count(query, TLJFreeBuyGoods.class); - } + public long countByDay(String day) { + Query query = new Query(); + Criteria ca = Criteria.where("day").is(day); + query.addCriteria(ca); + return mongoTemplate.count(query, TLJFreeBuyGoods.class); + } - public List<TLJFreeBuyGoods> listByGoodsId(String auctionid) { - Query query = new Query(); - Criteria ca = Criteria.where("goods.auctionId").is(auctionid); - query.addCriteria(ca); - return mongoTemplate.find(query, TLJFreeBuyGoods.class); - } - - public TLJFreeBuyGoods selectByAuctionIdAndDay(String auctionId, String day) { - Query query = new Query(); - Criteria ca = Criteria.where("goods.auctionId").is(auctionId).and("day").is(day); - query.addCriteria(ca); - return mongoTemplate.findOne(query, TLJFreeBuyGoods.class); - } + public List<TLJFreeBuyGoods> listByGoodsId(String auctionid) { + Query query = new Query(); + query.addCriteria(TaoBaoUtil.getAuctionIdEqualCriteria("goods.auctionId",auctionid)); - /** - * 鏍规嵁鍟嗗搧ID鍒犻櫎 - * - * @param auctionId - */ - public void deleteByGoodsId(String auctionId) { - Query query = new Query(); - Criteria ca = Criteria.where("goods.auctionId").is(auctionId); - query.addCriteria(ca); - mongoTemplate.findAndRemove(query, TLJFreeBuyGoods.class); - } + return mongoTemplate.find(query, TLJFreeBuyGoods.class); + } + + public TLJFreeBuyGoods selectByAuctionIdAndDay(String auctionId, String day) { + Query query = new Query(); + query.addCriteria(TaoBaoUtil.getAuctionIdEqualCriteria("goods.auctionId",auctionId).and("day").is(day)); + return mongoTemplate.findOne(query, TLJFreeBuyGoods.class); + } + + /** + * 鏍规嵁鍟嗗搧ID鍒犻櫎 + * + * @param auctionId + */ + public void deleteByGoodsId(String auctionId) { + Query query = new Query(); + query.addCriteria(TaoBaoUtil.getAuctionIdEqualCriteria("goods.auctionId",auctionId)); + mongoTemplate.findAndRemove(query, TLJFreeBuyGoods.class); + } } -- Gitblit v1.8.0