1. 程式人生 > >SSM到Spring Boot從零開發校園商鋪平臺——第一天

SSM到Spring Boot從零開發校園商鋪平臺——第一天

第一天

搭建SSM+Maven環境,略。

第二天

系統功能模組劃分

前端系統

在這裡插入圖片描述

店家系統

在這裡插入圖片描述

實體類

在這裡插入圖片描述

建表SQL見o2o.sql

CREATE DATABASE o2o;

USE o2o;

CREATE TABLE `tb_area`(
	`area_id` int(2) NOT NULL AUTO_INCREMENT,
	`area_name` varchar(200) NOT NULL,
	`priority` int(2) NOT NULL DEFAULT '0',
	`create_time` datetime DEFAULT NULL,
	`last_edit_time` datetime
DEFAULT NULL, primary key(`area_id`), unique key `UK_AREA`(`area_name`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_person_info`( `user_id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(32) DEFAULT NULL, `profile_img` varchar(1024) DEFAULT NULL, `
email` varchar(1024) DEFAULT NULL, `gender` varchar(2) DEFAULT NULL, `enable_status` int(2) NOT NULL DEFAULT '0' COMMENT'0:禁止使用本商城,1:允許使用本商城', `user_type` int(2) NOT NULL DEFAULT '1' COMMENT'1:顧客,2:店家,3:超級管理員', `create_time` datetime DEFAULT NULL, `last_edit_time` datetime DEFAULT NULL, primary key
(`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_wechat_auth`( `wecha_auth_id` int(10) NOT NULL AUTO_INCREMENT, `user_id` int(10) NOT NULL, `open_id` varchar(128) NOT NULL, `create_time` datetime DEFAULT NULL, primary key(`wecha_auth_id`), constraint `fk_wechatauth_profile` FOREIGN KEY(`user_id`) REFERENCES `tb_person_info`(`user_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_local_auth`( `local_auth_id` int(10) NOT NULL AUTO_INCREMENT, `user_id` int(10) NOT NULL, `user_name` int(10) NOT NULL, `username` varchar(128) NOT NULL, `password` varchar(128) NOT NULL, `create_time` datetime DEFAULT NULL, `last_edit_time` datetime DEFAULT NULL, primary key(`local_auth_id`), UNIQUE KEY `uk_local_profile`(`username`), constraint `fk_localauth_profile` FOREIGN KEY(`user_id`) REFERENCES `tb_person_info`(`user_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ALTER TABLE tb_wechat_auth ADD UNIQUE INDEX(open_id); CREATE TABLE `tb_head_line`( `line_id` int(100) NOT NULL AUTO_INCREMENT, `line_name` varchar(1000) DEFAULT NULL, `line_link` varchar(2000) NOT NULL, `line_img` varchar(2000) NOT NULL, `prority` int(2) DEFAULT NULL, `enable_status` int(2) NOT NULL DEFAULT '0', `create_time` datetime DEFAULT NULL, `last_edit_time` datetime DEFAULT NULL, PRIMARY KEY(`line_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_shop_category`( `shop_category_id` int(11) NOT NULL AUTO_INCREMENT, `shop_category_name` varchar(100) NOT NULL DEFAULT'', `shop_category_desc` varchar(1000) DEFAULT'', `shop_category_img` varchar(2000) DEFAULT NULL, `priority` int(2) NOT NULL DEFAULT '0', `create_time` datetime DEFAULT NULL, `last_edit_time` datetime DEFAULT NULL, `parent_id` int(11) DEFAULT NULL, PRIMARY KEY(`shop_category_id`), constraint `fk_shop_category_self` FOREIGN KEY(`parent_id`) REFERENCES `tb_shop_category`(`shop_category_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_shop`( `shop_id` int(10) NOT NULL AUTO_INCREMENT, `owner_id` int(10) NOT NULL COMMENT '店鋪建立人', `area_id` int(2) DEFAULT NULL, `shop_category_id` int(11) DEFAULT NULL, `shop_name` varchar(256) NOT NULL, `shop_desc` varchar(1024) DEFAULT NULL, `shop_addr` varchar(200) DEFAULT NULL, `phone` varchar(128) DEFAULT NULL, `shop_img` varchar(1024) DEFAULT NULL, `priority` int(3) DEFAULT'0', `create_time` datetime DEFAULT NULL, `last_edit_time` datetime DEFAULT NULL, `enable_status` int(2) NOT NULL DEFAULT '0', `advice` varchar(255) DEFAULT NULL, PRIMARY KEY(`shop_id`), constraint `fk_shop_area` FOREIGN KEY(`area_id`) REFERENCES `tb_area`(`area_id`), constraint `fk_shop_profile` FOREIGN KEY(`owner_id`) REFERENCES `tb_person_info`(`user_id`), constraint `fk_shop_shopcate` FOREIGN KEY(`shop_category_id`) REFERENCES `tb_shop_category`(`shop_category_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_product_category`( `product_category_id` int(11) NOT NULL AUTO_INCREMENT, `product_category_name` varchar(100) NOT NULL, `priority` int(2) DEFAULT '0', `create_time` datetime DEFAULT NULL, `shop_id` int(10) DEFAULT NULL, PRIMARY KEY(`product_category_id`), constraint `fk_procate_shop` FOREIGN KEY(`shop_id`) REFERENCES`tb_shop`(`shop_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_product`( `product_id` int(100) NOT NULL AUTO_INCREMENT, `product_name` varchar(100) NOT NULL, `product_desc` varchar(2000) DEFAULT NULL, `img_addr` varchar(2000) DEFAULT'', `normal_price` varchar(100) DEFAULT NULL, `promotion_price` varchar(100) DEFAULT NULL, `priority` int(2) NOT NULL DEFAULT '0', `create_time` datetime DEFAULT NULL, `last_edit_time` datetime DEFAULT NULL, `enable_status` int(2) NOT NULL DEFAULT '0', `product_category_id` int(11) DEFAULT NULL, `shop_id` int(10) NOT NULL DEFAULT '0', PRIMARY KEY(`product_id`), constraint `fk_product_procate` FOREIGN KEY(`product_category_id`) REFERENCES `tb_product_category`(`product_category_id`), constraint `fk_product_shop` FOREIGN KEY(`shop_id`) REFERENCES `tb_shop`(`shop_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `tb_product_img`( `product_img_id` int(20) NOT NULL AUTO_INCREMENT, `img_addr` varchar(2000) NOT NULL, `img_desc` varchar(2000) DEFAULT NULL, `priority` int(2) DEFAULT '0', `create_time` datetime DEFAULT NULL, `product_id` int(100) DEFAULT NULL, PRIMARY KEY(`product_img_id`), constraint `fk_proimg_product` FOREIGN KEY(`product_id`) REFERENCES`tb_product`(`product_id`) )ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

本人在本地實踐時,建表出現了問題,所以還是選擇工具建表最穩妥和方便。