基于SSM+小程序健身饮食管理系统的设计与实现【Nice】

5/26/2023

最近猛哥给一个小伙伴熬夜开发了一个小程序的健身管理系统,这篇文章就给大家认真剖析下这个程序的详细开发。

废话不多说,直接开干!

目录

1,系统的功能 (opens new window)

1.1 小程序端 (opens new window)

1.2 系统后端 (opens new window)

2,系统的界面演示: (opens new window)

21. 小程序端 (opens new window)

2.2 系统的后台演示 (opens new window)

3,系统的核心代码: (opens new window)

4,系统的数据表: (opens new window)

# 1,系统的功能

# 1.1 小程序端

(1)首页展示:用户可以在首页进行饮食和运动信息的浏览。

(2)登录功能:用户在使用该小程序之前需要输入用户名和密码进行登录,通过和数据库中的信息比对成功之后方可进入系统。

(3)饮食模块:用户可以将饮食加入自己的今日饮食清单之中。

(4)运动模块:用户可以将运动加入自己的今日运动清单中。

(5)个人信息模块:用户可以对自己的个人信息进行管理。

# 1.2 系统后端

(1)管理员登录:管理员可以登陆系统的后台对前端数据进行管理。

(2)用户查看:管理员可以查看所有使用该小程序的用户信息。

(3)饮食管理:管理员可以对饮食信息进行管理,包括添加饮食信息、删除饮食信息以及编辑饮食信息等操作。

(4)运动管理:管理员可以对运动信息进行管理,包括添加运动信息、删除运动信息以及编辑运动信息等操作。

(5)推荐管理:管理员可以对饮食和运动的推荐进行管理,这些饮食和运动信息将会在前端的推荐也页面中进行展示。

# 2,系统的界面演示:

# 2.1小程序端

1

2

3

4

5

6

7

# 2.2 系统的后台演示

8

9

10

11

# 3,系统的核心代码:

@Controller
@RequestMapping("/articleComment")
public class ArticleCommentController {

    @Resource
    private UserUtils userUtils;

    @Autowired
    private ArticleCommentService articleCommentService;

    @RequestMapping("listPage")
    public String listPage() {
        return "articleComment/list";
    }

    @RequestMapping("addPage")
    public String addPage() {
        return "articleComment/add";
    }

    @RequestMapping("editPage")
    public String editPage(HttpServletRequest request, Long id) {
        request.setAttribute("id", id);
        return "articleComment/edit";
    }

    @RequestMapping("/getList")
    @ResponseBody
    public ReturnDataForLayui getList(ArticleComment articleComment) {
        return articleCommentService.getList(articleComment);
    }

    @RequestMapping("/add")
    @ResponseBody
    public ReturnData add(ArticleComment articleComment, HttpServletRequest request) {
        User user = new User();
        ReturnData returnData = userUtils.setUserId(request, user);
        if (!returnData.isSuccess()) {
            return returnData;
        }
        articleComment.setUid(user.getId());
        return articleCommentService.add(articleComment);
    }

    @RequestMapping("/delete")
    @ResponseBody
    public ReturnData delete(ArticleComment articleComment) {
        return articleCommentService.delete(articleComment);
    }

    @RequestMapping("/update")
    @ResponseBody
    public ReturnData update(ArticleComment articleComment) {
        return articleCommentService.update(articleComment);
    }

    @RequestMapping("/updateState")
    @ResponseBody
    public ReturnData updateState(ArticleComment articleComment) {
        return articleCommentService.updateState(articleComment);
    }

}
@Controller
@RequestMapping("/dietCategory")
public class DietCategoryController {

    @Autowired
    private DietCategoryService dietCategoryService;

	@RequestMapping("listPage")
    public String listPage() {
        return "dietCategory/list";
    }

	@RequestMapping("addPage")
    public String addPage() {
        return "dietCategory/add";
    }

    @RequestMapping("editPage")
    public String editPage(HttpServletRequest request, Long id) {
        request.setAttribute("id", id);
        return "dietCategory/edit";
    }

	@RequestMapping("/getList")
    @ResponseBody
    public ReturnDataForLayui getList(DietCategory dietCategory) {
        return dietCategoryService.getList(dietCategory);
    }

	@RequestMapping("/add")
    @ResponseBody
    public ReturnData add(DietCategory dietCategory, Long userId) {
        return dietCategoryService.add(dietCategory);
    }

	@RequestMapping("/delete")
    @ResponseBody
    public ReturnData delete(DietCategory dietCategory) {
        return dietCategoryService.delete(dietCategory);
    }

	@RequestMapping("/update")
    @ResponseBody
    public ReturnData update(DietCategory dietCategory) {
        return dietCategoryService.update(dietCategory);
    }

	@RequestMapping("/updateState")
    @ResponseBody
    public ReturnData updateState(DietCategory dietCategory) {
        return dietCategoryService.updateState(dietCategory);
    }

}
public interface ArticleCommentService {

	ReturnDataForLayui getList(ArticleComment articleComment);

	ReturnData add(ArticleComment articleComment);

	ReturnData delete(ArticleComment articleComment);

	ReturnData update(ArticleComment articleComment);

	ReturnData updateState(ArticleComment articleComment);

}


public interface DietCategoryService {

	ReturnDataForLayui getList(DietCategory dietCategory);

	ReturnData add(DietCategory dietCategory);

	ReturnData delete(DietCategory dietCategory);

	ReturnData update(DietCategory dietCategory);

	ReturnData updateState(DietCategory dietCategory);

}

# 4,系统的数据表:

DROP TABLE IF EXISTS `article`;
CREATE TABLE `article`  (
  `id` bigint(19) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文章标题',
  `detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '文章详情',
  `coverImg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面图',
  `createTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `updateTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  `state` int(5) NULL DEFAULT 1 COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `article_comment`;
CREATE TABLE `article_comment`  (
  `id` bigint(19) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评论内容',
  `articleId` bigint(19) NOT NULL COMMENT '文章',
  `uid` bigint(19) NOT NULL COMMENT '用户',
  `createTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '评论时间',
  `updateTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  `state` int(5) NULL DEFAULT 1 COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文章评论' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `diet`;
CREATE TABLE `diet`  (
  `id` bigint(19) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `dietName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '食谱名称',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '简介',
  `calorie` decimal(9, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '热量(卡路里)',
  `calorieUnit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '热量单位',
  `coverImg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面图',
  `categoryId` bigint(19) NOT NULL COMMENT '分类',
  `createTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `updateTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  `state` int(5) NULL DEFAULT 1 COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '食谱' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `diet_category`;
CREATE TABLE `diet_category`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分类名称',
  `createTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
  `updateTime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
  `state` int(5) NULL DEFAULT 1 COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '食谱分类' ROW_FORMAT = Dynamic;

现在小程序的开发,非常的火,感兴趣的小伙伴,可以学习下!

关注下方公众号,回复:项目大全,干货不断!

spring公众号