From 17a07481c3292e6fcbc7fff3dcbeb8ae817c178c Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 16 Jul 2021 16:16:24 +0800
Subject: [PATCH] Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
---
gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java b/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java
index e8c8c03..69b54b3 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java
@@ -216,6 +216,7 @@
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// ScoreGoods scoreGoods = objectMapper.convertValue(model, ScoreGoods.class);
ScoreGoods scoreGoods = BeanUtil.copyProperties(model, ScoreGoods.class);
+ log.info("抢购时间:{}, {}", scoreGoods.getQgStartTime(), scoreGoods.getQgEndTime());
scoreGoodsMapper.updateByPrimaryKey(scoreGoods);
//轮播图
@@ -318,11 +319,18 @@
PageHelper.startPage(xcxGoodsListDto.getPageNo(), xcxGoodsListDto.getPageSize());
List<XcxGoodsListVo> data = scoreGoodsMapper.selectXcxGoodsList(xcxGoodsListDto);
if(StrUtil.isNotEmpty(xcxGoodsListDto.getName())){
- ScoreGoodsSearch scoreGoodsSearch = new ScoreGoodsSearch();
- scoreGoodsSearch.setUserId(xcxGoodsListDto.getUserId());
- scoreGoodsSearch.setContents(xcxGoodsListDto.getName());
- scoreGoodsSearch.setCreatedTime(new DateTime());
- scoreGoodsSearchMapper.insert(scoreGoodsSearch);
+ Example exampleSearch = new Example(ScoreGoodsSearch.class);
+ Example.Criteria criteriaSearch = exampleSearch.createCriteria();
+ criteriaSearch.andEqualTo("contents",xcxGoodsListDto.getName());
+ criteriaSearch.andEqualTo("userId",xcxGoodsListDto.getUserId());
+ List<ScoreGoodsSearch> scoreGoodsSearches = scoreGoodsSearchMapper.selectByExample(exampleSearch);
+ if(CollUtil.isEmpty(scoreGoodsSearches)){
+ ScoreGoodsSearch scoreGoodsSearch = new ScoreGoodsSearch();
+ scoreGoodsSearch.setUserId(xcxGoodsListDto.getUserId());
+ scoreGoodsSearch.setContents(xcxGoodsListDto.getName());
+ scoreGoodsSearch.setCreatedTime(new Date());
+ scoreGoodsSearchMapper.insert(scoreGoodsSearch);
+ }
}
return new PageInfo<>(data);
}
@@ -363,4 +371,11 @@
criteriaSearch.andEqualTo("userId",userId);
scoreGoodsSearchMapper.deleteByExample(exampleSearch);
}
+
+ public void delAllSearch(String userId) {
+ Example exampleSearch = new Example(ScoreGoodsSearch.class);
+ Example.Criteria criteriaSearch = exampleSearch.createCriteria();
+ criteriaSearch.andEqualTo("userId",userId);
+ scoreGoodsSearchMapper.deleteByExample(exampleSearch);
+ }
}
--
Gitblit v1.9.1