bug:评论显示问题

This commit is contained in:
xuwenbo
2020-05-18 19:21:35 +08:00
parent 4c7aa7a479
commit b1add77a43
3 changed files with 45 additions and 16 deletions

View File

@ -83,6 +83,11 @@ public class YxStoreProductReply implements Serializable {
/** 0未回复1已回复 */
private Integer isReply;
@TableField(exist = false)
private YxStoreProduct storeProduct;
@TableField(exist = false)
private YxUser user;
public void copy(YxStoreProductReply source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));

View File

@ -18,48 +18,53 @@ import java.io.Serializable;
@Data
public class YxStoreProductReplyDto implements Serializable {
/** 评论ID */
// 评论ID
private Integer id;
/** 用户ID */
// 用户ID
private Integer uid;
/** 订单ID */
private YxUserSmallDto user;
// 订单ID
private Integer oid;
/** 唯一id */
// 唯一id
private String unique;
/** 产品id */
// 产品id
private Integer productId;
/** 某种商品类型(普通商品、秒杀商品) */
private YxStoreProductSmallDto storeProduct;
// 某种商品类型(普通商品、秒杀商品)
private String replyType;
/** 商品分数 */
// 商品分数
private Integer productScore;
/** 服务分数 */
// 服务分数
private Integer serviceScore;
/** 评论内容 */
// 评论内容
private String comment;
/** 评论图片 */
// 评论图片
private String pics;
/** 评论时间 */
// 评论时间
private Integer addTime;
/** 管理员回复内容 */
// 管理员回复内容
private String merchantReplyContent;
/** 管理员回复时间 */
// 管理员回复时间
private Integer merchantReplyTime;
/** 0未删除1已删除 */
// 0未删除1已删除
private Integer isDel;
/** 0未回复1已回复 */
// 0未回复1已回复
private Integer isReply;
}

View File

@ -8,8 +8,12 @@
*/
package co.yixiang.modules.shop.service.impl;
import co.yixiang.modules.shop.domain.YxStoreProduct;
import co.yixiang.modules.shop.domain.YxStoreProductReply;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.modules.shop.domain.YxUser;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.YxUserService;
import lombok.AllArgsConstructor;
import co.yixiang.dozer.service.IGenerator;
import com.github.pagehelper.PageInfo;
@ -19,6 +23,7 @@ import co.yixiang.modules.shop.service.YxStoreProductReplyService;
import co.yixiang.modules.shop.service.dto.YxStoreProductReplyDto;
import co.yixiang.modules.shop.service.dto.YxStoreProductReplyQueryCriteria;
import co.yixiang.modules.shop.service.mapper.StoreProductReplyMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -34,6 +39,8 @@ import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/**
* @author hupeng
@ -47,6 +54,10 @@ public class YxStoreProductReplyServiceImpl extends BaseServiceImpl<StoreProduct
private final IGenerator generator;
private final YxUserService yxUserService;
private final YxStoreProductService yxStoreProductService;
@Override
//@Cacheable
public Map<String, Object> queryAll(YxStoreProductReplyQueryCriteria criteria, Pageable pageable) {
@ -62,7 +73,15 @@ public class YxStoreProductReplyServiceImpl extends BaseServiceImpl<StoreProduct
@Override
//@Cacheable
public List<YxStoreProductReply> queryAll(YxStoreProductReplyQueryCriteria criteria){
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProductReply.class, criteria));
List<YxStoreProductReply> storeProductReplyList = baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProductReply.class, criteria));
List<YxStoreProductReply> storeProductReplys = storeProductReplyList.stream().map(i ->{
YxStoreProductReply yxStoreProductReply = new YxStoreProductReply();
BeanUtils.copyProperties(i,yxStoreProductReply);
yxStoreProductReply.setUser(yxUserService.getById(yxStoreProductReply.getUid()));;
yxStoreProductReply.setStoreProduct(yxStoreProductService.getById(yxStoreProductReply.getProductId()));
return yxStoreProductReply;
}).collect(Collectors.toList());
return storeProductReplys;
}