From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandGoodsCaheDao.java | 214 ++++++++++++++++++++++++++-------------------------- 1 files changed, 107 insertions(+), 107 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandGoodsCaheDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandGoodsCaheDao.java index e4b3631..8ed0cd6 100644 --- a/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandGoodsCaheDao.java +++ b/fanli/src/main/java/com/yeshi/fanli/dao/brand/BrandGoodsCaheDao.java @@ -1,107 +1,107 @@ -package com.yeshi.fanli.dao.brand; - -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.stereotype.Repository; - -import com.yeshi.common.MongodbBaseDao; -import com.yeshi.fanli.entity.brand.BrandGoodsCahe; - -@Repository -public class BrandGoodsCaheDao extends MongodbBaseDao<BrandGoodsCahe> { - - - /** - * 鏂板 - * @param record - */ - public void insert(BrandGoodsCahe record) { - if (record == null) { - return; - } - mongoTemplate.insert(record); - } - - /** - * 鏌ヨ鍟嗗搧鍒楄〃 - * @param count - * @param brandId - * @return - */ - public List<BrandGoodsCahe> getByBrandId(int start, int count, Long brandId){ - if (brandId == null) - return null; - - Query query = new Query(); - query.addCriteria(Criteria.where("brandId").is(brandId)); - //鍒嗛〉 - query.skip(start).limit(count); - //鎺掑簭 - query.with(new Sort(Sort.Direction.DESC,"weight")); - - return mongoTemplate.find(query, BrandGoodsCahe.class); - } - - - /** - * 缁熻鏉℃暟 - * @param brandId - * @return - */ - public long countByBrandId(Long brandId){ - if (brandId == null) - return 0; - Query query = new Query(); - query.addCriteria(Criteria.where("brandId").is(brandId)); - return mongoTemplate.count(query, BrandGoodsCahe.class); - } - - - - /** - * 鍝佺墝id - * @param brandId - */ - public void removeByBrandId(Long brandId) { - Query query = new Query(); - query.addCriteria(Criteria.where("brandId").is(brandId)); - mongoTemplate.remove(query, BrandGoodsCahe.class); - } - - - - /** - * 鍒犻櫎鏍规嵁鏃堕棿 - * - * @param id - * @return - */ - public void removeByDate(Long brandId, Integer goodsType, Date createTime) { - Query query = new Query(); - query.addCriteria( - new Criteria().andOperator( - Criteria.where("brandId").is(brandId), - Criteria.where("goodsType").is(goodsType), - Criteria.where("createTime").lt(createTime) - ) - ); - mongoTemplate.remove(query, BrandGoodsCahe.class); - } - - - /** - * 鍒犻櫎鏍规嵁鏃堕棿 - * - * @param id - * @return - */ - public void removeAgoByDate(Date createTime) { - Query query = new Query(); - query.addCriteria(Criteria.where("createTime").lt(createTime)); - mongoTemplate.remove(query, BrandGoodsCahe.class); - } -} +package com.yeshi.fanli.dao.brand; + +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.stereotype.Repository; + +import com.yeshi.common.MongodbBaseDao; +import com.yeshi.fanli.entity.brand.BrandGoodsCahe; + +@Repository +public class BrandGoodsCaheDao extends MongodbBaseDao<BrandGoodsCahe> { + + + /** + * 鏂板 + * @param record + */ + public void insert(BrandGoodsCahe record) { + if (record == null) { + return; + } + mongoTemplate.insert(record); + } + + /** + * 鏌ヨ鍟嗗搧鍒楄〃 + * @param count + * @param brandId + * @return + */ + public List<BrandGoodsCahe> getByBrandId(int start, int count, Long brandId){ + if (brandId == null) + return null; + + Query query = new Query(); + query.addCriteria(Criteria.where("brandId").is(brandId)); + //鍒嗛〉 + query.skip(start).limit(count); + //鎺掑簭 + query.with(new Sort(Sort.Direction.DESC,"weight")); + + return mongoTemplate.find(query, BrandGoodsCahe.class); + } + + + /** + * 缁熻鏉℃暟 + * @param brandId + * @return + */ + public long countByBrandId(Long brandId){ + if (brandId == null) + return 0; + Query query = new Query(); + query.addCriteria(Criteria.where("brandId").is(brandId)); + return mongoTemplate.count(query, BrandGoodsCahe.class); + } + + + + /** + * 鍝佺墝id + * @param brandId + */ + public void removeByBrandId(Long brandId) { + Query query = new Query(); + query.addCriteria(Criteria.where("brandId").is(brandId)); + mongoTemplate.remove(query, BrandGoodsCahe.class); + } + + + + /** + * 鍒犻櫎鏍规嵁鏃堕棿 + * + * @param id + * @return + */ + public void removeByDate(Long brandId, Integer goodsType, Date createTime) { + Query query = new Query(); + query.addCriteria( + new Criteria().andOperator( + Criteria.where("brandId").is(brandId), + Criteria.where("goodsType").is(goodsType), + Criteria.where("createTime").lt(createTime) + ) + ); + mongoTemplate.remove(query, BrandGoodsCahe.class); + } + + + /** + * 鍒犻櫎鏍规嵁鏃堕棿 + * + * @param id + * @return + */ + public void removeAgoByDate(Date createTime) { + Query query = new Query(); + query.addCriteria(Criteria.where("createTime").lt(createTime)); + mongoTemplate.remove(query, BrandGoodsCahe.class); + } +} -- Gitblit v1.8.0