第一章 建立数据库以及项目框架搭建

提示:本博客个为人独立博客,不是权威,仅供参考!所有思路只做交流之用!如有不足之处,望各位在评论区友善指正。


文章目录

  • 第一章 建立数据库以及项目框架搭建
  • 前言
  • 一、建立数据库
    • 1.新建数据库【dormitory】
    • 2.建表,执行sql语句一键生成
  • 二、项目框架搭建
    • 1.新建Project
    • 2.配置Maven
    • 3.删除不必要的文件
    • 4.将.properties文件改为.yml文件
    • 5.创建包
    • 6.查看mysql-connector-java版本与MySql版本是否对应
    • 7.加入驱动信息
    • 8.测试
  • 总结

前言

这一章将介绍数据库的建立以及项目框架的搭建
工具:Navicat、IDEA


一、建立数据库

1.新建数据库【dormitory】

2.建表,执行sql语句一键生成

sql语句:

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2021-5-1 10:30:52                            */
/*==============================================================*/drop table if exists tb_absence;drop table if exists tb_bed;drop table if exists tb_building;drop table if exists tb_dormitory;drop table if exists tb_dormitory_set;drop table if exists tb_dormitory_student;drop table if exists tb_grade;drop table if exists tb_menu;drop table if exists tb_notice;drop table if exists tb_notice_receive;drop table if exists tb_org;drop table if exists tb_record;drop table if exists tb_repair;drop table if exists tb_selection;drop table if exists tb_selection_dormitory;drop table if exists tb_selection_joiner;drop table if exists tb_storey;drop table if exists tb_student;drop table if exists tb_user;drop table if exists tb_user_menu;drop table if exists tb_visit;/*==============================================================*/
/* Table: tb_absence                                            */
/*==============================================================*/
create table tb_absence
(id                   int not null auto_increment,student_id           int,dormitory_id         int,start_time           date,end_time             date,remark               varchar(200),primary key (id)
);/*==============================================================*/
/* Table: tb_bed                                                */
/*==============================================================*/
create table tb_bed
(id                   int not null auto_increment,bno                  varchar(50),dormitory_id         int,primary key (id)
);/*==============================================================*/
/* Table: tb_building                                           */
/*==============================================================*/
create table tb_building
(id                   int not null auto_increment,name                 varchar(100),type                 int comment '4/6/8人间',storey_num           int,sex                  int,remark               varchar(200),user_id              int,primary key (id)
);alter table tb_building comment '楼宇';/*==============================================================*/
/* Table: tb_dormitory                                          */
/*==============================================================*/
create table tb_dormitory
(id                   int not null auto_increment,no                   varchar(50),sex                  int,type                 int,capacity             int,storey_id            int,building_id          int,primary key (id)
);/*==============================================================*/
/* Table: tb_dormitory_set                                      */
/*==============================================================*/
create table tb_dormitory_set
(id                   int not null auto_increment,prefix               varchar(50),start                int,end                  int,building_id          int,storey_id            int,capacity             int,primary key (id)
);/*==============================================================*/
/* Table: tb_dormitory_student                                  */
/*==============================================================*/
create table tb_dormitory_student
(id                   int not null auto_increment,dormitory_id         int,bed_id               int,student_id           int,checkin              datetime,status               int comment '0待入住/1已入住',primary key (id)
);/*==============================================================*/
/* Table: tb_grade                                              */
/*==============================================================*/
create table tb_grade
(id                   int not null auto_increment,name                 varchar(100),primary key (id)
);/*==============================================================*/
/* Table: tb_menu                                               */
/*==============================================================*/
create table tb_menu
(id                   int not null auto_increment,title                varchar(50),icon                 varchar(50),href                 varchar(100),target               varchar(50),parent_id            int,type                 int comment '0:管理员/宿管员功能:1:学生',primary key (id)
);/*==============================================================*/
/* Table: tb_notice                                             */
/*==============================================================*/
create table tb_notice
(id                   int not null auto_increment,title                varchar(200),content              text,create_time          datetime,user_id              int,filepath             varchar(200),primary key (id)
);/*==============================================================*/
/* Table: tb_notice_receive                                     */
/*==============================================================*/
create table tb_notice_receive
(id                   int not null auto_increment,notice_id            int,building_id          int,primary key (id)
);/*==============================================================*/
/* Table: tb_org                                                */
/*==============================================================*/
create table tb_org
(id                   int not null auto_increment,name                 varchar(100),type                 int comment '1学院/2系/3专业/4班级',grade_id             int,parent_id            int,remark               varchar(200),primary key (id)
);/*==============================================================*/
/* Table: tb_record                                             */
/*==============================================================*/
create table tb_record
(id                   int not null auto_increment,student_id           int,dormitory_id         int,bed_id               int,status               int comment '1入住/2退宿',create_date          datetime,primary key (id)
);/*==============================================================*/
/* Table: tb_repair                                             */
/*==============================================================*/
create table tb_repair
(id                   int not null auto_increment,student_id           int,dormitory_id         int,building_id          int,description          varchar(500),create_date          datetime,status               int comment '0待解决/1已解决',primary key (id)
);/*==============================================================*/
/* Table: tb_selection                                          */
/*==============================================================*/
create table tb_selection
(id                   int not null auto_increment,name                 varchar(100),start_time           date,end_time             date,remark               varchar(100),primary key (id)
);/*==============================================================*/
/* Table: tb_selection_dormitory                                */
/*==============================================================*/
create table tb_selection_dormitory
(id                   int not null auto_increment,dormitory_id         int,clazz_id             int,primary key (id)
);/*==============================================================*/
/* Table: tb_selection_joiner                                   */
/*==============================================================*/
create table tb_selection_joiner
(id                   int not null auto_increment,selection_id         int,clazz_id             int,primary key (id)
);/*==============================================================*/
/* Table: tb_storey                                             */
/*==============================================================*/
create table tb_storey
(id                   int not null auto_increment,name                 varchar(100),building_id          int,remark               varchar(200),primary key (id)
);/*==============================================================*/
/* Table: tb_student                                            */
/*==============================================================*/
create table tb_student
(id                   int not null auto_increment,stu_no               varchar(50),name                 varchar(50),idcard               varchar(50),grade_id             int,sex                  int,phone                varchar(50),password             varchar(50),clazz_id             int,primary key (id)
);/*==============================================================*/
/* Table: tb_user                                               */
/*==============================================================*/
create table tb_user
(id                   int not null auto_increment,user_name            varchar(100),password             varchar(100),name                 varchar(100),phone                varchar(100),type                 int comment '0管理员/1宿管员',remark               varchar(200),primary key (id)
);/*==============================================================*/
/* Table: tb_user_menu                                          */
/*==============================================================*/
create table tb_user_menu
(user_id              int not null,menu_id              int not null,primary key (user_id, menu_id)
);/*==============================================================*/
/* Table: tb_visit                                              */
/*==============================================================*/
create table tb_visit
(id                   int not null auto_increment,visitor              varchar(100),phone                varchar(100),sex                  int,idcard               varchar(100),student_id           int,visit_time           datetime,leave_time           datetime,remark               varchar(200),primary key (id)
);

