package com.guoan.demo.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.guoan.demo.entity.Class;
import com.guoan.demo.entity.Student;
import com.guoan.demo.service.ClassService;
@Controller
@RequestMapping(value = "/class")
public class ClassController extends BaseController {
@Autowired
private ClassService classService;
/**
* 跳转到班级管理页面
* @return
*/
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index(){
return "class";
}
/**
* 添加班级
* @param request
* @param response
* @param student 客户端传递封已封装的班级对象
*/
@RequestMapping(value = "/addClass",method = RequestMethod.POST)
public void addStudent(HttpServletRequest request,HttpServletResponse response, @RequestBody Class cls){
Boolean flag = classService.addStudent(cls);
this.printJson(flag, response);
}
/**
* 查询所有班级
* @param request
* @param response
*/
@RequestMapping(value = "/searchAllClass",method = RequestMethod.GET)
public void getAllStudent(HttpServletRequest request,HttpServletResponse response){
List<Class> classList = classService.searchAllClass();
this.printJson(classList, response);
}
/**
* 修改班级
* @param request
* @param response
*/
@RequestMapping(value = "/editClass",method = RequestMethod.POST)
public void editClass(HttpServletRequest request,HttpServletResponse response,@RequestBody Class cls){
Boolean flag = classService.editClass(cls);
this.printJson(flag, response);
}
/**
* 删除班级
* @param request
* @param response
*/
@RequestMapping(value = "/deleteClass",method = RequestMethod.GET)
public void deleteClass(HttpServletRequest request,HttpServletResponse response,Long cId){
Boolean flag = classService.deleteClass(cId);
this.printJson(flag, response);
}
/**
* 查询未添加班级的学生
* @param request
* @param response
*/
@RequestMapping(value = "/searchNoCheckedClassStudent",method = RequestMethod.GET)
public void searchNoCheckedClassStudent(HttpServletRequest request,HttpServletResponse response){
List<Student> studentList = classService.searchNoCheckedClassStudent();
this.printJson(studentList, response);
}
/**
* 保存修改学生的班级信息
* @param request
* @param response
*/
@RequestMapping(value = "/updateStudentClass",method = RequestMethod.POST)
public void updateStudentClass(HttpServletRequest request,HttpServletResponse response,@RequestBody Student student){
Boolean flag = classService.updateStudentClass(student);
this.printJson(flag, response);
}
}
Ivan000
- 粉丝: 11
- 资源: 28
最新资源
- 谭浩强C语言课后习题-第三章
- 电子设计论文无线收发芯片nRF905的原理及其在单片机系统中的应用
- MySQL教程是一个涵盖数据库基础知识、安装配置、SQL语句使用、数据库设计、数据操作等多个方面的综合指南 以下是一个简化的My
- MySQL教程是一个涵盖数据库基础知识、安装配置、SQL语句使用、数据库设计、数据操作等多个方面的综合指南 以下是一个简化的My
- 电子设计论文无线你我他-认识红外线接口
- springboot宠物咖啡馆平台的设计与实现(源码).rar
- Java 是一种广泛使用的编程语言,由 Sun Microsystems(现在已被 Oracle Corporation 收购)
- Java 是一种广泛使用的编程语言,由 Sun Microsystems(现在已被 Oracle Corporation 收购)
- 电子设计论文无线呼叫系统的设计电子设计论文无线呼叫系统的设计
- MySQL的安装配置教程可以细分为以下几个步骤: 一、下载MySQL 访问MySQL官网:首先,访问MySQL官网 选择下载
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
- 5
前往页