Spring Boot微信点餐——数据库设计

数据库设计:

具体代码如下:

create table `product_info` (
    `product_id` varchar(32) not null comment ‘商品ID‘,
    `product_name` varchar(64) not null comment ‘商品名称‘,
    `product_price` decimal(10,2) not null comment ‘商品单价‘,
    `product_stock` int not null comment ‘库存‘,
    `product_des` varchar(64) comment ‘描述‘,
    `product_icon` varchar(512) comment ‘产品图标‘,
    `category_type` int not null comment ‘类目编号‘,
    `create_time` timestamp not null default current_timestamp comment ‘创建时间‘,
    `update_tiem` timestamp not null default current_timestamp on update current_timestamp comment ‘修改时间‘,
    primary key (`product_id`)
) comment ‘商品表‘;

create table `product_category` (
    `category_id` int not null auto_increment comment ‘类目ID‘,
    `category_name` varchar(64) not null comment ‘类目名称‘,
    `category_type` int not null comment ‘类目编号‘,
    `create_time` timestamp not null default current_timestamp comment ‘创建时间‘,
    `update_tiem` timestamp not null default current_timestamp on update current_timestamp comment ‘修改时间‘,
    primary key (`category_id`),
    unique key `uqe_category_type` (`category_type`)
) comment ‘类目表‘;

create table `order_master` (
    `order_id` varchar(32) not null comment ‘订单ID‘,
    `buyer_name` varchar(32) not null comment ‘买家名字‘,
    `buyer_phone` varchar(32) not null comment ‘买家电话‘,
    `buyer_address` varchar(128) not null comment ‘买家地址‘,
    `buyer_openid` varchar(64) not null comment ‘买家微信openId‘,
    `order_amount` decimal(10,2) not null comment ‘订单总金额‘,
    `order_status` tinyint(3) default ‘0‘ not null comment ‘订单状态,默认为已下单‘,
    `pay_status` tinyint(3) not null default ‘0‘ comment ‘支付状态, 默认未支付‘,
    `create_time` timestamp not null default current_timestamp comment ‘创建时间‘,
    `update_tiem` timestamp not null default current_timestamp on update current_timestamp comment ‘修改时间‘,
    primary key (`order_id`),
    key `idx_buyer_openid` (`buyer_openid`)
) comment ‘订单表‘;

create table `order_detail` (
    `detail_id` varchar(32) not null comment ‘订单详情ID‘,
    `order_id` varchar(32) not null comment ‘订单ID‘,
    `product_id` varchar(32) not null comment ‘商品ID‘,
    `product_name` varchar(64) not null comment ‘商品名称‘,
    `product_price` decimal(10,2) not null comment ‘当前价格,单位分‘,
    `product_quantity` int not null comment ‘商品数量‘,
    `product_icon` varchar(512) comment ‘商品小图‘,
    `create_time` timestamp not null default current_timestamp comment ‘创建时间‘,
    `update_time` timestamp not null default current_timestamp on update current_timestamp comment ‘修改时间‘,
    primary key (`detail_id`),
    key `idx_order_id` (`order_id`)
) comment ‘订单详情表‘;

后期可能会有,用户表和商家表。目前只是一个简单的流程。

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

来自为知笔记(Wiz)

原文地址:https://www.cnblogs.com/DDante/p/565348c348b2453a1381b919b5b1b609.html

时间: 2024-08-29 10:21:03

Spring Boot微信点餐——数据库设计的相关文章

Spring boot微信点餐系统学习笔记

说起java,大学的时候自学了两个月就放弃了,转而学习C++,现在毕业才发现很多好的想法,从策划到具体实现,都要根据自身能力来挑选框架,进而学习语言,熟练使用C++后去学习其他的语言那才是轻车熟路,基本上两个月就能掌握,毕竟事物是普遍存在联系性的. 学习Spring Boot先要从Spring MVC说起,刚开始接触spring mvc,个人赶紧它对XML的依赖太大,然而,配置XML是一件痛苦的事,对于我来说.boot是最佳选择,干净利落,让人专注于业务的逻辑现实,而不用写一堆配置.一堆XML配

