• 商城一 之设计数据库


    商城数据表设计

    php think make:model index/user
    php think make:model index/admin
    php think make:model index/goodsType
    php think make:model index/goods
    php think make:model index/goodsAttr
    php think make:model index/goodsVal
    php think make:model index/cart
    php think make:model index/orders
    php think make:model index/ordersDetail


    用户:

    user(用户表)
    id
    name
    password
    email
    create_date ---创建日期
    login_date ---上次登陆日期
    credit ---信用积分,买一块钱一分
    status ---是否启用,默认1

    admin(管理员表)
    id
    name
    password
    email
    role ---管理员角色(三种角色, admin,1 :超级管理员,2:普通管理员)
    admin:所有权限 1:所有权限(但不能操作超级管理员) 2:只能管理后台
    create_date ---创建日期
    login_date ---上次登陆日期
    status ---是否启用,默认1
    ------------------------------------------------------------------------------------
    商品:
    goodsType(商品类型)
    id
    name ---商品类型的名称

    goods(商品表)
    id
    name
    img ---缩略图
    desc ---商品描述
    price ---价格
    status ---是否启用,默认1
    goodsType_id ---商品类型id【外键】

    goodsAttr(商品属性,不同类型的商品有不同的属性)
    id
    name ---属性名
    goodsType_id ---商品类型id【外键】

    goodsVal(商品属性值)
    id
    value ---属性值
    goodsAttr_id ---商品属性id【外键】
    goods_id ---对应的商品

    ----------------------------------------------------------------------------------
    购物车:
    cart(购物车)
    id
    goods_id ---对应的商品id【外键】
    user_id ---对应的用户id【外键】
    count ---数量

    -----------------------------------------------------------------------------------
    订单表:
    orders(订单)
    id
    create_date ---创建日期
    user_id ---创建人id【外键】
    status ---订单状态(6:已退款,5:已取消,1:未付款,2:已付款,3:已发货,4:已签收)
    money ---订单总价(浮点数)

    ordersDetail(订单详情)
    id
    orders_id ---对应的订单id【外键】
    goods_id ---对应的商品id【外键】
    count ---数量
    money ---价格

    -----------------------------------------------------------------------------------


    user(用户表)

    create table user(
    id int auto_increment primary key,
    name varchar(20) not null,
    password varchar(50) not null,
    email varchar(50),
    create_date int(11),
    login_date int(11),
    credit int(11) default 0,
    status boolean default 1
    )

    admin(管理员表)

    create table admin(
    id int auto_increment primary key,
    name varchar(20) not null,
    password varchar(50) not null,
    email varchar(50),
    role boolean default 1,
    create_date int(11),
    login_date int(11),
    status boolean default 1
    )

    goodsType(商品类型)
    create table goodsType(
    id int auto_increment primary key,
    name varchar(20) not null unique,
    )

    goods(商品表)
    create table goods(
    id int auto_increment primary key,
    name varchar(50) not null,
    price decimal(11,2) not null,
    img varchar(100) not null,
    brand varchar(20) not null,
    status boolean default 1,
    goodsType_id int
    )

    goodsAttr(商品属性,不同类型的商品有不同的属性)
    create table goodsAttr(
    id int auto_increment primary key,
    name varchar(20) not null unique,
    goodsType_id int
    )

    goodsVal(商品属性值)
    create table goodsVal(
    id int auto_increment primary key,
    value varchar(20) not null,
    goodsAttr_id int,
    goods_id int
    )

    cart(购物车)
    create table cart(
    id int auto_increment primary key,
    goods_id int,
    user_id int,
    count int
    )

    orders(订单)
    create table orders(
    id int auto_increment primary key,
    create_date int(11),
    user_id int,
    status boolean default 1 not null,
    money decimal(11,2) not null
    )

    ordersDetail(订单详情)
    create table ordersDetail(
    id int auto_increment primary key,
    orders_id int,
    goods_id int,
    count int not null,
    money decimal(11,2) not null
    )

  • 相关阅读:
    自学Aruba6.3-账号管理(web页面配置)
    自学Aruba6.2-控制器基本维护操作(web页面配置)
    自学Aruba6.1-基本网络参数配置(web页面配置)
    自学Aruba5.1.2-带宽限制
    自学Aruba5.1.1-基于时间的Role定义
    自学Linux Shell19.2-gawk程序高级特性
    自学Linux Shell19.1-gawk程序基础特性
    自学Linux Shell18.3-sed实用工具
    自学Linux Shell18.2-sed编辑器高级特性
    js 数组API之every、some用法
  • 原文地址:https://www.cnblogs.com/cl94/p/9444536.html
Copyright © 2020-2023  润新知