|
|
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.mapper.GoodsDonQaMapper;
|
|
|
import com.cyksj.mapper.GoodsDonQaRelateMapper;
|
|
|
-import com.cyksj.model.entity.GoodsDon;
|
|
|
import com.cyksj.model.entity.GoodsDonQa;
|
|
|
import com.cyksj.model.entity.GoodsDonQaRelate;
|
|
|
import com.cyksj.service.mange.GoodsDonQaService;
|
|
|
@@ -17,7 +16,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 项目名: yhlxj2
|
|
|
@@ -36,9 +34,10 @@ public class GoodsDonQaServiceImpl extends ServiceImpl<GoodsDonQaMapper, GoodsDo
|
|
|
checkQAParams(goodsDonQa);
|
|
|
|
|
|
Long id = goodsDonQa.getId();
|
|
|
- List<Long> goodsIds = goodsDonQa.getGoodsDons().stream().map(GoodsDon::getId).collect(Collectors.toList());
|
|
|
+ List<Long> goodsIds = goodsDonQa.getGoodsIds();
|
|
|
if (id != null) {
|
|
|
goodsDonQaRelateMapper.delete(Wrappers.lambdaQuery(GoodsDonQaRelate.class).notIn(GoodsDonQaRelate::getGoodsId, goodsIds).eq(GoodsDonQaRelate::getQuestionId, id));
|
|
|
+ this.updateById(goodsDonQa);
|
|
|
} else {
|
|
|
this.save(goodsDonQa);
|
|
|
id = goodsDonQa.getId();
|
|
|
@@ -66,8 +65,8 @@ public class GoodsDonQaServiceImpl extends ServiceImpl<GoodsDonQaMapper, GoodsDo
|
|
|
if (StrUtil.isNotBlank(content)) {
|
|
|
goodsDonQa.setUrl(null);
|
|
|
}
|
|
|
- List<GoodsDon> goodsDons = goodsDonQa.getGoodsDons();
|
|
|
- if (CollUtil.isEmpty(goodsDons)) {
|
|
|
+ List<Long> goodsIds = goodsDonQa.getGoodsIds();
|
|
|
+ if (CollUtil.isEmpty(goodsIds)) {
|
|
|
throw BusinessRuntimeException.getInstance("请选择对应展示平台");
|
|
|
}
|
|
|
}
|
|
|
@@ -75,7 +74,7 @@ public class GoodsDonQaServiceImpl extends ServiceImpl<GoodsDonQaMapper, GoodsDo
|
|
|
@Override
|
|
|
public GoodsDonQa getDetailById(Long id) {
|
|
|
GoodsDonQa byId = this.getById(id);
|
|
|
- byId.setGoodsDons(goodsDonQaRelateMapper.getQaGoodsByQaId(id));
|
|
|
+ byId.setGoodsIds(goodsDonQaRelateMapper.getQaGoodsByQaId(id));
|
|
|
return byId;
|
|
|
}
|
|
|
}
|