提交修改
This commit is contained in:
parent
02a31b224f
commit
5644fd8fe1
@ -67,4 +67,22 @@ public interface VvCommentDao extends BaseMapper<VvCommentEntity> {
|
|||||||
@IF @OrderBy(VvCommentEntity.create_timestamp) String createTimestampSort);
|
@IF @OrderBy(VvCommentEntity.create_timestamp) String createTimestampSort);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OrderBy(VvCommentEntity.id_)
|
||||||
|
List<VvCommentEntity> selectNotLogin(IPage page,
|
||||||
|
@IF Long productId,
|
||||||
|
@IF String status,
|
||||||
|
@IF @OrderBy(VvCommentEntity.create_timestamp) String createTimestampSort);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OrderBy(VvCommentEntity.id_)
|
||||||
|
List<VvCommentEntity> selectLogin(IPage page,
|
||||||
|
@IF Long productId,
|
||||||
|
@LBracket Long buyerId,
|
||||||
|
@OR @RBracket String status,
|
||||||
|
@IF @OrderBy(VvCommentEntity.create_timestamp) String createTimestampSort);
|
||||||
}
|
}
|
||||||
@ -10,6 +10,7 @@ package com.heyu.api.data.dao.vv;
|
|||||||
import com.heyu.api.data.entity.vv.VvCommentDetailEntity;
|
import com.heyu.api.data.entity.vv.VvCommentDetailEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||||
|
import com.lz.mybatis.plugin.annotations.OrderType;
|
||||||
import com.lz.mybatis.plugin.annotations.Realy;
|
import com.lz.mybatis.plugin.annotations.Realy;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -46,4 +47,10 @@ public interface VvCommentDetailDao extends BaseMapper<VvCommentDetailEntity> {
|
|||||||
*/
|
*/
|
||||||
@OrderBy(VvCommentDetailEntity.id_)
|
@OrderBy(VvCommentDetailEntity.id_)
|
||||||
List<VvCommentDetailEntity> selectVvCommentDetailByCommentId(Long commentId);
|
List<VvCommentDetailEntity> selectVvCommentDetailByCommentId(Long commentId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OrderBy(value={VvCommentDetailEntity.id_} , type={OrderType.ASC})
|
||||||
|
List<VvCommentDetailEntity> selectVvCommentDetailByProductId(Long productId);
|
||||||
}
|
}
|
||||||
@ -28,6 +28,7 @@ private static final long serialVersionUID = 1L;
|
|||||||
public final static String comment_url = CLASS_NAME + "comment_url"; // 评论url
|
public final static String comment_url = CLASS_NAME + "comment_url"; // 评论url
|
||||||
public final static String comment_id = CLASS_NAME + "comment_id"; // 评论id
|
public final static String comment_id = CLASS_NAME + "comment_id"; // 评论id
|
||||||
public final static String type_ = CLASS_NAME + "type"; // image or video
|
public final static String type_ = CLASS_NAME + "type"; // image or video
|
||||||
|
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
|
||||||
//
|
//
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
@ -43,6 +44,8 @@ private static final long serialVersionUID = 1L;
|
|||||||
private Long commentId;
|
private Long commentId;
|
||||||
//image or video
|
//image or video
|
||||||
private String type;
|
private String type;
|
||||||
|
//商品id
|
||||||
|
private Long productId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -148,6 +151,21 @@ private static final long serialVersionUID = 1L;
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Long getProductId() {
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
* @param productId
|
||||||
|
*/
|
||||||
|
public void setProductId(Long productId) {
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VvCommentDetailEntity{" +
|
return "VvCommentDetailEntity{" +
|
||||||
@ -158,6 +176,7 @@ private static final long serialVersionUID = 1L;
|
|||||||
",commentUrl=" + commentUrl +
|
",commentUrl=" + commentUrl +
|
||||||
",commentId=" + commentId +
|
",commentId=" + commentId +
|
||||||
",type=" + type +
|
",type=" + type +
|
||||||
|
",productId=" + productId +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class MysqlMain_update {
|
|||||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||||
|
|
||||||
|
|
||||||
String a = "vv_comment";
|
String a = "vv_comment_detail";
|
||||||
for (String s : a.split(",")) {
|
for (String s : a.split(",")) {
|
||||||
list.add(new TablesBean(s));
|
list.add(new TablesBean(s));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package com.test.xxx.mysql;
|
package com.test.xxx.mysql;
|
||||||
|
|
||||||
import com.heyu.api.data.dao.vv.VvBuyerAddressDao;
|
import com.heyu.api.data.dao.vv.VvCommentDao;
|
||||||
import com.lz.mybatis.plugin.utils.TestParseUtils;
|
import com.lz.mybatis.plugin.utils.TestParseUtils;
|
||||||
import com.lz.mybatis.plugin.utils.t.Tuple2;
|
import com.lz.mybatis.plugin.utils.t.Tuple2;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -12,7 +12,7 @@ SqlParseUtilsTest {
|
|||||||
public void test1() {
|
public void test1() {
|
||||||
|
|
||||||
|
|
||||||
Tuple2<Boolean, String> tuple = TestParseUtils.testSql(VvBuyerAddressDao::updateVvBuyerAddressStatusById).getData();
|
Tuple2<Boolean, String> tuple = TestParseUtils.testSql(VvCommentDao::selectLogin).getData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.heyu.api.alibaba.request.vv;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AppCommentAdd {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* sku id
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
|
||||||
|
|
||||||
|
//买家id
|
||||||
|
private Long buyerId;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long tradeOrderId;
|
||||||
|
|
||||||
|
|
||||||
|
//商品评论的内容
|
||||||
|
private String productComment;
|
||||||
|
|
||||||
|
|
||||||
|
//服务评论内容
|
||||||
|
private String serviceComment;
|
||||||
|
|
||||||
|
//描述相符
|
||||||
|
private Integer descMatch;
|
||||||
|
//卖家服务
|
||||||
|
private Integer sellerService;
|
||||||
|
//物流服务
|
||||||
|
private Integer logisticsService;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 评论具体的值
|
||||||
|
*/
|
||||||
|
private List<AppCommentDetail> commentDetailList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
package com.heyu.api.alibaba.request.vv;
|
||||||
|
|
||||||
|
public class AppCommentDelete {
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.heyu.api.alibaba.request.vv;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AppCommentDetail {
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* image or video
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 具体的值 , video 的具体值
|
||||||
|
*/
|
||||||
|
private String commentUrl;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.heyu.api.alibaba.request.vv;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AppCommentRequest {
|
||||||
|
|
||||||
|
private int pageNum = 1;
|
||||||
|
|
||||||
|
|
||||||
|
private int pageSize = 10;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//买家id
|
||||||
|
private Long buyerId;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private String createTimestampSort;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
package com.heyu.api.alibaba.request.vv;
|
||||||
|
|
||||||
|
public class AppCommentUseful {
|
||||||
|
}
|
||||||
@ -109,6 +109,7 @@ public class CommentController {
|
|||||||
if (CollectionUtils.isNotEmpty(vvCommentDTO.getVvCommentDetailEntities())) {
|
if (CollectionUtils.isNotEmpty(vvCommentDTO.getVvCommentDetailEntities())) {
|
||||||
for (VvCommentDetailEntity vvCommentDetailEntity : vvCommentDTO.getVvCommentDetailEntities()) {
|
for (VvCommentDetailEntity vvCommentDetailEntity : vvCommentDTO.getVvCommentDetailEntities()) {
|
||||||
vvCommentDetailEntity.setCommentId(vvCommentEntity.getId());
|
vvCommentDetailEntity.setCommentId(vvCommentEntity.getId());
|
||||||
|
vvCommentDetailEntity.setProductId(vvCommentEntity.getProductId());
|
||||||
vvCommentDetailDao.insertOrUpdateVvCommentDetail(vvCommentDetailEntity);
|
vvCommentDetailDao.insertOrUpdateVvCommentDetail(vvCommentDetailEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,138 @@
|
|||||||
|
package com.heyu.api.controller.vv;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.heyu.api.alibaba.request.mm.enums.CommentStatusEnums;
|
||||||
|
import com.heyu.api.alibaba.request.vv.AppCommentAdd;
|
||||||
|
import com.heyu.api.alibaba.request.vv.AppCommentDelete;
|
||||||
|
import com.heyu.api.alibaba.request.vv.AppCommentRequest;
|
||||||
|
import com.heyu.api.alibaba.request.vv.AppCommentUseful;
|
||||||
|
import com.heyu.api.data.dao.vv.VvCommentDao;
|
||||||
|
import com.heyu.api.data.dao.vv.VvCommentDetailDao;
|
||||||
|
import com.heyu.api.data.dto.vv.VvCommentDTO;
|
||||||
|
import com.heyu.api.data.entity.vv.VvCommentDetailEntity;
|
||||||
|
import com.heyu.api.data.entity.vv.VvCommentEntity;
|
||||||
|
import com.heyu.api.data.utils.R;
|
||||||
|
import com.heyu.api.utils.ISelect;
|
||||||
|
import com.heyu.api.utils.PPageUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/comment")
|
||||||
|
public class AppCommentController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvCommentDao vvCommentDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvCommentDetailDao vvCommentDetailDao;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("/page/list")
|
||||||
|
public R list(@RequestBody AppCommentRequest appCommentRequest) {
|
||||||
|
|
||||||
|
PPageUtils pageUtils = null;
|
||||||
|
|
||||||
|
// /***
|
||||||
|
// * 状态 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过,如果审批未通过,即自己可见,但别人不可见
|
||||||
|
// */
|
||||||
|
// private String status;
|
||||||
|
|
||||||
|
if (appCommentRequest.getBuyerId() != null) {
|
||||||
|
pageUtils = PPageUtils.startPage(appCommentRequest.getPageNum(), appCommentRequest.getPageSize())
|
||||||
|
.doSelect(new ISelect() {
|
||||||
|
@Override
|
||||||
|
public List doSelect(IPage page) {
|
||||||
|
return vvCommentDao.selectLogin(page,
|
||||||
|
appCommentRequest.getProductId(),
|
||||||
|
appCommentRequest.getBuyerId(),
|
||||||
|
CommentStatusEnums.approval_pass.getStatus(),
|
||||||
|
appCommentRequest.getCreateTimestampSort()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
pageUtils = PPageUtils.startPage(appCommentRequest.getPageNum(), appCommentRequest.getPageSize())
|
||||||
|
.doSelect(new ISelect() {
|
||||||
|
@Override
|
||||||
|
public List doSelect(IPage page) {
|
||||||
|
return vvCommentDao.selectNotLogin(page,
|
||||||
|
appCommentRequest.getProductId(),
|
||||||
|
CommentStatusEnums.approval_pass.getStatus(),
|
||||||
|
appCommentRequest.getCreateTimestampSort()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
List<VvCommentEntity> vvCommentEntities = pageUtils.getRows();
|
||||||
|
|
||||||
|
List<VvCommentDTO> vvCommentDTOS = new ArrayList<>();
|
||||||
|
|
||||||
|
List<VvCommentDetailEntity> vvCommentDetailEntities = vvCommentDetailDao.selectVvCommentDetailByProductId(appCommentRequest.getProductId());
|
||||||
|
Map<Long, List<VvCommentDetailEntity>> vvDetailMap = new HashMap<>();
|
||||||
|
for (VvCommentDetailEntity vvCommentDetailEntity : vvCommentDetailEntities) {
|
||||||
|
|
||||||
|
List<VvCommentDetailEntity> commentDetailEntities = vvDetailMap.get(vvCommentDetailEntity.getCommentId());
|
||||||
|
if (commentDetailEntities == null) {
|
||||||
|
commentDetailEntities = new ArrayList<>();
|
||||||
|
}
|
||||||
|
commentDetailEntities.add(vvCommentDetailEntity);
|
||||||
|
vvDetailMap.put(vvCommentDetailEntity.getCommentId(), commentDetailEntities);
|
||||||
|
|
||||||
|
}
|
||||||
|
for (VvCommentEntity vvCommentEntity : vvCommentEntities) {
|
||||||
|
|
||||||
|
VvCommentDTO vvCommentDTO = new VvCommentDTO();
|
||||||
|
BeanUtils.copyProperties(vvCommentEntity, vvCommentDTO);
|
||||||
|
|
||||||
|
List<VvCommentDetailEntity> list = vvDetailMap.get(vvCommentEntity.getId());
|
||||||
|
vvCommentDTO.setVvCommentDetailEntities(list);
|
||||||
|
vvCommentDTOS.add(vvCommentDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return R.ok().setData(vvCommentDTOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RequestMapping("/add")
|
||||||
|
public R add(@RequestBody AppCommentAdd appCommentRequest) {
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RequestMapping("/useful")
|
||||||
|
public R useful(@RequestBody AppCommentUseful appCommentRequest) {
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@RequestMapping("/delete")
|
||||||
|
public R list(@RequestBody AppCommentDelete appCommentRequest) {
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user