SpringBoot+uniApp宠物领养小程序系统 附带详细运行指导视频

文章目录

一、项目演示

项目演示地址: 视频地址

二、项目介绍

项目描述:这是一个基于SpringBoot+uniApp框架 开发的宠物领养微信小程序系统。首先,这是一个前后端分离 的项目,前端分为用户端管理端用户端 使用微信小程序(uniApp开发)管理端 使用Web页面(Vue开发)。然后这项目代码简洁规范,注释说明详细,易于理解和学习。其次,这项目功能丰富,具有一个宠物领养微信小程序系统该有的所有功能。

项目功能:此项目分为两个 角色:普通用户管理员普通用户 有登录注册、浏览宠物信息、浏览论坛帖子信息、管理自己发布的宠物信息、管理个人基本信息、管理自己发布的论坛帖子信息、评论帖子、收藏宠物、拍下宠物、管理自己的订单信息等等功能。管理员有管理所有用户信息、管理所有轮播图信息、管理所有首页板块信息、管理所有宠物分类信息、管理所有宠物信息、管理所有订单信息、管理所有论坛帖子信息、管理所有评论信息、查看收益数据图表等等功能。

应用技术:SpringBoot + uniApp + Vue3 + MySQL + MyBatis + Redis + ElementUI-Plus + uni-ui + Vite + TypeScript

运行环境:IntelliJ IDEA2019.3.5 + MySQL5.7(项目压缩包中自带) + Redis5.0.5(项目压缩包中自带) + JDK1.8 + Maven3.6.3(项目压缩包中自带)+ Node16.20.2(项目压缩包中自带)+ 微信开发者工具(项目压缩包中自带)+ Visual Studio Code(项目压缩包中自带)

三、运行截图























四、主要代码

1.保存宠物信息代码

java 复制代码
	/**
     * 保存宠物信息
     * @param petDTO
     * @return
     */
    @Override
    public ResponseDTO<Boolean> savePet(PetDTO petDTO) {
        // 进行统一表单验证
        CodeMsg validate = ValidateEntityUtil.validate(petDTO);
        if (!validate.getCode().equals(CodeMsg.SUCCESS.getCode())) {
            return ResponseDTO.errorByMsg(validate);
        }
        Pet pet = CopyUtil.copy(petDTO, Pet.class);
        if(CommonUtil.isEmpty(pet.getId())) {
            // 添加操作
            pet.setId(UuidUtil.getShortUuid());
            pet.setCreateTime(new Date());
            pet.setState(PetStateEnum.WAIT.getCode());
            batchInsertPicture(petDTO.getPhotoList(), pet.getId());
            if(petMapper.insertSelective(pet) == 0) {
                return ResponseDTO.errorByMsg(CodeMsg.PET_ADD_ERROR);
            }
        } else {
            // 修改操作
            pet.setState(Optional.ofNullable(pet.getState()).orElse(PetStateEnum.WAIT.getCode()));
            PictureExample pictureExample = new PictureExample();
            pictureExample.createCriteria().andRefIdEqualTo(pet.getId());
            pictureMapper.deleteByExample(pictureExample);
            batchInsertPicture(petDTO.getPhotoList(), pet.getId());
            if(petMapper.updateByPrimaryKeySelective(pet) == 0) {
                return ResponseDTO.errorByMsg(CodeMsg.PET_EDIT_ERROR);
            }
        }
        return ResponseDTO.successByMsg(true, "保存成功!");
    }

2.提交订单信息代码

java 复制代码
	/**
     * 提交订单信息
     * @param orderDTO
     * @return
     */
    @Override
    public ResponseDTO<Boolean> submitOrder(OrderDTO orderDTO) {
        // 进行统一表单验证
        CodeMsg validate = ValidateEntityUtil.validate(orderDTO);
        if (!validate.getCode().equals(CodeMsg.SUCCESS.getCode())) {
            return ResponseDTO.errorByMsg(validate);
        }
        Order order = CopyUtil.copy(orderDTO, Order.class);
        Pet pet = petMapper.selectByPrimaryKey(order.getPetId());
        if(pet.getUserId().equals(order.getUserId())) {
            return ResponseDTO.errorByMsg(CodeMsg.ORDER_REPEAT_ERROR);
        }
        if(!PetStateEnum.SUCCESS.getCode().equals(pet.getState())) {
            return ResponseDTO.errorByMsg(CodeMsg.ORDER_PET_STATE_ERROR);
        }
        Category category = categoryMapper.selectByPrimaryKey(pet.getCategoryId());
        order.setCategoryName(Optional.ofNullable(category.getName()).orElse(""));
        Plate plate = plateMapper.selectByPrimaryKey(pet.getPlateId());
        order.setPlateName(Optional.ofNullable(plate.getName()).orElse(""));
        order.setId(UuidUtil.getShortUuid());
        order.setTotalPrice(pet.getPrice());
        order.setPetName(pet.getName());
        order.setPetInfo(pet.getInfo());
        PictureExample pictureExample = new PictureExample();
        pictureExample.createCriteria().andTypeEqualTo(PictureTypeEnum.PET.getCode()).andRefIdEqualTo(pet.getId());
        pictureExample.setOrderByClause("sort asc");
        List<Picture> pictureList = pictureMapper.selectByExample(pictureExample);
        if(pictureList.size() > 0) {
            order.setPetPhoto(pictureList.get(0).getPhoto());
        }
        order.setSellerId(pet.getUserId());
        order.setCreateTime(new Date());
        if(orderMapper.insertSelective(order) == 0) {
            return ResponseDTO.errorByMsg(CodeMsg.ORDER_ADD_ERROR);
        }
        pet.setState(PetStateEnum.SELL.getCode());
        petMapper.updateByPrimaryKeySelective(pet);
        return ResponseDTO.successByMsg(true, "下单成功!");
    }

