package spring.SpringBoot.web;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import spring.SpringBoot.entiry.Student;
import spring.SpringBoot.service.IStudentSrv;
/**
* 学生信息Controller
* @author pang_gqing
*
*/
@RestController
@RequestMapping("/student")
public class StudentController {
@Autowired
IStudentSrv service;
@RequestMapping("/getStudents")
public List<Student> getStudents(){
List<Student> list = new ArrayList<Student>();
list = service.getStudentInfo();
return list;
}
@RequestMapping("/addStudentInfo")
public String addStudentInfo(@RequestParam("name")String name,@RequestParam("password")String password) {
Student stu = new Student();
stu.setName(name);
stu.setPassword(password);
service.addStudentInfo(stu);
return "新增的信息为:"+name+",密码是:"+password;
}
@RequestMapping("/updateStudentInfo")
public String updateStudentInfo(@RequestParam("name")String name,@RequestParam("password")String password) {
Student stu = new Student();
stu.setName(name);
stu.setPassword(password);
stu.setIs_valid("1");
service.updateStudentInfo(stu);
return "修改的信息为:"+name+",密码是:"+password;
}
@RequestMapping("/deleteStudentInfo")
public String deleteStudentInfo(@RequestParam("name")String name) {
Student stu = new Student();
stu.setName(name);
service.deleteStudentInfo(stu);
return "删除的信息为:"+name;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
springboot+mybatis+mysql 项目构建源代码
共29个文件
class:7个
java:7个
xml:5个
需积分: 22 84 下载量 123 浏览量
2018-01-15
10:19:53
上传
评论 1
收藏 22KB ZIP 举报
温馨提示
基于spring官方代码,自行搭建springboot+mybatis+mysql示例源代码
资源推荐
资源详情
资源评论
收起资源包目录
SpringBoot.zip (29个子文件)
SpringBoot
.springBeans 417B
src
main
java
spring
SpringBoot
App.java 291B
service
IStudentSrv.java 630B
impl
StudentSrvImpl.java 826B
web
StudentController.java 2KB
mapper
StudentMapper.java 695B
entiry
Student.java 595B
test
java
spring
SpringBoot
AppTest.java 683B
resources
application.properties 467B
mapper
StudentMapper.xml 1KB
.classpath 1KB
.settings
org.eclipse.wst.common.project.facet.core.xml 145B
org.eclipse.m2e.core.prefs 90B
org.eclipse.core.resources.prefs 119B
org.eclipse.jdt.core.prefs 736B
pom.xml 2KB
target
classes
META-INF
MANIFEST.MF 312B
maven
spring
SpringBoot
pom.properties 215B
pom.xml 2KB
spring
SpringBoot
App.class 670B
service
impl
StudentSrvImpl.class 1KB
IStudentSrv.class 413B
web
StudentController.class 3KB
mapper
StudentMapper.class 497B
entiry
Student.class 934B
application.properties 467B
mapper
StudentMapper.xml 1KB
test-classes
spring
SpringBoot
AppTest.class 621B
.project 976B
共 29 条
- 1
资源评论
菜鸟特工007
- 粉丝: 200
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功