Spring Boot微信点餐——实战开发DAO层

0. 修改grade镜像,使用阿里云地址,以便于快速加载依赖 参照大佬博客 =====> 阿里云maven镜像 # 项目目录下的build.gradle repositories { maven {url 'http://maven.aliyun.com/nexus/content/groups/public/'} mavenLocal() mavenCentral() } # 或者找到GRADLE_HOME/init.d/ 或者是 GRADLE_HOME/init.d/ # .gradle目录

基于微信分享的数据库设计

最近一直在做 基于微信分享的活动.比如说 发起一个分享到微信朋友圈,然后朋友们点击了改分享之后,能够获取什么样的好处. 可以进行抽奖,或者是获得优惠券什么的.由于基本流程大致相同,所以将这一块功能独立处理,作为一个功能组件,称为 微信邀请组件. 数据库设计如下 1 发起邀请记录(邀请函) 字段如下: activity 邀请活动FromUserName 微信号nickname 微信昵称headimgurl 微信头像url 邀请函URLdesc 邀请函说明worth 价值invited_num 接受

Spring Boot 实用MyBatis做数据库操作

前言: 本项目基于maven构建,使用mybatis-spring-boot作为spring-boot项目的持久层框架 spring-boot中使用mybatis持久层框架与原spring项目使用方式和注解都不相同,需要依赖mybatis-spring-boot包 1.引入mybatis和数据库及其他项目依赖 1.1.引入mybatis依赖 [html] view plain copy <!-- mybatis-spring-boot --> <dependency> <gr

spring boot: spring-data-jpa (Repository/CrudRepository) 数据库操作, @Entity实体类持久化

SpringBoot实现的JPA封装了JPA的特性, Repository是封装了jpa的特性(我是这么理解的) 1在pom.xml引入mysql, spring-data-jpa依赖 2.在src/main/resource/下新建applicatoin.properties配置文件,并配置数据库连接 3.在application.properties配置jpa配置信息 4.编写实例 热部署pom.xml配置 <!-- spring boot devtools 热部署 --> <dep

Spring Boot整合JdbcTemplate访问数据库

这篇文章是介绍 Spring Boot整合JdbcTemplate,配置数据源来访问数据库. 在pom文件里添加 spring-boot-starter-jdbc 和mysql依赖. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId></dependency> <dep

spring boot +mybatis 操作sqlite数据库

前言 第一次写博客,以前遇到技术问题都是百度,google搜索也解决了我不少问题,需要搜索老半天七拼八凑才能找到解决方案,一直使用从不生产对学习的过程总结也没记录. 今天写该博客主要是让自己更学入了解spring boot里面的机制,同时让新人少走弯路. 环境 java8+spring boot 数据库:sqlite ORM框架:mybatis sqlite 不多介绍了,基于文件格式的数据库,无需安装数据库执行引擎,方便部署. 主要依赖与版本 <groupId>org.mybatis.spri

Spring Boot集成Flyway实现数据库版本控制?

今天给大家介绍一款比较好用的数据库版本控制工具Flyway.在通过Spring Boot构建微服务的过程中,一般情况下在拆分微服务的同时,也会按照系统功能的边界对其依存的数据库进行拆分.在这种情况下,微服务的数据库版本管理对于研发工程管理来说,就会是一个比较棘手的问题. 在正常的代码管理流程中,从产品研发研发的过程看,一般会经历功能开发.研发测试.集成测试.预发布测试.上线等多个环节.而对于同一个产品功能,可能还会涉及对多个微服务代码及数据库结构的改动. 而这些改动需要我们在以上流程中每发布一个

spring boot实战——微信点餐系统01:项目设计

技术要点: 前端: Vue 后端:Spring Boot + BootStrap + FreeMarker + JQuery 详细技术: Spring Boot : 数据库方面:Spring Boot + JPA 缓存方面:Spring Boot + Redis(会讨论 分布式Session + 分布式锁) 消息推送方面:WebSocker 微信方面: 微信扫码登录 模板消息推送 微信支付与退款 项目设计: 角色划分 功能模块划分:商品:订单:类目 部署架构 数据库设计 数据库设计: 遇到问题