新建查询:

二、项目框架搭建

1.新建Project

2.配置Maven

打开-File-Settings

3.删除不必要的文件

  • .gitignore:用git做版本控制时,用这个文件控制那些文件或文件夹不被提交
  • HELP.md:你项目的帮助文档,不写可删除
  • mvnw:linux上处理maven版本兼容问题的脚本
  • mvnw.cmd:windows上处理maven版本兼容问题的脚本
  • xxx.iml:是IDEA特有的文件每个导入IDEA的项目都会生成一个项目同名的.iml文件,用于保存你对这个项目的配置。删了程序重新导入后还会生成,但由于配置丢失可能会造成程序异常
  • .mvn:maven配置目录

文件作用解释:

4.将.properties文件改为.yml文件

5.创建包

6.查看mysql-connector-java版本与MySql版本是否对应

POM 是 Project Object Model 的缩写,即项目对象模型。
pom.xml 就是 maven 的配置文件,用以描述项目的各种信息。

查看MySql版本:
使用对应的mysql-connector-java版本
转载自官方文档:https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-versions.html

7.加入驱动信息

用浏览器打开http://localhost:8888/dormitory/
显示如上页面则表示程序运行正常

8.测试

resources文件夹下新建public文件夹

  • public:静态html文件
  • static:静态css、js等

总结

数据库的建立是直接提供了sql语句一键生成,没有任何难度。项目的整体框架搭建也给了非常详细的步骤,应该不会有什么大问题。

难点:
1.Maven仓库的配置(不使用IDEA捆绑的Maven)
2.学会查看帮助文档(比如MySql)

第二章预计五一假期结束前更新,涉及SpringBoot整合Mybatis和使用代码生成器生成Mapper相关。

