系统设计与数据库系统 大作业(上)

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
云数据库 RDS PostgreSQL,高可用系列 2核4GB
简介: 系统设计与数据库系统 大作业(上)

1.项目简介:(意义,卖点,功能等)


As two students who has gone through college entrance examination, the enrollment rules had left us deep impression. After hearing that the China’s college enrollment system is praised as one of the engineering miracles in the world, we decided to develop our easy version of student enrollment system.

To learn more about the China’s college enrollment system, especially its algorithm, we searched through the internet and found it hard to find anything useful. Finally at luck, we found a pseudo code description on http://www.jzb.com/bbs/thread-3518536-1-1.html , which might not be accurate but is still good enough for us to start our project. Considering that we have quite limited time for approximately one week, we decided to simplify the enrolling process as much as possible in order to focus on the key features. We hoped that our system can process the enrollment plan from colleges and information from students, which includes students’ id number, name, score, applications for colleges etc., the calculation should be fast, and the result should be intuitive, we’d like to build a system that can reveal the en


2.项目架构:(E-R图,模块,流程,各大功能的描述)


①E-R Model


35e368fad54c4fd7804033a66e6e84d1.png


②Normal Form analyzes

1NF:

Student(student_id,candidate,student_name,total_grade,will1,will2,will3,will4,will5,will6,adjust,rank,province,city,subject_type)


2NF:

Student(student_id, student_name, province, city)

Candidate(candidate, total_grade, will1, will2, will3, will4, will5, will6, adjust, rank, subject_type)

student_id->student_name, province, city

candidate->total_grade, will1, will2, will3, will4, will5, will6, adjust, rank, subject_type

3NF:

Student(student_id, student_name, province, city)

Candidate(candidate, total_grade, will1, will2, will3, will4, will5, will6, adjust, rank, subject_type)

student_id->student_name, province, city

candidate->total_grade, will1, will2, will3, will4, will5, will6, adjust, rank, subject_type


③Relation Model

Enrollment Plan (Major Id, Major Code, Department, Major Name, Comment, Period, Plan Student Count, Realistic Student Count)

Student (Id number, Student Name, Score, Rank, Application 1, Application 2, Application 3, Application 4, Application 5, Application 6, Province, City, Comment)

Department (Department_id, Department_name);

Log (log_id, log_content, log_time, status)


④Usage analyzes

Our system is designed to accept enrollment plan from one college and information of multiple students. The data in enrollment plan includes major id, major code, department, major name, comment(liberal arts or science), period(length of study), plan student count and realistic student count. The data in student info includes id number, student name, score, rank, 6 applications for majors, province, city and comment(liberal arts or science). In our case, the data is stored in excel files and is uploaded to the system in control terminal.


051f9340f0fc40ea87af73fe4a0440c2.png

2ca71950aa0d4b12a4f5cbb80140d675.png


3.项目关键设计:(关键的数据表,范式分析,以及其完成某关键功能的代码片段)


This project is divided in 2 parts, which are front-end and back-end.


(1)Front-end


