基于Dbutils的控制台图书管理系统

文章目录

简介

初学做的第一个项目

使用DbUtils
使用MVC三层架构
采用MD5加密
采用随机验证码
在这里插入图片描述

链接

https://github.com/Yzh1Jun/BooksManagementSystem

数据库

使用pd画的物理模型生成的sql

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2022/8/30 18:53:51                           */
/*==============================================================*/


drop table if exists book;

drop table if exists booktype;

drop table if exists borrow;

drop table if exists message;

drop table if exists user;

/*==============================================================*/
/* Table: book                                                  */
/*==============================================================*/
create table book
(
   bookid               int not null,
   bookname             varchar(255),
   typeid               int,
   author               varchar(255),
   booknum              int,
   state                int not null default 0,
   primary key (bookid)
);

alter table book comment '图书信息';

/*==============================================================*/
/* Table: booktype                                              */
/*==============================================================*/
create table booktype
(
   typeid               int not null,
   typename             varchar(255) not null,
   primary key (typeid)
);

alter table booktype comment '图书类型信息';

/*==============================================================*/
/* Table: borrow                                                */
/*==============================================================*/
create table borrow
(
   borrowid             int not null,
   userid               int,
   bookid               int,
   number               int,
   starttime            datetime,
   endtime              datetime,
   state                int not null default 0,
   primary key (borrowid)
);

alter table borrow comment '用户借阅图书信息';

/*==============================================================*/
/* Table: message                                               */
/*==============================================================*/
create table message
(
   messageid            int not null auto_increment,
   id                   int not null,
   message              varchar(255),
   primary key (messageid)
);

alter table message comment '消息信息';

/*==============================================================*/
/* Table: user                                                  */
/*==============================================================*/
create table user
(
   id                   int not null,
   username             varchar(255) not null,
   password             varchar(255) not null,
   gender               varchar(255),
   age                  int,
   state                int not null default 0,
   role                 int not null default 0,
   primary key (id)
);

alter table user comment '用户信息';

alter table book add constraint FK_book_booktype_r foreign key (typeid)
      references booktype (typeid) on delete restrict on update restrict;

alter table borrow add constraint FK_book_borrow_r foreign key (bookid)
      references book (bookid) on delete restrict on update restrict;

alter table borrow add constraint FK_user_borrow_r foreign key (userid)
      references user (id) on delete restrict on update restrict;

alter table message add constraint FK_user_message_r foreign key (id)
      references user (id) on delete restrict on update restrict;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值