添加订单评价分页--Mongodb
This commit is contained in:
@@ -2,13 +2,18 @@ package cn.iocoder.mall.order.rest.controller.comment;
|
||||
|
||||
import cn.iocoder.common.framework.constant.MallConstants;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.order.biz.dto.comment.OrderCommentPageDTO;
|
||||
import cn.iocoder.mall.order.biz.service.comment.OrderCommentService;
|
||||
import cn.iocoder.mall.order.rest.convert.comment.UsersOrderCommentConvert;
|
||||
import cn.iocoder.mall.order.rest.request.comment.UsersOrderCommentAddRequest;
|
||||
import cn.iocoder.mall.order.rest.request.comment.UsersOrderCommentPageRequest;
|
||||
import cn.iocoder.mall.order.rest.response.comment.UsersOrderCommentPageResponse;
|
||||
import cn.iocoder.mall.security.core.context.UserSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -44,5 +49,15 @@ public class UsersOrderCommentController {
|
||||
UsersOrderCommentConvert.INSTANCE.convert(request)));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "获取订单评论")
|
||||
public CommonResult<PageResult<UsersOrderCommentPageResponse>> page(
|
||||
UsersOrderCommentPageRequest request) {
|
||||
OrderCommentPageDTO orderCommentPageDTO = UsersOrderCommentConvert.INSTANCE
|
||||
.convert(request);
|
||||
return CommonResult.success(UsersOrderCommentConvert.INSTANCE
|
||||
.convert(orderCommentService.page(orderCommentPageDTO)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package cn.iocoder.mall.order.rest.convert.comment;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.order.biz.bo.comment.OrderCommentPageBO;
|
||||
import cn.iocoder.mall.order.biz.dto.comment.OrderCommentAddDTO;
|
||||
import cn.iocoder.mall.order.biz.dto.comment.OrderCommentPageDTO;
|
||||
import cn.iocoder.mall.order.rest.request.comment.UsersOrderCommentAddRequest;
|
||||
import cn.iocoder.mall.order.rest.request.comment.UsersOrderCommentPageRequest;
|
||||
import cn.iocoder.mall.order.rest.response.comment.UsersOrderCommentPageResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -26,4 +31,20 @@ public interface UsersOrderCommentConvert {
|
||||
*/
|
||||
OrderCommentAddDTO convert(UsersOrderCommentAddRequest request);
|
||||
|
||||
/**
|
||||
* 分页参数转换
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
OrderCommentPageDTO convert(UsersOrderCommentPageRequest request);
|
||||
|
||||
/**
|
||||
* 分页转换
|
||||
*
|
||||
* @param pageResult
|
||||
* @return
|
||||
*/
|
||||
PageResult<UsersOrderCommentPageResponse> convert(PageResult<OrderCommentPageBO> pageResult);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.mall.order.rest.request.comment;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* UsersOrderCommentPageRequest
|
||||
*
|
||||
* @author xiaofeng
|
||||
* @version 1.0
|
||||
* @date 2020/05/20 23:21
|
||||
*/
|
||||
@ApiModel("用户 - Order 模块 - 订单评论分页")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersOrderCommentPageRequest extends PageParam {
|
||||
|
||||
/**
|
||||
* 商品 sku id
|
||||
*/
|
||||
@ApiModelProperty(value = "商品 SKU id", required = true)
|
||||
@NotNull(message = "商品 SKU id 不能为空")
|
||||
private Integer productSkuId;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cn.iocoder.mall.order.rest.response.comment;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* UsersOrderCommentPageResponse
|
||||
*
|
||||
* @author xiaofeng
|
||||
* @version 1.0
|
||||
* @date 2020/05/20 23:32
|
||||
*/
|
||||
@ApiModel("用户 - Order 模块 - 订单评论分页列表")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersOrderCommentPageResponse {
|
||||
|
||||
/**
|
||||
* 总条数
|
||||
*/
|
||||
private Integer total;
|
||||
|
||||
/**
|
||||
* 评论列表
|
||||
*/
|
||||
private List<UsersOrderCommentPageResponse.OrderCommentItem> orderCommentItems;
|
||||
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@AllArgsConstructor
|
||||
public static class OrderCommentItem {
|
||||
|
||||
/**
|
||||
* 评论 id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 用户的真实姓名
|
||||
*/
|
||||
private String userNickName;
|
||||
|
||||
/**
|
||||
* 评价星
|
||||
*/
|
||||
private Integer star;
|
||||
|
||||
/**
|
||||
* 评论的内容
|
||||
*/
|
||||
private String commentContent;
|
||||
|
||||
/**
|
||||
* 评论的图片地址
|
||||
*/
|
||||
private String commentPics;
|
||||
|
||||
/**
|
||||
* 回复条数
|
||||
*/
|
||||
private Integer replayCount;
|
||||
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer likeCount;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 商家回复列表 只展示最近的一条
|
||||
*/
|
||||
private String replyContent;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user