|
|
@@ -144,6 +144,23 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
vo.setTotalExamNum(totalNum);
|
|
|
}
|
|
|
}
|
|
|
+ list.forEach(goods -> {
|
|
|
+ if (ObjectUtils.isNotNull(goods.getSpecTemplateId()) &&
|
|
|
+ goodsSpecTemplateService.count(new LambdaQueryWrapper<GoodsSpecTemplate>()
|
|
|
+ .eq(GoodsSpecTemplate::getSpecTemplateId,goods.getSpecTemplateId())
|
|
|
+ .eq(GoodsSpecTemplate::getStatus,1)) > 0){
|
|
|
+ goods.setSpecTemplateId(goods.getSpecTemplateId());
|
|
|
+ }else {
|
|
|
+ List<GoodsSpecAttributeRelation> relationList = goodsSpecAttributeRelationService.list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
|
|
|
+ .eq(GoodsSpecAttributeRelation::getGoodsId, goods.getGoodsId())
|
|
|
+ .orderByAsc(GoodsSpecAttributeRelation::getCreateTime)
|
|
|
+ .last("LIMIT 1"));
|
|
|
+ if (CollectionUtils.isNotEmpty(relationList)){
|
|
|
+ GoodsSpecAttributeRelation relation = relationList.stream().findFirst().get();
|
|
|
+ goods.setSpecTemplateId(relation.getSpecTemplateId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
//继教二建统计学时
|
|
|
if (Validator.isNotEmpty(bo.getChapterNum())) {
|
|
|
list.forEach(goodsVo -> {
|
|
|
@@ -194,7 +211,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Override
|
|
|
public GoodsVo selectDetail(Long goodsId) {
|
|
|
GoodsVo goodsVo = baseMapper.selectDetail(goodsId);
|
|
|
- if (ObjectUtils.isNotNull(goodsVo) && ObjectUtils.isNull(goodsVo.getSpecTemplateId())){
|
|
|
+ if (ObjectUtils.isNull(goodsVo.getSpecTemplateId()) ||
|
|
|
+ goodsSpecTemplateService.count(new LambdaQueryWrapper<GoodsSpecTemplate>()
|
|
|
+ .eq(GoodsSpecTemplate::getSpecTemplateId,goodsVo.getSpecTemplateId())
|
|
|
+ .eq(GoodsSpecTemplate::getStatus,1)) < 1){
|
|
|
//没有绑定规格模板
|
|
|
//查询是否有绑定的模板
|
|
|
List<GoodsSpecAttributeRelation> list = goodsSpecAttributeRelationService
|