master
parent
9cdc8de414
commit
73f55015c6
|
@ -17,6 +17,8 @@ import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||||
import com.muyu.product.domain.model.RuleInfoAddModel;
|
import com.muyu.product.domain.model.RuleInfoAddModel;
|
||||||
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
import com.muyu.product.domain.req.RuleInfoQueryReq;
|
||||||
import com.muyu.product.domain.resp.RuleInfoResp;
|
import com.muyu.product.domain.resp.RuleInfoResp;
|
||||||
|
import com.muyu.product.domain.resp.RuleInfoUpdResp;
|
||||||
|
import com.muyu.product.mapper.RuleInfoUpdMapper;
|
||||||
import com.muyu.product.service.RuleAttrInfoService;
|
import com.muyu.product.service.RuleAttrInfoService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -40,6 +42,9 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
|
||||||
@Autowired
|
@Autowired
|
||||||
private RuleAttrInfoService ruleAttrInfoService;
|
private RuleAttrInfoService ruleAttrInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RuleInfoUpdMapper ruleInfoUpdMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询商品规格列表
|
* 查询商品规格列表
|
||||||
*
|
*
|
||||||
|
@ -107,4 +112,30 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
|
||||||
.total(isPage ? new PageInfo<>(list).getTotal() : 0)
|
.total(isPage ? new PageInfo<>(list).getTotal() : 0)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RuleInfoUpdResp getUpdById(Long id) {
|
||||||
|
RuleInfo byId = this.getById(id);
|
||||||
|
LambdaQueryWrapper<RuleAttrInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(RuleAttrInfo::getRuleId, id);
|
||||||
|
List<RuleAttrInfo> list = ruleAttrInfoService.list(queryWrapper);
|
||||||
|
return RuleInfoUpdResp.builder()
|
||||||
|
.id(byId.getId())
|
||||||
|
.name(byId.getName())
|
||||||
|
.remark(byId.getRemark())
|
||||||
|
.status(byId.getStatus())
|
||||||
|
.ruleAttrList(list.stream().map(RuleAttrAddModel::infoBuild).toList()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRuleInfo(Long id, RuleInfoUpdResp ruleInfoUpdResp) {
|
||||||
|
ruleInfoUpdMapper.delRuleInfo(id);
|
||||||
|
|
||||||
|
List<RuleAttrAddModel> ruleAttrList = ruleInfoUpdResp.getRuleAttrList();
|
||||||
|
for (RuleAttrAddModel ruleAttrAddModel : ruleAttrList) {
|
||||||
|
List<String> valueList = ruleAttrAddModel.getValueList();
|
||||||
|
String join = String.join(",", valueList);
|
||||||
|
ruleInfoUpdMapper.addRuleInfo(id,ruleInfoUpdResp.getName(),join);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue