基于Springboot+Mybatis+微信小程序实现小型运动管理平台

这篇具有很好参考价值的文章主要介绍了基于Springboot+Mybatis+微信小程序实现小型运动管理平台。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。


一、文章前言

此文主要功能包括:运动健康平台登录注册、了解健康知识、查看管理运动的文章与详情、每日登录打卡、系统通知、留言管理、提交运动功能。使用Java作为后端语言进行支持,界面友好,开发简单。

基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序
基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序

二、开发流程及工具准备

2.1、下载安装IntelliJ IDEA(后端语言开发工具),Mysql数据库,微信Web开发者工具。

三、开发步骤

1.创建maven project

先创建一个名为SpringBootDemo的项目,选择【New Project】
基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序

然后在弹出的下图窗口中,选择左侧菜单的【New Project】(注:和2022之前的idea版本不同,这里左侧没有【Maven】选项,不要选【Maven Archetype】!!!),输入Name(项目名):SpringBootDemo,language选择【java】,build system选择【maven】,然后选择jdk,我这里选的是jdk18.

基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序然后点击【Create】
基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序

2.在project下创建module

点击右键选择【new】—【Module…】
基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序
左侧选择【Spring initializr】,通过idea中集成的Spring initializr工具进行spring boot项目的快速创建。窗口右侧:name可根据自己喜好设置,group和artifact和上面一样的规则,其他选项保持默认值即可,【next】
基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序

Developer Tools模块勾选【Spring Boot DevTools】,web模块勾选【Spring Web】

基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序

此时,一个Springboot项目已经搭建完成,可开发后续功能

3.编写一个运动实体类、Mapper、service(三层架构)

@Data
public class Motion {

    //运动记录id
    @TableId(type = IdType.AUTO)
    private Long id;

    //运动类型id
    private Integer typeId;

    //类型
    private Integer type;

    //用户id
    private Long userId;

    //运动分数
    private int num;

    //创建使劲
    private LocalDateTime createTime;

    //运动内容
    private String content;

}

由于我们使用mybatis-plus,所以简单的增删改查不用自己写,框架自带了,只需要实现或者继承他的Mapper、Service
基于Springboot+Mybatis+微信小程序实现小型运动管理平台,小程序,spring boot,mybatis,微信小程序

4.编写运动管理Controller类

@RestController
@RequestMapping("motion")
public class MotionController {

    @Autowired
    private MotionMapper motionMapper;


    @Autowired
    private MotionTypeMapper motionTypeMapper;


    @Autowired
    private UserMapper userMapper;


    //查询列表
    @PostMapping("selectPage")
    public Map selectPage(@RequestBody Motion motion, Integer pageSize, Integer pageNum) {
        ReturnMap returnMap = new ReturnMap();
        //分页需要的Page
        Page<Motion> page = new Page<>();
        page.setCurrent(pageNum + 1);
        page.setSize(pageSize);
        QueryWrapper<Motion> queryWrapper = new QueryWrapper<>();
        //可根据条件模糊查询
        Page<Motion> selectPage = motionMapper.selectPage(page, queryWrapper.lambda()
                .eq(motion.getTypeId() != null, Motion::getTypeId, motion.getTypeId())

                .orderByDesc(Motion::getCreateTime));

        List<Motion> list = selectPage.getRecords();
        for (Motion data : list) {
            MotionType motionType = motionTypeMapper.selectById(data.getTypeId());
            data.setTypeName(motionType != null ? motionType.getTitle() : "");
            User user = userMapper.selectById(data.getUserId());
            data.setUserName(user != null ? user.getNickname() : "");
        }
        selectPage.setRecords(list);
        returnMap.setData("page", selectPage);
        return returnMap.getreturnMap();
    }


    //查询用于运动积分查询列表
    @PostMapping("list")
    public Map selectPage(Long userId) {
        ReturnMap returnMap = new ReturnMap();
        QueryWrapper<Motion> queryWrapper = new QueryWrapper<>();
        List<Motion> list = motionMapper.selectList
                (queryWrapper.lambda().eq(Motion::getUserId, userId).orderByDesc(Motion::getCreateTime));
        int integralSum = 0;
        for (Motion motion1 : list) {
            MotionType motionType = motionTypeMapper.selectById(motion1.getTypeId());
            if (motion1.getType() == 1) {
                motion1.setTitle("签到");
            } else {
                motion1.setTitle(motionType != null ? motionType.getTitle() : "");
            }
            motion1.setTypeName(motionType != null ? motionType.getTitle() : "");
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
            motion1.setTimeCreate(simpleDateFormat.format(Date.from(motion1.getCreateTime().atZone(ZoneId.systemDefault()).toInstant())));
            integralSum += motion1.getNum();

        }
        returnMap.setData("integralSum", integralSum);
        returnMap.setData("list", list);
        return returnMap.getreturnMap();
    }

因为要编写Rest风格的Api,要在Controller上标注@RestController注解

5.编写小程序相关代码

文章列表:

<view class="cu-bar bg-white solid-bottom">
    <view class="action">
      <text class="cuIcon-title text-blue"></text>文章列表
    </view>
  </view>
<view class="cu-card article no-card " wx:for="{{articleList}}" wx:key="{{index}}" bindtap="showModal" data-target="Modal" data-index="{{index}}">
  <view class="cu-item shadow">
    <view class="title">
      <view class="text-cut">{{item.title}}</view>
    </view>
    <view class="content">
      <image src="{{item.image}}" mode="aspectFill"></image>
      <view class="desc">
        <view class="text-content">{{item.content}}</view>
        <view>
          <view class="cu-tag bg-green light sm round">{{item.icon}}</view>
        </view>
      </view>
    </view>
  </view>
</view>

签到功能:

<view class="cu-bar bg-white solid-bottom">
    <view class="action">
      <text class="cuIcon-title text-green"></text>当前积分:{{integralSum}}
    </view>
    <view class="action" bindtap="signIn" >
      <text class="cuIcon-roundadd text-green">签到</text>
    </view>
  </view>

  <view class="cu-list menu {{menuBorder?'sm-border':''}} {{menuCard?'card-menu margin-top':''}}">
    <view class="cu-item" wx:for="{{integralRecord}}" wx:key="{{index}}">
      <view class="content padding-tb-sm">
        <view>
          <text class="cuIcon-footprint text-green margin-right-xs"></text> {{item.title}}</view>
        <view class="text-gray text-sm">
          <text class="cuIcon-time margin-right-xs"></text> {{item.timeCreate}}</view>
      </view>
      <view class="action">
        +{{item.num}}
      </view>
    </view>
  </view>

该项目对于初学Springboot框架友好,也对刚入门小程序的小白友好。因项目资源过大,可私信博主获取项目。文章来源地址https://www.toymoban.com/news/detail-784062.html

到了这里,关于基于Springboot+Mybatis+微信小程序实现小型运动管理平台的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 基于 Spring Boot + MyBatis Plus + Vue & Element 实现的后台管理系统 + 微信小程序

    管理后台的 Vue3 版本采用 vue-element-plus-admin ,Vue2 版本采用 vue-element-admin 管理后台的移动端采用 uni-app 方案,一份代码多终端适配,同时支持 APP、小程序、H5! 后端采用 Spring Boot、MySQL + MyBatis Plus、Redis + Redisson 数据库可使用 MySQL、Oracle、PostgreSQL、SQL Server、MariaDB、国产达梦

    2024年02月06日
    浏览(34)
  • 基于SpringBoot+Vue+uniapp微信小程序的微信小程序书店的详细设计和实现

    💗 博主介绍 :✌全网粉丝10W+,CSDN特邀作者、博客专家、CSDN新星计划导师、全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌💗 👇🏻 精彩专栏 推荐订阅 👇🏻 2023-2024年最值得选的微信小程序毕业设

    2024年03月17日
    浏览(45)
  • SpringBoot+MyBatis搭建迷你微信小程序

    课程链接:https://www.imooc.com/learn/945 view类似于HTML中的div标签是最基础的UI组件 https://blog.csdn.net/wushibo750/article/details/113802928 https://developers.weixin.qq.com/miniprogram/dev/component/view.html https://blog.csdn.net/wushibo750/article/details/120614878 页面跳转链接 onLoad()和onShow()的区别 页面先加载onLoad 后

    2024年02月16日
    浏览(37)
  • 基于SpringBoot+Vue+uniapp微信小程序的校园反诈骗微信小程序的详细设计和实现

    💗 博主介绍 :✌全网粉丝10W+,CSDN特邀作者、博客专家、CSDN新星计划导师、全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌💗 👇🏻 精彩专栏 推荐订阅 👇🏻 2023-2024年最值得选的微信小程序毕业设

    2024年03月22日
    浏览(73)
  • 基于Java+SpringBoot+微信小程序实现奶茶点单系统

    再不用担心逢年过节的第一杯奶茶有没有人送了,制作一个奶茶点单系统自己当店主,开怀畅饮,一劳永逸。 精彩专栏持续更新,收藏订阅不迷路↓↓↓ 微信小程序实战开发专栏

    2023年04月09日
    浏览(26)
  • 基于SpringBoot+微信小程序汽车服务系统的设计与实现

    早晨四点起来,开发个基于SpringBoot+微信小程序汽车服务系统。 困死我了。 送完孩子,然后去上班。 昨天有个读者朋友问小孟:程序员之间的差距为何如此之大。 有时候甚至在同一所大学,同一个专业,有的学生大四毕业可以拿到四五十w的年薪,有的学生毕业找不到工作。

    2024年02月03日
    浏览(40)
  • 基于微信小程序+Springboot校园二手商城系统设计和实现

    博主介绍 : ✌ 全网粉丝30W+,csdn特邀作者、博客专家、CSDN新星导师、Java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、目前 专注于大学生项目实战开发,讲解,毕业答疑辅导 ✌ 🍅 文末获取源码联系 🍅 👇🏻 精彩专栏 推荐订阅 👇🏻 不然下次找不到

    2024年02月11日
    浏览(33)
  • 微信小程序基于vant和springboot实现附件上传和预览

    图片上传和预览在移动端应用非常广泛和频繁,vant组件库van-uploader组件已经帮我们实现了大部分功能,但是在系统中频繁使用还是有点麻烦,我们根据自身的业务系统重新封装了一下简化我们的开发。后端使用springboot集成jcifs实现文件管理微服务。 附件上传 附件预览 组件介

    2024年02月09日
    浏览(40)
  • 基于SpringBoot微信小程序的宠物美容预约系统设计与实现

    博主介绍 : ✌ 全网粉丝30W+,csdn特邀作者、博客专家、CSDN新星计划导师、Java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和学生毕业项目实战,高校老师/讲师/同行交流合作 ✌ 主要内容: SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、P

    2024年02月03日
    浏览(40)
  • 基于SpringBoot+Vue校园导航微信小程序的设计与实现

    博主主页: 一季春秋 博主简介: 专注Java技术领域和毕业设计项目实战、Java、微信小程序、安卓等技术开发,远程调试部署、代码讲解、文档指导、ppt制作等技术指导。 主要内容: SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、小程序、安卓app、大数据等设计与开发。 感兴

    2024年03月12日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包