Spring Boot + MyBatis 搭建微信小程序

版权声明:LeifChen原创,转载请注明出处,谢谢~ https://blog.csdn.net/leifchen90/article/details/86646122

Spring Boot + MyBatis 搭建微信小程序

使用 Spring Boot + MyBatis 开发后台 API 接口,微信小程序作为前端展示页面。

数据库–sql

使用 MySQL 数据库 db_wechat ,表为 dept

CREATE DATABASE IF NOT EXISTS `db_wechat` CHARSET utf8mb4 COLLATE utf8mb4_general_ci;

USE `db_wechat`;

-- ----------------------------
-- Table structure for dept
-- ----------------------------
DROP TABLE IF EXISTS `dept`;
CREATE TABLE `dept` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
  `seq` int(2) NOT NULL DEFAULT 0,
  `gmt_create` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
  `gmt_modified` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;

后端–backend

  • 代码目录结构
    代码目录结构
    建立以 Spring Boot 为核心框架的 Gradle 项目。
    配置 MyBatis-Generator ,根据数据库对应表自动生成代码,并集成通用 Mapper 和分页插件 PageHelper
    提供 Restful 风格的 API ,以部门信息为例:
描述 HTTP请求方式 URL
新增部门 POST /api/depts
删除部门 DELETE /api/depts/{id}
更新部门 PUT /api/depts/{id}
查询单一部门 GET /api/depts/{id}
分页查询部门列表 GET /api/depts

前端–frontend

  • 代码目录结构
    代码目录结构
  • 部门列表页面
    部门列表页面
  • 部门信息页面
    部门信息页面

参考

GitHub代码
SpringBoot+MyBatis搭建迷你小程序

猜你喜欢

转载自blog.csdn.net/leifchen90/article/details/86646122
今日推荐