3.查询评论信息代码

java 复制代码
	/**
     * 查询评论信息
     * @param commentDTO
     * @return
     */
    @Override
    public ResponseDTO<List<CommentDTO>> getCommentList(CommentDTO commentDTO) {
        CommentExample commentExample = new CommentExample();
        CommentExample.Criteria criteria = commentExample.createCriteria();
        int total = 0;
        if(!CommonUtil.isEmpty(commentDTO.getPostId())) {
            criteria.andPostIdEqualTo(commentDTO.getPostId());
            total = commentMapper.countByExample(commentExample);
        }
        // 先查所有父级评论
        criteria.andParentIdEqualTo("");
        commentExample.setOrderByClause("create_time desc");
        List<Comment> commentList = commentMapper.selectByExample(commentExample);
        List<CommentDTO> commentDTOList = CopyUtil.copyList(commentList, CommentDTO.class);
        for(CommentDTO comment : commentDTOList) {
            User user = userMapper.selectByPrimaryKey(comment.getUserId());
            comment.setUserDTO(CopyUtil.copy(user, UserDTO.class));
            // 查询子评论
            CommentExample childCommentExample = new CommentExample();
            childCommentExample.createCriteria().andParentIdEqualTo(comment.getId());
            childCommentExample.setOrderByClause("create_time desc");
            List<Comment> childCommentList = commentMapper.selectByExample(childCommentExample);
            // 查询子评论
            List<CommentDTO> childCommentDTOList = CopyUtil.copyList(childCommentList, CommentDTO.class);
            for(CommentDTO childComment : childCommentDTOList) {
                childComment.setUserDTO(CopyUtil.copy(userMapper.selectByPrimaryKey(childComment.getUserId()), UserDTO.class));
                childComment.setReplyUserDTO(CopyUtil.copy(userMapper.selectByPrimaryKey(childComment.getReplyId()), UserDTO.class));
            }
            comment.setChildCommentDTOList(childCommentDTOList);
        }

        return ResponseDTO.successByMsg(commentDTOList, String.valueOf(total));
    }
相关推荐
苏叶新城14 分钟前
SpringBoot 3.5 JPA投影
java·spring boot·后端
毕设源码-赖学姐1 小时前
【开题答辩全过程】以 基于Springboot的智慧养老系统的设计与实现为例,包含答辩的问题和答案
java·spring boot·后端
sheji34163 小时前
【开题答辩全过程】以 山林湖泊生态文明建设管控系统为例,包含答辩的问题和答案
java·spring boot
幽络源小助理3 小时前
SpringBoot兼职发布平台源码 | JavaWeb项目免费下载 – 幽络源
java·spring boot·后端
.生产的驴5 小时前
DockerCompoe 部署注册中心Nacos 一键部署 单机+Mysql8
java·linux·运维·spring boot·缓存·docker·doc
222you5 小时前
前后端分离项目在云服务器上的部署(Spring Boot + Vue)
运维·服务器·spring boot
计算机毕设指导65 小时前
基于微信小程序图像识别的智能垃圾分类系统【源码文末联系】
java·spring boot·mysql·微信小程序·小程序·分类·maven
悟空码字6 小时前
SpringBoot读取Excel文件,一场与“表格怪兽”的搏斗记
java·spring boot·后端
小王师傅666 小时前
【轻松入门SpringBoot】actuator健康检查(中)
java·spring boot·spring
qq_12498707536 小时前
基于微信小程序的科技助农系统的设计与实现(源码+论文+部署+安装)
java·大数据·spring boot·后端·科技·微信小程序·毕业设计