实现学生管理系统

 

 

一.使用idea创建springboot项目及搭建


       1.创建新项目

      .

     2.

 

点击Spring Initializr 点击next

书写项目名点击next

 3.

进行选项页面,分别选择热部署,web开发,使用jpa和mysql,然后next,finish,创建完成

4.进入项目后分别配置application.properties 文件和pom.xml文件

application.properties :

#数据源配置
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/stu?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.initialSize=20
spring.datasource.minIdle=50
spring.datasource.maxActive=500

#上下文配置
server.port=8888
server.servlet.context-path=/kude

#配置jpa
#帮我们自动生成表结构
spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql= true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true


pom.xml:

 

<!-- druid数据库连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>

基本配置完成

二.后端书写
  1.

在java的com.example.kede目录下创建如下四个文件夹。controller控制层,dao接口层,service服务层,entity实体层

实体层

先根据数据库书写实体类

数据库如下

 

 实体类成员变量

private Integer id;
private String name;
private String sex;
private Integer age;

书写实体类时需加如下标签

  @Entity 代表为实体类

@Table(name = "student") 代表使用表为student
@Id    主键
@GeneratedValue(strategy = GenerationType.IDENTITY)   自增序列


dao层

dao层需要注意

继承

JpaRepository<Student,Integer> 接口 两个参数第一个为实体类型,第二个为主键类型

还需注意点如下自建方法 加入@Query标签 name属性为方法名;nativeQuery 为; true value中为自定义sql语句

 

 
 

Service层



service层中无需特别注意,需要注意的是其中的接口实现类
实现类中实现Service类 并在类前加入@Service标签代表为service层

 


 书写dao层的类为成员变量并且加入自动注入标签@Autowired

 

 

controller层

在controller中加入作者注释
@author中加入作者名称
加入@RestController注解代表是控制层可以将返回值转换为json格式
同样将Service层的类写为成员变量并且加入@Autowired注解自动注入

 

这样写可以在url后无需加?写参数,直接加入/即可

还需注意的有

 @PostMapping使用post方法

 

 
 

 三.前端书写

    前端使用ajax的方法请求,在数据加载完成前,先加载页面

 

  $.ajax({

url: 'http://localhost:8888/kude/student/pagequery?page='+page,
success:function(result){
var rel = result.content;
tot = result.totalPages;
var str = "<table width='80%' align='center' border='1'>"
+"<tr><td>ID</td>"+"<td>姓名</td>"+"<td>年龄</td>"+"<td>性别</td>"+"<td>操作</td>";
for(var i=0;i<rel.length;i++){
var stu = rel[i];
var id = stu.id;
str += "<tr><td>"+stu.id+"</td><td>"+stu.name+"</td><td>"+stu.age+
"</td><td>"+stu.sex+"</td><td><a href='update.html?id'>编辑</a>&nbsp;<a href='http://localhost:8888/kude/student/delete/"+stu.id+"'>删除</a></td></tr>";
}

str += "</table>";
$("#show").html(str);
}

});

 

url代表请求地址

success代表成功后动作

function(result)result代表页面返回的结果

将结果数组赋给rel 使用循环输出返回的json对象stu[]

stu.id 即id。。。。。

需要注意的有

<a href="javascript:up_p();" >上一页</a>中

跳函数需要在前面加入 javascript

$("#show").html(str); 

使用jquery获取div name属性展示页面

 

转载于:https://www.cnblogs.com/szjbk/p/10801893.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
【摘要】选排课系统功能的设计上,学生选排课系统可以分为登录、排课和选课3个子系统。登录子系统区分排课者(也即系统的管理者)、教师和学生这三者的不同身份,给出不同的权限,在页面中根据身份判断其相应具有的功能来使用这套系统。排课子系统主要供排课者使用,排课者可以在这里进行一切与排课有关的活动。选课系统主要供学生选课使用,在这里可以进行与选课有关的活动;教师可在教师反馈系统中对排课者提出反馈意见,供排课者在排课时可参考使用。 学生选排课系统使用Rational Rose进行UMI。建模;过程选择使用ASP编写脚本,在数据库上考虑到快捷、有效,同时考虑到多台服务器共同使用同一个数据库的情况,这里选择SQL Server 2000作为数据库服务器;对于网页的服务器平台,这里选择使用Information Server5.O作为Internet服务器。在Windows 2000 Server上,这是一种很好的组合,也正是Microsoft微软公司网站一直以来所使用的。 【关键词】学生排课管理系统 UML ASP 【 Summary 】 Chooses the design that line up the lesson system function last, the student chooses to line up the lesson system cans is divided into the logging, row lesson with select elective courses 3 statures system.Register the sub- system distinction row lesson( too namely the governor of the system), different from student these third of body in teacher a function for, giving a different legal power, in page according to body judging its cowgirl having to use this set of systems.The row lesson sub- system provides to line up the lesson primarily usage, row lesson can be the whole in here proceeding and line up the activity of relevant lesson.Select elective courses the system to provide primarily the student select elective courses the usage, can proceed the activity that have something to do with selecting elective courses here;Teacher can in teacher feedback system to row lesson put forward the feedback opinion, provide to line up the lesson while lining up lesson can consult usage. The student chooses to line up the lesson system usage Rational Rose proceeds the UMI.Set up the mold;The process choice uses the ASP the plait writes the script, on the database in consideration of fast, valid, at the same time in consideration of many set server common the circumstance of the same of database in usage, choose the SQL Server here 2000 conduct and actions database server;Choose the server terrace of the web page, very much to use the Information Server5.O conduct and actions Internet server.On the 2000 Servers of Windows, this is a kind of good combination, and also exactly Microsoft Microsoft company website always since then uses of. 【 Key phrase 】 Student Row Lesson Management System UML ASP 目 录 第一章 系统概述 4 第二章 开发工具简介 5 第三章 系统需求分析 8 3.1 初步调查 8 3.2 新系统描述 9 3.3可行性分析 9 3.4 运营可行性 10 第四章 对系统进行UML建模 10 4.1 进行用例建模 11 4.2其他文档 17 第五章 数据库设计 22 第六章 系统的实现 27 6.1系统首页default.asp 28 6.2选课子系统SelectCourse 36 第七章 实施概况 54 7.1实施环境与工具的比较 54 7.2编程环境、工具、实现与数据准备概况 55 7.3系统测试概况 55 7.4系统转换方案与实现概况 55 7.5系统运行与维护概况 56 结束语 57 参考文献 58

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值