【高校宿舍管理系统】第一章 建立数据库以及项目框架搭建相关推荐

  1. java计算机毕业设计高校宿舍管理系统源码+mysql数据库+系统+lw文档+部署

    java计算机毕业设计高校宿舍管理系统源码+mysql数据库+系统+lw文档+部署 java计算机毕业设计高校宿舍管理系统源码+mysql数据库+系统+lw文档+部署 本源码技术栈: 项目架构:B/S ...

  2. 【高校宿舍管理系统】第零章 项目功能和技术路线

    第零章 项目功能和技术路线 提示:本博客个为人独立博客,不是权威,仅供参考!所有思路只做交流之用!如有不足之处,望各位在评论区友善指正. 文章目录 第零章 项目功能和技术路线 前言 一.项目功能 1. ...

  3. 【高校宿舍管理系统】终章 完成主页以及项目总结

    终章 完成主页以及项目总结 提示:本博客个为人独立博客,不是权威,仅供参考!所有思路只做交流之用!如有不足之处,望各位在评论区友善指正. 文章目录 终章 完成主页以及项目总结 前言 一.完成主页 1. ...

  4. 【高校宿舍管理系统】第七章 机构管理和功能菜单权限分配

    第七章 机构管理和功能菜单权限分配 提示:本博客个为人独立博客,不是权威,仅供参考!所有思路只做交流之用!如有不足之处,望各位在评论区友善指正. 文章目录 第七章 机构管理和功能菜单权限分配 前言 一 ...

  5. 【高校宿舍管理系统】第三章 Layui整合Axios

    第三章 Layui整合Axios 提示:本博客个为人独立博客,不是权威,仅供参考!所有思路只做交流之用!如有不足之处,望各位在评论区友善指正. 文章目录 第三章 Layui整合Axios 前言 一.下 ...

  6. java计算机毕业设计高校宿舍管理系统演示视频2021源码+mysql数据库+系统+lw文档+部署

    java计算机毕业设计高校宿舍管理系统演示视频2021源码+mysql数据库+系统+lw文档+部署 java计算机毕业设计高校宿舍管理系统演示视频2021源码+mysql数据库+系统+lw文档+部署 ...

  7. JAVA毕业设计高校宿舍管理系统演示视频2021计算机源码+lw文档+系统+调试部署+数据库

    JAVA毕业设计高校宿舍管理系统演示视频2021计算机源码+lw文档+系统+调试部署+数据库 JAVA毕业设计高校宿舍管理系统演示视频2021计算机源码+lw文档+系统+调试部署+数据库 本源码技术栈 ...

  8. 【计算机毕业文章】基于SSM的高校宿舍管理系统的设计与实现

    摘 要 近年来, 伴随着互联网产业的快速发展和大力推广,"数字化"."信息化"为关键字的校园建设已经成为了各大院校发展的共同课题.宿舍是在大学校园里面学习和生活 ...

  9. 【高校宿舍管理系统】第八章 学生管理和楼宇管理以及寝室管理

    第八章 学生管理和楼宇管理以及宿舍管理 提示:本博客个为人独立博客,不是权威,仅供参考!所有思路只做交流之用!如有不足之处,望各位在评论区友善指正. 文章目录 第八章 学生管理和楼宇管理以及宿舍管理 ...

最新文章

  1. The import android cannot be resolved”错误解决方法
  2. js理解 call( ) | apply( ) | caller( ) | callee( )
  3. 瑞星2009网络版-服务器端安装和配置
  4. css的变量教程,更强大的css
  5. 百度云网页视频加速播放
  6. 基于J2EE的网上购书系统(SSM框架)
  7. 学习java之前应该先了解哪些知识?
  8. 如何用IDEA打包jar包
  9. ChemDraw怎么画3D图?
  10. NOIP2017提高组模拟赛4 (总结)
  11. springboot聚合工程讲解与部署
  12. Cadence Allegro颜色显示设置图文教程及视频演示
  13. 关于tof相机很好的总结~
  14. 2018年内大892数据结构部分参考答案
  15. 基于winform的工资单群发工具
  16. linux运行雷神之锤,Ubuntu下多人射击类游戏 Quake Live 雷神之锤
  17. 【日常计算机问题】解决能使用网络但打不开网页的问题
  18. 基于蚁群算法的多配送中心的车辆调度问题的研究附Matlab代码
  19. 【基础知识】ActiveMQ基本原理
  20. \u65b0\u7f51\u5173 unicode编码与中文 互转

热门文章

  1. java 工作流_【JAVA之工作流介绍】
  2. 压力测试工具siege的用法
  3. 解决XCode安装插件后插件不能使用的问题(转载)
  4. Redis命令参考【EXPIRE】
  5. Memcached、MongoDB、Redis和tokyotyrant
  6. java 蓝桥杯历届试题 分糖果(题解)
  7. wireshark协议插件开发--官方文档中文翻译
  8. JVM专题之垃圾回收器
  9. FileMessageSet分析
  10. 全志t3linux驱动_全志A20GPIO驱动分析|Android驱动及系统开发交流区|研发交流|雨滴科技技术论坛 - Powered by Discuz!...