|
@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.miaxis.common.core.domain.Response;
|
|
|
import com.miaxis.common.utils.bean.BeanUtils;
|
|
|
-import com.miaxis.customer.domain.CustomerInfo;
|
|
|
+import com.miaxis.file.service.IFileInfoService;
|
|
|
import com.miaxis.goods.domain.GoodsInfo;
|
|
|
+import com.miaxis.goods.mapper.GoodsInfoMapper;
|
|
|
import com.miaxis.goods.service.IGoodsInfoService;
|
|
|
+import com.miaxis.goods.vo.GoodsInfoVo;
|
|
|
import com.miaxis.topic.domain.TopicInfo;
|
|
|
import com.miaxis.topic.dto.TopicInfoDto;
|
|
|
import com.miaxis.topic.mapper.TopicInfoMapper;
|
|
@@ -19,7 +21,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -37,6 +38,10 @@ public class TopicInfoServiceImpl extends ServiceImpl<TopicInfoMapper, TopicInfo
|
|
|
|
|
|
private final IGoodsInfoService goodsInfoService;
|
|
|
|
|
|
+ private final GoodsInfoMapper goodsInfoMapper;
|
|
|
+
|
|
|
+ private final IFileInfoService fileInfoService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询专题列表
|
|
|
*
|
|
@@ -46,18 +51,15 @@ public class TopicInfoServiceImpl extends ServiceImpl<TopicInfoMapper, TopicInfo
|
|
|
@Override
|
|
|
public List<TopicInfoVo> selectTopicInfoList(TopicInfoVo topicInfoVo){
|
|
|
|
|
|
- ArrayList<TopicInfoVo> topicInfoVos = new ArrayList<>();
|
|
|
//专题列表
|
|
|
- List<TopicInfo> topicInfos = topicInfoMapper.selectTopicInfoList(topicInfoVo);
|
|
|
-
|
|
|
- for (TopicInfo topic : topicInfos) {
|
|
|
- TopicInfoVo topicInfoVo1 = new TopicInfoVo();
|
|
|
- BeanUtils.copyProperties(topic,topicInfoVo1);
|
|
|
- topicInfoVo1.setGoodsInfoList(goodsInfoService.listByMap(new HashMap<String, Object>(){{
|
|
|
- put("status",0);
|
|
|
- put("topic_id",topic.getId());
|
|
|
- }}));
|
|
|
- topicInfoVos.add(topicInfoVo1);
|
|
|
+ List<TopicInfoVo> topicInfoVos = topicInfoMapper.selectTopicInfoList(topicInfoVo);
|
|
|
+
|
|
|
+ for (TopicInfoVo topic : topicInfoVos) {
|
|
|
+ //查询对应商品
|
|
|
+ List<GoodsInfoVo> goodsInfoVoList = goodsInfoMapper.getGoodsInfoListByTopicId(topic.getId());
|
|
|
+ if (goodsInfoVoList.size() > 0){
|
|
|
+ topic.setGoodsInfoList(goodsInfoVoList);
|
|
|
+ }
|
|
|
}
|
|
|
return topicInfoVos;
|
|
|
}
|
|
@@ -94,7 +96,6 @@ public class TopicInfoServiceImpl extends ServiceImpl<TopicInfoMapper, TopicInfo
|
|
|
@SneakyThrows
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Response<Integer> removeTopicByIds(Long[] ids) {
|
|
|
-
|
|
|
for (Long id : ids) {
|
|
|
//删除专题
|
|
|
this.update(new UpdateWrapper<TopicInfo>().set("status",1).eq("id",id));
|
|
@@ -111,11 +112,9 @@ public class TopicInfoServiceImpl extends ServiceImpl<TopicInfoMapper, TopicInfo
|
|
|
*/
|
|
|
@Override
|
|
|
@SneakyThrows
|
|
|
- public Response getTopicById(Long id) {
|
|
|
- TopicInfoVo topicInfoVo = new TopicInfoVo();
|
|
|
- TopicInfo topicInfo = this.getById(id);
|
|
|
- BeanUtils.copyProperties(topicInfo,topicInfoVo);
|
|
|
- topicInfoVo.setGoodsInfoList(goodsInfoService.list(new QueryWrapper<GoodsInfo>().eq("status",0).eq("topic_id",topicInfo.getId())));
|
|
|
+ public Response getTopicDetailsById(Long id) {
|
|
|
+ TopicInfoVo topicInfoVo = topicInfoMapper.getTopicDetailsById(id);
|
|
|
+ topicInfoVo.setGoodsInfoList(goodsInfoMapper.getGoodsInfoListByTopicId(topicInfoVo.getId()));
|
|
|
return Response.success(topicInfoVo);
|
|
|
}
|
|
|
|