提交修改
This commit is contained in:
parent
3c280887e5
commit
f3c2f16009
@ -7,10 +7,17 @@ package com.heyu.api.data.dao.vv;
|
|||||||
* @author quyixiao
|
* @author quyixiao
|
||||||
* @since 2025-08-25
|
* @since 2025-08-25
|
||||||
*/
|
*/
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.heyu.api.data.entity.vv.VvCommentEntity;
|
import com.heyu.api.data.entity.vv.VvCommentEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.lz.mybatis.plugin.annotations.IF;
|
||||||
|
import com.lz.mybatis.plugin.annotations.LIKE;
|
||||||
|
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface VvCommentDao extends BaseMapper<VvCommentEntity> {
|
public interface VvCommentDao extends BaseMapper<VvCommentEntity> {
|
||||||
|
|
||||||
@ -30,7 +37,15 @@ public interface VvCommentDao extends BaseMapper<VvCommentEntity> {
|
|||||||
int updateCoverVvCommentById(VvCommentEntity vvComment);
|
int updateCoverVvCommentById(VvCommentEntity vvComment);
|
||||||
|
|
||||||
|
|
||||||
int deleteVvCommentById(@Param("id")Long id);
|
int deleteVvCommentById(@Param("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
@OrderBy(VvCommentEntity.id_)
|
||||||
|
List<VvCommentEntity> selectVvCommentByCondition(IPage page,
|
||||||
|
@IF Long productId,
|
||||||
|
@IF @LIKE Long productName,
|
||||||
|
@IF Long skuId,
|
||||||
|
@IF Long tradeOrderId,
|
||||||
|
@IF String status,
|
||||||
|
@IF @OrderBy(VvCommentEntity.create_timestamp) String createTimestampSort);
|
||||||
}
|
}
|
||||||
@ -9,8 +9,13 @@ 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.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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface VvCommentDetailDao extends BaseMapper<VvCommentDetailEntity> {
|
public interface VvCommentDetailDao extends BaseMapper<VvCommentDetailEntity> {
|
||||||
|
|
||||||
@ -30,7 +35,15 @@ public interface VvCommentDetailDao extends BaseMapper<VvCommentDetailEntity> {
|
|||||||
int updateCoverVvCommentDetailById(VvCommentDetailEntity vvCommentDetail);
|
int updateCoverVvCommentDetailById(VvCommentDetailEntity vvCommentDetail);
|
||||||
|
|
||||||
|
|
||||||
|
@Realy
|
||||||
int deleteVvCommentDetailById(@Param("id")Long id);
|
int deleteVvCommentDetailById(@Param("id")Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param commentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@OrderBy(VvCommentDetailEntity.id_)
|
||||||
|
List<VvCommentDetailEntity> selectVvCommentDetailByCommentId(Long commentId);
|
||||||
}
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.heyu.api.data.dto.vv;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.heyu.api.data.entity.vv.VvCommentDetailEntity;
|
||||||
|
import com.heyu.api.data.entity.vv.VvCommentEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VvCommentDTO extends VvCommentEntity {
|
||||||
|
|
||||||
|
private List<VvCommentDetailEntity> vvCommentDetailEntities;
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
VvCommentDTO vvCommentDTO = new VvCommentDTO();
|
||||||
|
|
||||||
|
vvCommentDTO.setContent("testn");
|
||||||
|
|
||||||
|
vvCommentDTO.setTradeOrderId(10L);
|
||||||
|
|
||||||
|
vvCommentDTO.setSkuId(20L);
|
||||||
|
|
||||||
|
vvCommentDTO.setProductId(4L);
|
||||||
|
|
||||||
|
vvCommentDTO.setProductTitle("test");
|
||||||
|
|
||||||
|
vvCommentDTO.setSkuInfo("3w893");
|
||||||
|
|
||||||
|
vvCommentDTO.setStatus("wait_approval");
|
||||||
|
|
||||||
|
vvCommentDTO.setCreateTimestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
|
List<VvCommentDetailEntity> vvCommentDetailEntities = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VvCommentDetailEntity vvCommentDetailEntity = new VvCommentDetailEntity();
|
||||||
|
|
||||||
|
vvCommentDetailEntity.setCommentUrl("ewieow");
|
||||||
|
vvCommentDetailEntity.setType("image");
|
||||||
|
|
||||||
|
vvCommentDetailEntities.add(vvCommentDetailEntity);
|
||||||
|
|
||||||
|
vvCommentDTO.setVvCommentDetailEntities(vvCommentDetailEntities);
|
||||||
|
|
||||||
|
System.out.println(JSON.toJSONString(vvCommentDTO));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +1,11 @@
|
|||||||
package com.heyu.api.data.entity.vv;
|
package com.heyu.api.data.entity.vv;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import com.lz.mybatis.plugin.annotations.AS;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.util.Date;
|
||||||
import java.util.Date;import java.util.Date;
|
|
||||||
/**
|
/**
|
||||||
*评论表
|
*评论表
|
||||||
* @author quyixiao
|
* @author quyixiao
|
||||||
@ -21,17 +20,18 @@ private static final long serialVersionUID = 1L;
|
|||||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvCommentEntity:";
|
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvCommentEntity:";
|
||||||
|
|
||||||
public final static String all = CLASS_NAME + "*";
|
public final static String all = CLASS_NAME + "*";
|
||||||
public final static String id_ = CLASS_NAME + "id"; //
|
public final static String id_ = CLASS_NAME + "id"; //
|
||||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||||
public final static String content_ = CLASS_NAME + "content"; // 评论的内容
|
public final static String content_ = CLASS_NAME + "content"; // 评论的内容
|
||||||
public final static String trade_order_id = CLASS_NAME + "trade_order_id"; // 订单id
|
public final static String trade_order_id = CLASS_NAME + "trade_order_id"; // 订单id
|
||||||
public final static String sku_id = CLASS_NAME + "sku_id"; // sku_id
|
public final static String sku_id = CLASS_NAME + "sku_id"; // sku_id
|
||||||
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
|
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
|
||||||
public final static String product_title = CLASS_NAME + "product_title"; // 商品标题
|
public final static String product_title = CLASS_NAME + "product_title"; // 商品标题
|
||||||
public final static String sku_info = CLASS_NAME + "sku_info"; // sku信息
|
public final static String sku_info = CLASS_NAME + "sku_info"; // sku信息
|
||||||
public final static String status_ = CLASS_NAME + "status"; // 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过
|
public final static String status_ = CLASS_NAME + "status"; // 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过,如果审批未通过,即自己可见,但别人不可见 。
|
||||||
|
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间
|
||||||
//
|
//
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
@ -53,8 +53,10 @@ private static final long serialVersionUID = 1L;
|
|||||||
private String productTitle;
|
private String productTitle;
|
||||||
//sku信息
|
//sku信息
|
||||||
private String skuInfo;
|
private String skuInfo;
|
||||||
//待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过
|
//待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过,如果审批未通过,即自己可见,但别人不可见 。
|
||||||
private String status;
|
private String status;
|
||||||
|
//创建时间
|
||||||
|
private Long createTimestamp;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -206,20 +208,35 @@ private static final long serialVersionUID = 1L;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过
|
* 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过,如果审批未通过,即自己可见,但别人不可见 。
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过
|
* 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过,如果审批未通过,即自己可见,但别人不可见 。
|
||||||
* @param status
|
* @param status
|
||||||
*/
|
*/
|
||||||
public void setStatus(String status) {
|
public void setStatus(String status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Long getCreateTimestamp() {
|
||||||
|
return createTimestamp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
* @param createTimestamp
|
||||||
|
*/
|
||||||
|
public void setCreateTimestamp(Long createTimestamp) {
|
||||||
|
this.createTimestamp = createTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VvCommentEntity{" +
|
return "VvCommentEntity{" +
|
||||||
@ -234,6 +251,7 @@ private static final long serialVersionUID = 1L;
|
|||||||
",productTitle=" + productTitle +
|
",productTitle=" + productTitle +
|
||||||
",skuInfo=" + skuInfo +
|
",skuInfo=" + skuInfo +
|
||||||
",status=" + status +
|
",status=" + status +
|
||||||
|
",createTimestamp=" + createTimestamp +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.heyu.api.alibaba.request.mm.enums;
|
||||||
|
|
||||||
|
public enum CommentStatusEnums {
|
||||||
|
// 状态 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过,如果审批未通过,即自己可见,但别人不可见
|
||||||
|
|
||||||
|
|
||||||
|
approval_not_pass("approval_not_pass","审批未通过,如果审批未通过,即自己可见,但别人不可见"),
|
||||||
|
approval_pass("approval_pass","审批通过"),
|
||||||
|
wait_approval("wait_approval","待审批"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
CommentStatusEnums(String status, String desc) {
|
||||||
|
this.status = status;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.heyu.api.alibaba.request.mm.order;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VVCommentRequest {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Integer pageNum = 1 ;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer pageSize = 10 ;
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long tradeOrderId;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* skuid
|
||||||
|
*/
|
||||||
|
private Long skuId;
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long productName;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 状态 待审批 wait_approval 待审批, approval_pass,审批通过 , approval_not_pass 审批未通过,如果审批未通过,即自己可见,但别人不可见
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private String createTimestampSort;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,103 @@
|
|||||||
|
package com.heyu.api.controller.mm;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.heyu.api.alibaba.request.mm.order.VVCommentRequest;
|
||||||
|
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.apache.commons.collections.CollectionUtils;
|
||||||
|
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.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mm/comment")
|
||||||
|
public class CommentController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvCommentDao vvCommentDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvCommentDetailDao vvCommentDetailDao;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("/list")
|
||||||
|
public R list(@RequestBody VVCommentRequest vvCommentRequest) {
|
||||||
|
PPageUtils pageUtils = PPageUtils.startPage(vvCommentRequest.getPageNum(), vvCommentRequest.getPageSize())
|
||||||
|
.doSelect(new ISelect() {
|
||||||
|
@Override
|
||||||
|
public List doSelect(IPage page) {
|
||||||
|
return vvCommentDao.selectVvCommentByCondition(page,
|
||||||
|
vvCommentRequest.getProductId(),
|
||||||
|
vvCommentRequest.getProductName(),
|
||||||
|
vvCommentRequest.getSkuId(),
|
||||||
|
vvCommentRequest.getTradeOrderId(),
|
||||||
|
vvCommentRequest.getStatus(),
|
||||||
|
vvCommentRequest.getCreateTimestampSort()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
List<VvCommentEntity> vvCommentEntities = pageUtils.getRows();
|
||||||
|
List<VvCommentDTO> commentDTOS = new ArrayList<>();
|
||||||
|
for (VvCommentEntity vvCommentEntity : vvCommentEntities) {
|
||||||
|
VvCommentDTO vvCommentDTO = new VvCommentDTO();
|
||||||
|
BeanUtils.copyProperties(vvCommentEntity, vvCommentDTO);
|
||||||
|
List<VvCommentDetailEntity> vvCommentDetailEntities = vvCommentDetailDao.selectVvCommentDetailByCommentId(vvCommentDTO.getId());
|
||||||
|
vvCommentDTO.setVvCommentDetailEntities(vvCommentDetailEntities);
|
||||||
|
commentDTOS.add(vvCommentDTO);
|
||||||
|
}
|
||||||
|
pageUtils.setRows(commentDTOS);
|
||||||
|
|
||||||
|
return R.ok().setData(pageUtils);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("/insertOrUpdate")
|
||||||
|
public R insert(@RequestBody VvCommentDTO vvCommentDTO) {
|
||||||
|
Long commentId = vvCommentDTO.getId();
|
||||||
|
VvCommentEntity vvCommentEntity = new VvCommentEntity();
|
||||||
|
BeanUtils.copyProperties(vvCommentDTO, vvCommentEntity);
|
||||||
|
vvCommentDao.insertOrUpdateVvComment(vvCommentEntity);
|
||||||
|
if (commentId != null) {
|
||||||
|
List<VvCommentDetailEntity> vvCommentDetailDB = vvCommentDetailDao.selectVvCommentDetailByCommentId(commentId);
|
||||||
|
if (vvCommentDTO.getVvCommentDetailEntities() != null) {
|
||||||
|
for (VvCommentDetailEntity commentDetailEntity : vvCommentDetailDB) {
|
||||||
|
boolean flag = true;
|
||||||
|
for (VvCommentDetailEntity vvCommentDetailEntity : vvCommentDTO.getVvCommentDetailEntities()) {
|
||||||
|
if (commentDetailEntity.getId().equals(vvCommentDetailEntity.getId())) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flag) {
|
||||||
|
vvCommentDetailDao.deleteVvCommentDetailById(commentDetailEntity.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(vvCommentDTO.getVvCommentDetailEntities())) {
|
||||||
|
for (VvCommentDetailEntity vvCommentDetailEntity : vvCommentDTO.getVvCommentDetailEntities()) {
|
||||||
|
vvCommentDetailEntity.setCommentId(vvCommentEntity.getId());
|
||||||
|
vvCommentDetailDao.insertOrUpdateVvCommentDetail(vvCommentDetailEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user