美文网首页
商城典型表设计

商城典型表设计

作者: 码课sir | 来源:发表于2018-08-06 09:39 被阅读0次

    后台用户表

    角色表

    权限表

    商品类型表

    属性表

    商品属性表

    商品分类表

    商品表

    会员表

    购物车表

    订单表

    订单商品表

    福利

    复制如下所有内容,保存如“shop.sql”,然后导入Navicat中

    /*
    Navicat MySQL Data Transfer
    
    Source Server         : localhost
    Source Server Version : 50553
    Source Host           : 127.0.0.1:3306
    Source Database       : tp5shop
    
    Target Server Type    : MYSQL
    Target Server Version : 50553
    File Encoding         : 65001
    
    Date: 2018-06-10 00:04:22
    */
    
    SET FOREIGN_KEY_CHECKS=0;
    
    -- ----------------------------
    -- Table structure for sh_attribute
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_attribute`;
    CREATE TABLE `sh_attribute` (
      `attr_id` int(11) NOT NULL AUTO_INCREMENT,
      `type_id` tinyint(4) DEFAULT NULL,
      `attr_name` varchar(30) DEFAULT '',
      `attr_type` tinyint(4) DEFAULT '0' COMMENT '0-唯一属性,1-单选属性',
      `attr_input_type` tinyint(4) DEFAULT '0' COMMENT '0-手工输入,1-列表选择',
      `attr_values` varchar(255) DEFAULT '',
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`attr_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_auth
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_auth`;
    CREATE TABLE `sh_auth` (
      `auth_id` int(11) NOT NULL AUTO_INCREMENT,
      `auth_name` varchar(40) DEFAULT '',
      `auth_c` varchar(40) DEFAULT '',
      `auth_a` varchar(40) DEFAULT '',
      `pid` int(11) DEFAULT '0',
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`auth_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_cart
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_cart`;
    CREATE TABLE `sh_cart` (
      `cart_id` int(11) NOT NULL AUTO_INCREMENT,
      `goods_id` int(11) DEFAULT '0',
      `goods_attr_ids` varchar(80) DEFAULT '',
      `goods_number` int(11) DEFAULT '0',
      `user_id` int(11) DEFAULT '0',
      PRIMARY KEY (`cart_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_category
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_category`;
    CREATE TABLE `sh_category` (
      `cat_id` int(11) NOT NULL AUTO_INCREMENT,
      `cat_name` varchar(40) DEFAULT '',
      `pid` smallint(6) DEFAULT '0',
      `is_show` tinyint(4) DEFAULT '1' COMMENT '1-显示 0-不显示',
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`cat_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_goods
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_goods`;
    CREATE TABLE `sh_goods` (
      `goods_id` int(11) NOT NULL AUTO_INCREMENT,
      `goods_name` varchar(40) DEFAULT '',
      `goods_sn` varchar(150) DEFAULT '',
      `goods_price` decimal(10,2) DEFAULT NULL COMMENT 'decimal(10,2)',
      `goods_number` int(11) DEFAULT '0',
      `type_id` smallint(6) DEFAULT '0',
      `cat_id` smallint(6) DEFAULT '0',
      `goods_img` text,
      `goods_thumb` text,
      `add_time` int(11) DEFAULT NULL,
      `is_delete` tinyint(4) DEFAULT '0' COMMENT '是否在回站 0-不在回收站 1-在回收站',
      `is_sale` tinyint(4) DEFAULT '1' COMMENT '默认为1: 0-未上架 1-已上架',
      `is_new` tinyint(4) DEFAULT '1' COMMENT '默认为1: 0-不是新品 1-是新品',
      `is_best` tinyint(4) DEFAULT '1' COMMENT '默认为1: 0-不是推荐 1-是推荐',
      `is_hot` tinyint(4) DEFAULT '1' COMMENT '默认为1: 0-不是热卖 1-是热卖商品',
      `goods_desc` text,
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`goods_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
    
    -- ----------------------------
    -- Table structure for sh_goods_attr
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_goods_attr`;
    CREATE TABLE `sh_goods_attr` (
      `goods_attr_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
      `goods_id` int(10) unsigned NOT NULL,
      `attr_id` smallint(5) unsigned NOT NULL,
      `attr_value` varchar(255) DEFAULT '',
      `attr_price` decimal(10,2) DEFAULT NULL,
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`goods_attr_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=81 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_member
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_member`;
    CREATE TABLE `sh_member` (
      `uid` int(11) NOT NULL AUTO_INCREMENT,
      `username` varchar(30) DEFAULT '',
      `password` char(32) DEFAULT '',
      `email` varchar(50) DEFAULT '',
      `phone` varchar(20) DEFAULT NULL,
      `openid` varchar(50) DEFAULT '',
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`uid`)
    ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_order
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_order`;
    CREATE TABLE `sh_order` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `order_id` varchar(80) DEFAULT NULL,
      `receiver` varchar(30) DEFAULT NULL,
      `address` varchar(80) DEFAULT '',
      `tel` char(15) DEFAULT NULL,
      `zcode` varchar(6) DEFAULT NULL COMMENT '邮编',
      `total_price` decimal(10,2) DEFAULT NULL,
      `member_id` int(11) DEFAULT NULL,
      `pay_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0-未付款 ,1-已付款',
      `send_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 0-未发货 , 1-已发货 ,2-已收货 ,3-退货中 4-退货成功',
      `ali_order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '支付成功支付宝返回的订单号',
      `order_time` int(11) DEFAULT NULL,
      `company` varchar(255) DEFAULT '',
      `number` varchar(100) DEFAULT '' COMMENT '物流公司',
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_order_goods
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_order_goods`;
    CREATE TABLE `sh_order_goods` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `order_id` varchar(100) DEFAULT NULL,
      `goods_id` int(11) DEFAULT NULL,
      `goods_attr_ids` varchar(30) DEFAULT NULL,
      `goods_number` int(5) DEFAULT NULL,
      `goods_price` decimal(10,2) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_role
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_role`;
    CREATE TABLE `sh_role` (
      `role_id` int(11) NOT NULL AUTO_INCREMENT,
      `role_name` varchar(40) DEFAULT '',
      `auth_id_list` varchar(100) DEFAULT '',
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`role_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_type
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_type`;
    CREATE TABLE `sh_type` (
      `type_id` int(11) NOT NULL AUTO_INCREMENT,
      `type_name` varchar(40) DEFAULT '',
      `mark` text,
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`type_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Table structure for sh_user
    -- ----------------------------
    DROP TABLE IF EXISTS `sh_user`;
    CREATE TABLE `sh_user` (
      `user_id` int(11) NOT NULL AUTO_INCREMENT,
      `username` varchar(40) DEFAULT '',
      `password` char(32) DEFAULT '',
      `is_active` tinyint(4) DEFAULT '1' COMMENT '0-账号禁用(封号),1-账号可用',
      `role_id` tinyint(4) DEFAULT '0',
      `create_time` int(11) DEFAULT '0',
      `update_time` int(11) DEFAULT '0',
      PRIMARY KEY (`user_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
    

    相关文章

      网友评论

          本文标题:商城典型表设计

          本文链接:https://www.haomeiwen.com/subject/khhwvftx.html