🐛 修复创建订单评论的 scores、replyStatus 默认值未填写的问题

This commit is contained in:
YunaiV 2023-12-14 22:00:04 +08:00
parent c1429dd3a0
commit 8913572e51

View File

@ -84,26 +84,27 @@ public interface ProductCommentConvert {
return divide.intValue(); return divide.intValue();
} }
ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO);
@Mapping(target = "scores", @Mapping(target = "scores",
expression = "java(convertScores(createReqDTO.getDescriptionScores(), createReqDTO.getBenefitScores()))") expression = "java(convertScores(createReqDTO.getDescriptionScores(), createReqDTO.getBenefitScores()))")
default ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO, ProductSpuDO spuDO, ProductSkuDO skuDO, MemberUserRespDTO user) { ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO);
ProductCommentDO commentDO = convert(createReqDTO);
default ProductCommentDO convert(ProductCommentCreateReqDTO createReqDTO,
ProductSpuDO spu, ProductSkuDO sku, MemberUserRespDTO user) {
ProductCommentDO comment = convert(createReqDTO).setReplyStatus(false);
if (user != null) { if (user != null) {
commentDO.setUserId(user.getId()); comment.setUserId(user.getId());
commentDO.setUserNickname(user.getNickname()); comment.setUserNickname(user.getNickname());
commentDO.setUserAvatar(user.getAvatar()); comment.setUserAvatar(user.getAvatar());
} }
if (spuDO != null) { if (spu != null) {
commentDO.setSpuId(spuDO.getId()); comment.setSpuId(spu.getId());
commentDO.setSpuName(spuDO.getName()); comment.setSpuName(spu.getName());
} }
if (skuDO != null) { if (sku != null) {
commentDO.setSkuPicUrl(skuDO.getPicUrl()); comment.setSkuPicUrl(sku.getPicUrl());
commentDO.setSkuProperties(skuDO.getProperties()); comment.setSkuProperties(sku.getProperties());
} }
return commentDO; return comment;
} }
@Mapping(target = "visible", constant = "true") @Mapping(target = "visible", constant = "true")