Compare commits
23 Commits
67ca7ae70b
...
b1f0793768
Author | SHA1 | Date |
---|---|---|
|
b1f0793768 | 1 month ago |
|
fa8062c64e | 1 month ago |
|
da7bb8bd57 | 1 month ago |
|
038898928b | 1 month ago |
|
c0c926b2da | 1 month ago |
|
dbcac59eea | 1 month ago |
|
5abc63b45e | 1 month ago |
|
0437dc8935 | 1 month ago |
|
5a8d197c1c | 1 month ago |
|
e0db67ebc9 | 1 month ago |
|
a9b45a9003 | 1 month ago |
|
b3d05f8d65 | 1 month ago |
|
5c488718c8 | 1 month ago |
|
1daca03d06 | 1 month ago |
|
d388e896e5 | 1 month ago |
|
af0c39582a | 1 month ago |
|
f5a05c0cd6 | 1 month ago |
|
334b718d73 | 1 month ago |
|
e38a27f3a0 | 1 month ago |
|
a433c059a9 | 1 month ago |
|
68b2157c43 | 1 month ago |
|
97e083cc13 | 1 month ago |
|
a3724e210e | 1 month ago |
Binary file not shown.
@ -0,0 +1,14 @@
|
|||||||
|
package com.itmk.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RestTemplateConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate() {
|
||||||
|
return new RestTemplate();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.itmk.web.goods_comment.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.itmk.utils.ResultUtils;
|
||||||
|
import com.itmk.utils.ResultVo;
|
||||||
|
import com.itmk.web.goods_comment.entity.CommentParm;
|
||||||
|
import com.itmk.web.goods_comment.entity.GoodsComment;
|
||||||
|
import com.itmk.web.goods_comment.service.GoodsCommentService;
|
||||||
|
import com.itmk.web.order_detail.entity.UserOrderDetail;
|
||||||
|
import com.itmk.web.order_detail.service.UserOrderDetailService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author java实战基地
|
||||||
|
* @Version 2383404558
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wxapi/comment")
|
||||||
|
public class GoodsCommentController {
|
||||||
|
@Autowired
|
||||||
|
private GoodsCommentService goodsCommentService;
|
||||||
|
@Resource
|
||||||
|
private UserOrderDetailService userOrderDetailService;
|
||||||
|
//新增评论
|
||||||
|
@PostMapping("/addComment")
|
||||||
|
public ResultVo addComment(@RequestBody GoodsComment goodsComment){
|
||||||
|
//根据订单id查询商品
|
||||||
|
QueryWrapper<UserOrderDetail> query = new QueryWrapper<>();
|
||||||
|
query.lambda().eq(UserOrderDetail::getOrderId,goodsComment.getOrderId());
|
||||||
|
List<UserOrderDetail> list = userOrderDetailService.list(query);
|
||||||
|
List<GoodsComment> goodsCommentList = new ArrayList<>();
|
||||||
|
if(list.size() >0){
|
||||||
|
for (int i=0;i<list.size();i++){
|
||||||
|
GoodsComment goodsC = new GoodsComment();
|
||||||
|
BeanUtils.copyProperties(goodsComment,goodsC);
|
||||||
|
goodsC.setCreateTime(new Date());
|
||||||
|
goodsC.setGoodsId(list.get(i).getGoodsId());
|
||||||
|
goodsCommentList.add(goodsC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//批量插入
|
||||||
|
goodsCommentService.saveBatch(goodsCommentList);
|
||||||
|
return ResultUtils.success("评论成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//小程序评论列表
|
||||||
|
@GetMapping("/commentList")
|
||||||
|
public ResultVo commentList(Long goodsId){
|
||||||
|
List<GoodsComment> list = goodsCommentService.commentList(goodsId);
|
||||||
|
return ResultUtils.success("查询成功",list);
|
||||||
|
}
|
||||||
|
//pc列表查询
|
||||||
|
@GetMapping("/pcCommentList")
|
||||||
|
public ResultVo pcCommentList(CommentParm parm){
|
||||||
|
IPage<GoodsComment> list = goodsCommentService.getList(parm);
|
||||||
|
return ResultUtils.success("查询成功",list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除
|
||||||
|
@DeleteMapping("/{commentId}")
|
||||||
|
public ResultVo delete(@PathVariable("commentId") Long commentId){
|
||||||
|
goodsCommentService.removeById(commentId);
|
||||||
|
return ResultUtils.success("删除成功!");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.itmk.web.goods_comment.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CommentParm {
|
||||||
|
private Integer currentPage; //当前页
|
||||||
|
private Integer pageSize;//每页查询的条数
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.itmk.web.goods_comment.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("goods_comment")
|
||||||
|
public class GoodsComment {
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long commentId;
|
||||||
|
private Long goodsId;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Long orderId;
|
||||||
|
private String openid;
|
||||||
|
private String commentText;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String nickName;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String avatarUrl;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String goodsName;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String goodsImage;
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.itmk.web.goods_comment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.itmk.web.goods_comment.entity.GoodsComment;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface GoodsCommentMapper extends BaseMapper<GoodsComment> {
|
||||||
|
List<GoodsComment> commentList(@Param("goodsId") Long goodsId);
|
||||||
|
IPage<GoodsComment> getList(Page<GoodsComment> page);
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.itmk.web.goods_comment.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.itmk.web.goods_comment.entity.CommentParm;
|
||||||
|
import com.itmk.web.goods_comment.entity.GoodsComment;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface GoodsCommentService extends IService<GoodsComment> {
|
||||||
|
List<GoodsComment> commentList(Long goodsId);
|
||||||
|
IPage<GoodsComment> getList(CommentParm parm);
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.itmk.web.goods_comment.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.itmk.web.goods_comment.entity.CommentParm;
|
||||||
|
import com.itmk.web.goods_comment.entity.GoodsComment;
|
||||||
|
import com.itmk.web.goods_comment.mapper.GoodsCommentMapper;
|
||||||
|
import com.itmk.web.goods_comment.service.GoodsCommentService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GoodsCommentServiceImpl extends ServiceImpl<GoodsCommentMapper, GoodsComment> implements GoodsCommentService {
|
||||||
|
@Override
|
||||||
|
public List<GoodsComment> commentList(Long goodsId) {
|
||||||
|
return this.baseMapper.commentList(goodsId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<GoodsComment> getList(CommentParm parm) {
|
||||||
|
//构造分页对象
|
||||||
|
Page<GoodsComment> page = new Page<>(parm.getCurrentPage(),parm.getPageSize());
|
||||||
|
return this.baseMapper.getList(page);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.itmk.web.order.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SendParm {
|
||||||
|
private Long orderId;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.itmk.web.order.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxOrderParm {
|
||||||
|
private String openid;
|
||||||
|
private String type;
|
||||||
|
private Long currentPage;
|
||||||
|
private Long pageSize;
|
||||||
|
private String userName;
|
||||||
|
}
|
@ -1,9 +1,15 @@
|
|||||||
package com.itmk.web.order.service;
|
package com.itmk.web.order.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.itmk.web.order.entity.OrderParm;
|
import com.itmk.web.order.entity.OrderParm;
|
||||||
import com.itmk.web.order.entity.UserOrder;
|
import com.itmk.web.order.entity.UserOrder;
|
||||||
|
import com.itmk.web.order.entity.WxOrderParm;
|
||||||
|
|
||||||
public interface UserOrderService extends IService<UserOrder> {
|
public interface UserOrderService extends IService<UserOrder> {
|
||||||
void splaceOrder(OrderParm parm);
|
void splaceOrder(OrderParm parm);
|
||||||
|
|
||||||
|
IPage<UserOrder> getOrderList(WxOrderParm parm);
|
||||||
|
|
||||||
|
IPage<UserOrder> getPcOrderList(WxOrderParm parm);
|
||||||
}
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.itmk.web.user_collect.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.itmk.utils.ResultUtils;
|
||||||
|
import com.itmk.utils.ResultVo;
|
||||||
|
import com.itmk.web.user_collect.entity.UserCollect;
|
||||||
|
import com.itmk.web.user_collect.service.UserCollectService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author java实战基地
|
||||||
|
* @Version 2383404558
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wxapi/collect")
|
||||||
|
public class UserCollectController {
|
||||||
|
@Autowired
|
||||||
|
private UserCollectService userCollectService;
|
||||||
|
|
||||||
|
//收藏
|
||||||
|
@PostMapping("/addCollect")
|
||||||
|
public ResultVo addCollect(@RequestBody UserCollect userCollect){
|
||||||
|
//查询是否收藏
|
||||||
|
QueryWrapper<UserCollect> query = new QueryWrapper<>();
|
||||||
|
query.lambda().eq(UserCollect::getGoodsId,userCollect.getGoodsId())
|
||||||
|
.eq(UserCollect::getOpenid,userCollect.getOpenid());
|
||||||
|
UserCollect one = userCollectService.getOne(query);
|
||||||
|
if(one != null){
|
||||||
|
return ResultUtils.error("您已经收藏该商品!");
|
||||||
|
}
|
||||||
|
if(userCollectService.save(userCollect)){
|
||||||
|
return ResultUtils.success("收藏成功!");
|
||||||
|
}
|
||||||
|
return ResultUtils.error("收藏失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public ResultVo getList(String openid){
|
||||||
|
List<UserCollect> list = userCollectService.getList(openid);
|
||||||
|
return ResultUtils.success("查询成功!",list);
|
||||||
|
}
|
||||||
|
@GetMapping("/hasCollect")
|
||||||
|
public ResultVo hasCollect(UserCollect userCollect){
|
||||||
|
QueryWrapper<UserCollect> query = new QueryWrapper<>();
|
||||||
|
query.lambda().eq(UserCollect::getOpenid,userCollect.getOpenid())
|
||||||
|
.eq(UserCollect::getGoodsId,userCollect.getGoodsId());
|
||||||
|
UserCollect list = userCollectService.getOne(query);
|
||||||
|
if(list != null){
|
||||||
|
return ResultUtils.success("查询成功!","1");
|
||||||
|
}else{
|
||||||
|
return ResultUtils.success("查询成功!","0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消收藏
|
||||||
|
@PostMapping("/cancelCollect")
|
||||||
|
public ResultVo cancelCollect(@RequestBody UserCollect userCollect){
|
||||||
|
//查询是否收藏
|
||||||
|
QueryWrapper<UserCollect> query = new QueryWrapper<>();
|
||||||
|
query.lambda().eq(UserCollect::getGoodsId,userCollect.getGoodsId())
|
||||||
|
.eq(UserCollect::getOpenid,userCollect.getOpenid());
|
||||||
|
if(userCollectService.remove(query)){
|
||||||
|
return ResultUtils.success("取消收藏成功!");
|
||||||
|
}else{
|
||||||
|
return ResultUtils.error("取消收藏失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除收藏
|
||||||
|
@PostMapping("/deleteCollect")
|
||||||
|
public ResultVo deleteCollect(@RequestBody UserCollect userCollect){
|
||||||
|
|
||||||
|
if(userCollectService.removeById(userCollect.getCollectId())){
|
||||||
|
return ResultUtils.success("删除收藏成功!");
|
||||||
|
}else{
|
||||||
|
return ResultUtils.error("删除收藏失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.itmk.web.user_collect.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("user_collect")
|
||||||
|
public class UserCollect {
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long collectId;
|
||||||
|
private String openid;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String goodsName;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String goodsImage;
|
||||||
|
private Long goodsId;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.itmk.web.user_collect.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.itmk.web.user_collect.entity.UserCollect;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface UserCollectMapper extends BaseMapper<UserCollect> {
|
||||||
|
List<UserCollect> getList(@Param("openid") String openid);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.itmk.web.user_collect.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.itmk.web.user_collect.entity.UserCollect;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface UserCollectService extends IService<UserCollect> {
|
||||||
|
List<UserCollect> getList(String openid);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.itmk.web.user_collect.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.itmk.web.user_collect.entity.UserCollect;
|
||||||
|
import com.itmk.web.user_collect.mapper.UserCollectMapper;
|
||||||
|
import com.itmk.web.user_collect.service.UserCollectService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class UserCollectServiceImpl extends ServiceImpl<UserCollectMapper, UserCollect> implements UserCollectService {
|
||||||
|
@Override
|
||||||
|
public List<UserCollect> getList(String openid) {
|
||||||
|
return this.baseMapper.getList(openid);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.itmk.web.wx_user.controller;
|
||||||
|
|
||||||
|
import com.itmk.utils.ResultUtils;
|
||||||
|
import com.itmk.utils.ResultVo;
|
||||||
|
import com.itmk.web.wx_user.entity.WxUser;
|
||||||
|
import com.itmk.web.wx_user.service.WxUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wxapi/wxUser")
|
||||||
|
public class WxUserController {
|
||||||
|
@Autowired
|
||||||
|
private WxUserService wxUserService;
|
||||||
|
|
||||||
|
@PostMapping("/saveOrUpdate")
|
||||||
|
public ResultVo saveOrUpdate(@RequestBody WxUser wxUser){
|
||||||
|
wxUserService.saveOrUpdate(wxUser);
|
||||||
|
return ResultUtils.success("更新成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询头像昵称
|
||||||
|
@GetMapping("/getUserInfo")
|
||||||
|
public ResultVo getUserInfo(String openid) {
|
||||||
|
WxUser user = wxUserService.getById(openid);
|
||||||
|
return ResultUtils.error("查询成功!",user);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.itmk.web.wx_user.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("wx_user")
|
||||||
|
public class WxUser {
|
||||||
|
@TableId
|
||||||
|
private String openid;
|
||||||
|
private String nickName;
|
||||||
|
private String avatarUrl;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.itmk.web.wx_user.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.itmk.web.wx_user.entity.WxUser;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface WxUserMapper extends BaseMapper<WxUser> {
|
||||||
|
int saveOrUpdateInfo(@Param("user") WxUser user);
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.itmk.web.wx_user.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.itmk.web.wx_user.entity.WxUser;
|
||||||
|
|
||||||
|
public interface WxUserService extends IService<WxUser> {
|
||||||
|
int saveOrUpdateInfo(WxUser user);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.itmk.web.wx_user.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.itmk.web.wx_user.entity.WxUser;
|
||||||
|
import com.itmk.web.wx_user.mapper.WxUserMapper;
|
||||||
|
import com.itmk.web.wx_user.service.WxUserService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class WxUserServiceImpl extends ServiceImpl<WxUserMapper, WxUser> implements WxUserService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int saveOrUpdateInfo(WxUser user) {
|
||||||
|
return this.baseMapper.saveOrUpdateInfo(user);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.itmk.web.goods_comment.mapper.GoodsCommentMapper">
|
||||||
|
<select id="commentList" resultType="com.itmk.web.goods_comment.entity.GoodsComment">
|
||||||
|
select w.nick_name,w.avatar_url,g.* from goods_comment as g inner join wx_user as w on g.openid = w.openid
|
||||||
|
where g.goods_id =#{goodsId}
|
||||||
|
</select>
|
||||||
|
<select id="getList" resultType="com.itmk.web.goods_comment.entity.GoodsComment">
|
||||||
|
SELECT c.*,u.avatar_url,u.nick_name,gs.goods_name,gs.goods_image
|
||||||
|
FROM goods_comment as c
|
||||||
|
inner join wx_user as u on c.openid = u.openid
|
||||||
|
inner join sys_goods as gs on gs.goods_id = c.goods_id
|
||||||
|
order by c.create_time desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.itmk.web.user_collect.mapper.UserCollectMapper">
|
||||||
|
<select id="getList" resultType="com.itmk.web.user_collect.entity.UserCollect">
|
||||||
|
select g.goods_name,g.goods_image,c.* from user_collect as c inner join sys_goods as g on c.goods_id = g.goods_id
|
||||||
|
where c.openid =#{openid}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,19 @@
|
|||||||
|
// 引入
|
||||||
|
import {
|
||||||
|
defineStore
|
||||||
|
} from 'pinia';
|
||||||
|
//通过defineStore定义一个store,
|
||||||
|
// defineStore 第一个参数是唯一的
|
||||||
|
export const userStore = defineStore('userStore', {
|
||||||
|
state: () => {
|
||||||
|
return {
|
||||||
|
nickName: '',
|
||||||
|
avatarUrl: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// 也可以这样定义
|
||||||
|
// state: () => ({ count: 0 })
|
||||||
|
actions: {
|
||||||
|
|
||||||
|
},
|
||||||
|
});
|
@ -0,0 +1,6 @@
|
|||||||
|
//列表参数类型
|
||||||
|
export type CommentListParm = {
|
||||||
|
currentPage:number;
|
||||||
|
pageSize:number;
|
||||||
|
total:number; //分页的总条数
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import http from "../../http";
|
||||||
|
import type { CommentListParm } from "./CommentModel";
|
||||||
|
|
||||||
|
//列表
|
||||||
|
export const getListApi = (parm:CommentListParm)=>{
|
||||||
|
return http.get("/wxapi/comment/pcCommentList",parm)
|
||||||
|
}
|
||||||
|
//删除
|
||||||
|
export const deleteApi = (commentId:string)=>{
|
||||||
|
return http.delete(`/wxapi/comment/${commentId}`)
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
//列表参数类型
|
||||||
|
export type OrderListParm = {
|
||||||
|
currentPage:number;
|
||||||
|
pageSize:number;
|
||||||
|
type:string;
|
||||||
|
userName:string;
|
||||||
|
total:number; //分页的总条数
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import http from "../../http";
|
||||||
|
import type { OrderListParm } from "./OrderModel";
|
||||||
|
//列表
|
||||||
|
export const gePcOrdertListApi = (parm: OrderListParm) => {
|
||||||
|
return http.get("/wxapi/order/getPcOrderList", parm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发货
|
||||||
|
export const sendOrderApi = (orderId: string) => {
|
||||||
|
return http.put("/wxapi/order/sendOrder", { orderId: orderId })
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
import type { CommentListParm } from "../../api/comment/CommentModel";
|
||||||
|
import { reactive ,ref,onMounted,nextTick} from "vue";
|
||||||
|
import {getListApi,deleteApi} from '../../api/comment/index'
|
||||||
|
import useInstance from "@/hooks/useInstance";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
export default function useCommentTable(){
|
||||||
|
const {global} = useInstance()
|
||||||
|
//表格高度
|
||||||
|
const tableHeight = ref(0)
|
||||||
|
//接收表格数据
|
||||||
|
const tableList = ref([])
|
||||||
|
//列表查询的参数
|
||||||
|
const listParm = reactive<CommentListParm>({
|
||||||
|
currentPage:1,
|
||||||
|
pageSize:10,
|
||||||
|
total:0
|
||||||
|
})
|
||||||
|
//列表
|
||||||
|
const getList = async()=>{
|
||||||
|
let res = await getListApi(listParm)
|
||||||
|
if(res && res.code == 200){
|
||||||
|
tableList.value = res.data.records;
|
||||||
|
listParm.total = res.data.total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//删除
|
||||||
|
const deleteBtn = async(commentId:string)=>{
|
||||||
|
const confirm = await global.$myconfirm('确定删除吗?')
|
||||||
|
if(confirm){
|
||||||
|
let res = await deleteApi(commentId)
|
||||||
|
if(res && res.code == 200){
|
||||||
|
ElMessage.success(res.msg)
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//搜索
|
||||||
|
const searchBtn = ()=>{
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
//重置
|
||||||
|
const resetBtn = ()=>{
|
||||||
|
listParm.currentPage = 1;
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
//页容量改变时触发
|
||||||
|
const sizeChange = (size:number)=>{
|
||||||
|
listParm.pageSize = size;
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
//页数改变触发
|
||||||
|
const currentChange = (page:number)=>{
|
||||||
|
listParm.currentPage = page;
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
onMounted(()=>{
|
||||||
|
getList()
|
||||||
|
nextTick(()=>{
|
||||||
|
tableHeight.value = window.innerHeight - 180
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return{
|
||||||
|
listParm,
|
||||||
|
getList,
|
||||||
|
searchBtn,
|
||||||
|
resetBtn,
|
||||||
|
tableList,
|
||||||
|
sizeChange,
|
||||||
|
currentChange,
|
||||||
|
tableHeight,
|
||||||
|
deleteBtn
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
import type { OrderListParm } from '../../api/order/OrderModel'
|
||||||
|
import { nextTick, onMounted, reactive, ref } from 'vue'
|
||||||
|
import { gePcOrdertListApi, sendOrderApi } from '../../api/order'
|
||||||
|
import useInstance from '@/hooks/useInstance'
|
||||||
|
export default function useOrderTable() {
|
||||||
|
const { global } = useInstance()
|
||||||
|
//表格高度
|
||||||
|
const tableHeight = ref(0)
|
||||||
|
//表格数据
|
||||||
|
const tableList = ref([])
|
||||||
|
//表格查询的参数
|
||||||
|
const listParm = reactive<OrderListParm>({
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
type: '',
|
||||||
|
userName: '',
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
//列表
|
||||||
|
const getList = async () => {
|
||||||
|
let res = await gePcOrdertListApi(listParm)
|
||||||
|
if (res && res.code == 200) {
|
||||||
|
//设置表格数据
|
||||||
|
tableList.value = res.data.records;
|
||||||
|
//设置分页总条数
|
||||||
|
listParm.total = res.data.total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//搜索
|
||||||
|
const searchBtn = () => {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
//重置
|
||||||
|
const resetBtn = () => {
|
||||||
|
listParm.currentPage = 1;
|
||||||
|
listParm.type = ''
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
//页容量改变触发
|
||||||
|
const sizeChange = (size: number) => {
|
||||||
|
listParm.pageSize = size;
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
//页数改变触发
|
||||||
|
const currentChange = (page: number) => {
|
||||||
|
listParm.currentPage = page;
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
// 发货
|
||||||
|
const sendOrder = async (orderId: string) => {
|
||||||
|
let confirm = await global.$myconfirm('确定发货吗?')
|
||||||
|
if (confirm) {
|
||||||
|
let res = await sendOrderApi(orderId)
|
||||||
|
if (res && res.code == 200) {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
nextTick(() => {
|
||||||
|
tableHeight.value = window.innerHeight - 220
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
tableList,
|
||||||
|
sendOrder,
|
||||||
|
listParm,
|
||||||
|
getList,
|
||||||
|
searchBtn,
|
||||||
|
resetBtn,
|
||||||
|
sizeChange,
|
||||||
|
currentChange,
|
||||||
|
tableHeight
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +1,55 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<el-main>
|
||||||
评论管理
|
<!-- 表格 -->
|
||||||
</div>
|
<el-table :height="tableHeight" :data="tableList" border stripe>
|
||||||
</template>
|
<el-table-column label="名称" prop="goodsName"></el-table-column>
|
||||||
|
<el-table-column label="商品图片" prop="goodsImage">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-image
|
||||||
|
:src="scope.row.goodsImage.split(',')[0]"
|
||||||
|
style="height: 60px; width: 60px; border-radius: 50%"
|
||||||
|
></el-image>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="昵称" prop="nickName"></el-table-column>
|
||||||
|
<el-table-column label="头像" prop="avatarUrl">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-image
|
||||||
|
:src="imgUrl+scope.row.avatarUrl"
|
||||||
|
style="height: 60px; width: 60px; border-radius: 50%"
|
||||||
|
></el-image>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="时间" prop="createTime"></el-table-column>
|
||||||
|
<el-table-column label="操作" width="220" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button :icon="Delete" @click="deleteBtn(scope.row.commentId)" type="danger" size="default">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<el-pagination
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
:current-page.sync="listParm.currentPage"
|
||||||
|
:page-sizes="[10,20, 40, 80, 100]"
|
||||||
|
:page-size="listParm.pageSize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="listParm.total" background>
|
||||||
|
</el-pagination>
|
||||||
|
|
||||||
|
</el-main>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {ref} from 'vue'
|
||||||
|
import { Delete } from "@element-plus/icons-vue";
|
||||||
|
import useCommentTable from "../../compositions/comment/useCommentTable";
|
||||||
|
const imgUrl = ref('http://localhost:8089/')
|
||||||
|
//表格业务
|
||||||
|
const { listParm, deleteBtn, tableList,sizeChange ,currentChange,tableHeight} = useCommentTable();
|
||||||
|
|
||||||
<script setup lang="ts">
|
</script>
|
||||||
|
|
||||||
</script>
|
<style scoped></style>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
Loading…
Reference in new issue