From 1bada3da32aa8b29509b7357e5adfe816ac17c72 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 16 Jul 2021 10:29:33 +0800
Subject: [PATCH] fix
---
gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java | 39 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 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 d66a17b..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
@@ -3,9 +3,11 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
@@ -42,6 +44,8 @@
ScoreGoodsImagesMapper scoreGoodsImagesMapper;
@Resource
ScoreGoodsStyleMapper scoreGoodsStyleMapper;
+ @Resource
+ ScoreGoodsSearchMapper scoreGoodsSearchMapper;
@Autowired
private MqUtil mqUtil;
@@ -212,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);
//轮播图
@@ -313,7 +318,20 @@
PageHelper.startPage(xcxGoodsListDto.getPageNo(), xcxGoodsListDto.getPageSize());
List<XcxGoodsListVo> data = scoreGoodsMapper.selectXcxGoodsList(xcxGoodsListDto);
-
+ if(StrUtil.isNotEmpty(xcxGoodsListDto.getName())){
+ 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);
}
@@ -341,4 +359,23 @@
}
return data;
}
+
+ public List<GoodsSearchVo> goodsSearch(GoodsSearchDto goodsSearchDto) {
+ return scoreGoodsSearchMapper.goodsSearch(goodsSearchDto);
+ }
+
+ public void delGoodsSearch(Long id, String userId) {
+ Example exampleSearch = new Example(ScoreGoodsSearch.class);
+ Example.Criteria criteriaSearch = exampleSearch.createCriteria();
+ criteriaSearch.andEqualTo("id",id);
+ 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