The front end of this project uses an online scheme (https://github.com/lin-xin/vue-manage-system) which is powered by vue.js + element-ui + bootstrap + v-charts

The scheme as a set of multi-function background frame templates, suitable for most of the WEB management system development. Convenient development fast simple good components based on Vue2 and Element-UI. Color separation of color style support manual switch themes, and it is convenient to use a custom theme color.


Setup steps


git clone https://github.com/lin-xin/vue-manage-system.git       // Clone templates  
cd vue-manage-system                                            // Enter template directory  
npm install                                                 // Installation dependency  


  • Local development


// Open server and access http://localhost:8080 in browser  
run serve


  • Constructing production


// Constructing project  
 run build


  • Import vue-schart
   <template>  
    <div>  
        <schart class="wrapper" canvasId="myCanvas" :options="options"></schart>  
    </div>  
</template>  
<script>  
    import Schart from 'vue-schart'; // 导入Schart组件  
    export default {  
        data() {  
            return {  
                options: {  
                    type: 'bar',  
                    title: {  
                        text: '最近一周各品类销售图'  
                    },  
                    labels: ['周一', '周二', '周三', '周四', '周五'],  
                    datasets: [  
                        {  
                            label: '家电',  
                            data: [234, 278, 270, 190, 230]  
                        },  
                        {  
                            label: '百货',  
                            data: [164, 178, 190, 135, 160]  
                        },  
                        {  
                            label: '食品',  
                            data: [144, 198, 150, 235, 120]  
                        }  
                    ]  
                }  
            };  
        },  
        components: {  
            Schart  
        }  
    };  
</script>  
<style>  
    .wrapper {  
        width: 7rem;  
        height: 5rem;  
    }  
</style>  


Main.js


import Vue from 'vue'  
import App from './App.vue'  
import router from './router'  
import store from './store'  
import global from './global/global'  
//bootstrap  
import 'bootstrap'  
import $ from 'jquery'  
import 'bootstrap/dist/css/bootstrap.min.css'  
import 'bootstrap/dist/js/bootstrap.min.js'  
//element  
import ElementUI from 'element-ui';  
import 'element-ui/lib/theme-chalk/index.css';  
import './assets/element-variables.scss'  
//v-charts  
import VCharts from 'v-charts'  
//style  
import './assets/css/reset.css'  
import './assets/css/index.css'  
Vue.config.productionTip = false  
Vue.use(ElementUI)  
Vue.use(global)  
Vue.use(VCharts)  
new Vue({  
  router,  
  store,  
  render: h => h(App)  
}).$mount('#app')  


Now that the templates is deployed, in order to control the length of this report, the detailed code would’t be show, please check the project file to view the specific codes.


(2)Back-end


In the back end we use java, spring, and MySQL

After modelling our database, we can start to build tables in MySQL:


SET NAMES utf8mb4;  
SET FOREIGN_KEY_CHECKS = 0;  
-- ----------------------------  
-- Table structure for t_department  
-- ----------------------------  
DROP TABLE IF EXISTS `t_department`;  
CREATE TABLE `t_department`  (  
  `department_id` int(11) NOT NULL AUTO_INCREMENT,  
  `department_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  PRIMARY KEY (`department_id`) USING BTREE  
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;  
-- ----------------------------  
-- Table structure for t_log  
-- ----------------------------  
DROP TABLE IF EXISTS `t_log`;  
CREATE TABLE `t_log`  (  
  `log_id` int(11) NOT NULL AUTO_INCREMENT,  
  `log_content` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `log_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),  
  `status` tinyint(255) NULL DEFAULT NULL,  
  PRIMARY KEY (`log_id`) USING BTREE  
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;  
-- ----------------------------  
-- Table structure for t_major  
-- ----------------------------  
DROP TABLE IF EXISTS `t_major`;  
CREATE TABLE `t_major`  (  
  `major_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `major_code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `department_id` int(11) NOT NULL,  
  `major_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `period` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `plan_student_count` int(11) NOT NULL,  
  `realistic_student_count` int(11) NULL DEFAULT 0,  
  PRIMARY KEY (`major_id`) USING BTREE  
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;  
-- ----------------------------  
-- Table structure for t_student  
-- ----------------------------  
DROP TABLE IF EXISTS `t_student`;  
CREATE TABLE `t_student`  (  
  `student_id` int(11) NOT NULL AUTO_INCREMENT,  
  `candidate` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `student_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `total_grade` int(11) NOT NULL,  
  `will1` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `will2` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `will3` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `will4` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `will5` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `will6` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `adjust` tinyint(4) NOT NULL,  
  `rank` int(11) NOT NULL,  
  `province` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `city` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `subject_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,  
  `accepted_major_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,  
  `accepted_type` tinyint(4) NULL DEFAULT NULL,  
  PRIMARY KEY (`student_id`) USING BTREE  
) ENGINE = InnoDB AUTO_INCREMENT = 6863 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;  
SET FOREIGN_KEY_CHECKS = 1;  

80db1c9d80d049db83929d168206045d.png


Now we have 4 tables, three of which have connection with each other and the log table is independent to store system operation history.


Setup springboot2.3

Spring boot in IntelliJ IDEA is quite simple, just import the package in the file and the IntelliJ IDEA will automatically download the dependencies and setup the environment.

import org.springframework.beans.factory.annotation.Autowired;

After that we need to create a file called pom.xml, and our pom file is:

 <?xml version="1.0" encoding="UTF-8"?>  
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">  
    <modelVersion>4.0.0</modelVersion>  
    <parent>  
        <groupId>org.springframework.boot</groupId>  
        <artifactId>spring-boot-starter-parent</artifactId>  
        <version>2.3.4.RELEASE</version>  
        <relativePath/> <!-- lookup parent from repository -->  
    </parent>  
    <groupId>org.enroll</groupId>  
    <artifactId>enroll_system</artifactId>  
    <version>0.0.1-SNAPSHOT</version>  
    <name>enroll_system</name>  
    <description>enroll system</description>  
    <properties>  
        <java.version>1.8</java.version>  
    </properties>  
    <dependencies>  
        <dependency>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-starter-jdbc</artifactId>  
        </dependency>  
        <dependency>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-starter-web</artifactId>  
        </dependency>  
        <dependency>  
            <groupId>org.mybatis.spring.boot</groupId>  
            <artifactId>mybatis-spring-boot-starter</artifactId>  
            <version>2.1.3</version>  
        </dependency>  
        <dependency>  
            <groupId>com.alibaba</groupId>  
            <artifactId>druid-spring-boot-starter</artifactId>  
            <version>1.1.10</version>  
        </dependency>  
        <dependency>  
            <groupId>com.alibaba</groupId>  
            <artifactId>easyexcel</artifactId>  
            <version>2.2.6</version>  
        </dependency>  
        <dependency>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-configuration-processor</artifactId>  
            <optional>true</optional>  
        </dependency>  
        <dependency>  
            <groupId>com.github.pagehelper</groupId>  
            <artifactId>pagehelper-spring-boot-starter</artifactId>  
            <version>1.2.3</version>  
        </dependency>  
        <dependency>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-devtools</artifactId>  
            <scope>runtime</scope>  
            <optional>true</optional>  
        </dependency>  
        <dependency>  
            <groupId>mysql</groupId>  
            <artifactId>mysql-connector-java</artifactId>  
            <scope>runtime</scope>  
        </dependency>  
        <dependency>  
            <groupId>org.projectlombok</groupId>  
            <artifactId>lombok</artifactId>  
            <optional>true</optional>  
        </dependency>  
        <dependency>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-starter-thymeleaf</artifactId>  
        </dependency>  
        <dependency>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-starter-test</artifactId>  
            <scope>test</scope>  
            <exclusions>  
                <exclusion>  
                    <groupId>org.junit.vintage</groupId>  
                    <artifactId>junit-vintage-engine</artifactId>  
                </exclusion>  
            </exclusions>  
        </dependency>  
    </dependencies>  
    <build>  
        <plugins>  
            <plugin>  
                <groupId>org.springframework.boot</groupId>  
                <artifactId>spring-boot-maven-plugin</artifactId>  
            </plugin>  
        </plugins>  
    </build>  
</project>  

Now we can add our own configuration to the project including adjusting connection or changing account and password of the database your are connecting to.

Create a file called application.yml, our configuration is:

{ spring: 
   { datasource: 
      { username: 'root',
        password: '${enroll.dbpass}',
        url: 'jdbc:mysql://localhost:3306/${enroll.database}?serverTimezone=GMT%2B8&allowMultiQueries=true',
        'driver-class-name': 'com.mysql.cj.jdbc.Driver',
        type: 'com.alibaba.druid.pool.DruidDataSource',
        druid: 
         { 'initial-size': 5,
           'min-idle': 5,
           maxActive: 20,
           maxWait: 60000,
           timeBetweenEvictionRunsMillis: 60000,
           minEvictableIdleTimeMillis: 300000,
           validationQuery: 'SELECT 1',
           testWhileIdle: true,
           testOnBorrow: false,
           testOnReturn: false,
           poolPreparedStatements: true,
           maxPoolPreparedStatementPerConnectionSize: 20,
           filters: 'stat,slf4j',
           connectionProperties: 'druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000',
           'web-stat-filter': 
            { enabled: true,
              'url-pattern': '/*',
              exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*' },
           'stat-view-servlet': 
            { 'url-pattern': '/druid/*',
              allow: '127.0.0.1,192.168.163.1',
              'reset-enable': false,
              'login-username': 'admin',
              'login-password': 123456 },
           filter: { wall: { config: { 'multi-statement-allow': true } } } } },
     devtools: { restart: { enabled: true } },
     jackson: { 'time-zone': 'GMT+8', 'date-format': 'yyyy-MM-dd HH:mm:ss' } },
  mybatis: 
   { configuration: { 'map-underscore-to-camel-case': true },
     'mapper-locations': [ 'classpath:mybatis/mapper/*.xml' ],
     'type-aliases-package': 'org.enroll.pojo' },
  enroll: 
   { login: { adminName: 'admin', adminPass: 123456 },
     database: 'db_enroll',
     dbpass: 123456 } }


Realization of Enrollment

We uses a open-source made by Alibaba called easyexcel (https://github.com/alibaba/easyexcel) and can be used by just importing the library.


import com.alibaba.excel.context.AnalysisContext;  
import com.alibaba.excel.event.AnalysisEventListener;  
相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/mysql&nbsp;
相关文章
|
9月前
|
JavaScript NoSQL Java
基于SpringBoot+Vue的班级综合测评管理系统设计与实现(系统源码+文档+数据库+部署等)
✌免费选题、功能需求设计、任务书、开题报告、中期检查、程序功能实现、论文辅导、论文降重、答辩PPT辅导、会议视频一对一讲解代码等✌
|
9月前
|
JavaScript NoSQL Java
基于SpringBoot+Vue实现的大学生体质测试管理系统设计与实现(系统源码+文档+数据库+部署)
面向大学生毕业选题、开题、任务书、程序设计开发、论文辅导提供一站式服务。主要服务:程序设计开发、代码修改、成品部署、支持定制、论文辅导,助力毕设!
|
JavaScript Java 测试技术
大学生体质测试|基于Springboot+vue的大学生体质测试管理系统设计与实现(源码+数据库+文档)
大学生体质测试|基于Springboot+vue的大学生体质测试管理系统设计与实现(源码+数据库+文档)
300 0
|
JavaScript Java 关系型数据库
大学生就业招聘|基于Springboot和vue的大学生就业招聘系统设计与实现(源码+数据库+文档)
大学生就业招聘|基于Springboot和vue的大学生就业招聘系统设计与实现(源码+数据库+文档)
343 1
|
关系型数据库 MySQL 数据库
MySQL数据库作业设计之豆瓣音乐
MySQL数据库作业设计之豆瓣音乐
109 0
|
关系型数据库 MySQL 项目管理
数据库大作业——基于qt开发的图书管理系统(四)项目目录的整理与绘制登录页面
数据库大作业——基于qt开发的图书管理系统(四)项目目录的整理与绘制登录页面
154 0
|
SQL 关系型数据库 MySQL
数据库大作业——基于qt开发的图书管理系统(三)Qt连接Mysql数据库
数据库大作业——基于qt开发的图书管理系统(三)Qt连接Mysql数据库
374 0
|
SQL 数据可视化 关系型数据库
数据库大作业——基于qt开发的图书管理系统(二) 相关表结构的设计
数据库大作业——基于qt开发的图书管理系统(二) 相关表结构的设计
162 0
|
安全 BI 数据库
数据库大作业——基于qt开发的图书管理系统 (一)环境的配置与项目需求的分析
数据库大作业——基于qt开发的图书管理系统 (一)环境的配置与项目需求的分析
297 0
|
JavaScript 小程序 Java
医药垃圾分类管理系统|基于SSM医药垃圾分类管理系统的系统设计与实现(源码+数据库+文档)
医药垃圾分类管理系统|基于SSM医药垃圾分类管理系统的系统设计与实现(源码+数据库+文档)
140 0