package com.zqb.controller.common;
import com.zqb.common.Msg;
import com.zqb.model.Page;
import com.zqb.model.Student;
import com.zqb.model.Teacher;
import com.zqb.service.CourseService;
import com.zqb.service.PageService;
import com.zqb.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
@Controller
@RequestMapping("test")
public class TestController {
@Resource
private UserService userService;
@Resource
private PageService pageService;
@Resource
private CourseService courseService;
@RequestMapping(value = "/changeStuPass",method=RequestMethod.POST)
@ResponseBody
public Msg changPass(@RequestParam("prepass") String prepass, @RequestParam("nowpass") String nowpass, Model model, HttpServletRequest request){
System.out.println(prepass);
System.out.println(nowpass);
int id=(int)request.getSession().getAttribute("stuid");
if(userService.checkAccount(id,prepass)==0){
model.addAttribute("msg","原始密码输入错误!");
return Msg.fail("原始密码输入错误!");
}
else{
Student student=new Student();
student.setStuId(id);
student.setStuPass(nowpass);
userService.changeStuPass(student);
model.addAttribute("student",userService.getStuInfoById(id));
// return "student/studentInfo";
return Msg.sucess("修改成功");
}
//return new Msg();
}
@RequestMapping(value = "/courseDetail",method = RequestMethod.POST)
@ResponseBody
public Msg courseDetail(@Param("classId") int classId, Model model, HttpServletRequest request) {
if (courseService.checkStuIns(classId, (int) request.getSession().getAttribute("stuid"))) {
return Msg.sucess("OK").add("course", courseService.queryCourse(classId));
} else {
return Msg.fail("请注意课程的学院限制");
}
}
@RequestMapping(value = "/checkedCourseList",method = RequestMethod.GET)
@ResponseBody
public Msg checkedCourseList(@RequestParam(value = "pn",defaultValue="1")Integer pn,Model model,HttpServletRequest request){
Page p= pageService.subList(pn,courseService.queryStuCourse((int)request.getSession().getAttribute("stuid")));
return Msg.sucess("ok").add("pageInfo",p);
}
//退选
@RequestMapping(value = "/deleteCourse",method = RequestMethod.POST)
@ResponseBody
public Msg deleteCourse(@Param("courseid") int courseid,Model model,HttpServletRequest request){
courseService.deleteCourseChoose((int)request.getSession().getAttribute("stuid"),courseid);
return Msg.sucess("退选成功");
}
//课程数据
@ResponseBody
@RequestMapping(value = "/courseList",method = RequestMethod.GET)
public Msg courseList(@RequestParam(value = "pn",defaultValue="1")Integer pn, Model model,HttpServletRequest request){
// model.addAttribute("courseList",courseService.queryStuCourse((int)request.getSession().getAttribute("stuid")));
// return "student/checkedCourseList";
//这是一个分页查询
//引入PageHelp分页插件
//在查询之前只需要调用,传入页码,以及每页的大小
// PageHelper.startPage(pn,2);
//startPage后面紧跟的查询就是分页查询
//Page p= pageService.subList(page,courseService.queryStuCourse((int)request.getSession().getAttribute("stuid")));
// //使用pageInfo包装查询后的结果,只需要将pageInfo交给页面就行了。
//封装了详细的分页信息,传入连续显示的页数
// PageInfo pageInfo=new PageInfo(courseList,5);
return Msg.sucess("ok").add("pageInfo",pageService.subList(pn,courseService.queryAllCourse((int)request.getSession().getAttribute("stuid"))));
}
//课程选择
@ResponseBody
@RequestMapping(value = "/chooseSuccess",method = RequestMethod.POST)
public Msg chooseSuccess(@Param("courseid") int courseid,Model model,HttpServletRequest request){
courseService.chooseSuccess(courseid,(int)request.getSession().getAttribute("stuid"));
return Msg.sucess("选择成功");
}
//学院列表
@ResponseBody
@RequestMapping(value = "/insList",method = RequestMethod.POST)
public Msg insList(Model model,HttpServletRequest request){
return Msg.sucess("查询成功").add("insList",courseService.queryAllIns());
}
//教师列表
@ResponseBody
@RequestMapping(value = "/teaList",method = RequestMethod.POST)
public Msg teaList(Model model,HttpServletRequest request){
return Msg.sucess("查询成功").add("teaList",userService.queryAllTeacher());
}
@ResponseBody
@RequestMapping(value = "/teachCourseList",method = RequestMethod.GET)
public Msg teachCourseList(@RequestParam(value = "pn",defaultValue="1")Integer pn, Model model,HttpServletRequest request){
// model.addAttribute("courseList",courseService.queryStuCourse((int)request.getSession().getAttribute("stuid")));
// return "student/checkedCourseList";
//这是一个分页查询
//引入PageHelp分页插件
//在查询之前只需要调用,传入页码,以及每页的大小
// PageHelper.startPage(pn,2);
//startPage后面紧跟的查询就是分页查询
//Page p= pageService.subList(page,courseService.queryStuCourse((int)request.getSession().getAttribute("stuid")));
//使用pageInfo包装查询后的结果,只需要将pageInfo交给页面就行了。
//封装了详细的分页信息,传入连续显示的页数
// PageInfo pageInfo=new PageInfo(courseList,5);
return Msg.sucess("ok").add("pageInfo",pageService.subList(pn,courseService.queryAllById((int)request.getSession().getAttribute("teaid"))));
//model.addAttribute("paging",pageService.subList(page,courseService.queryAllCourse((int)request.getSession().getAttribute("stuid"))));
//model.addAttribute("teaList",userService.queryAllTeacher());
//model.addAttribute("insList",courseService.queryAllIns());
}
@ResponseBody
@RequestMapping( value = "/changeTeaPass",method = RequestMethod.POST)
public Msg changChPass(@RequestParam("prepass") String prepass, @RequestParam("nowpass") String nowpass, Model model, HttpServletRequest request){
int id=(int)request.getSession().getAttribute("teaid");
if(userService.checkAccount(id,prepass)==0){
return Msg.sucess("原始密码输入错误!");
}
else{
Teacher teacher=new Teacher();
teacher.setTeaId(id);
teacher.setTeaPass(nowpass);
userService.changeTeaPass(teacher);
return Msg.sucess("修改成功").add("teacher",userService.getTeaInfoById(id));
}
}
@RequestMapping(value = "/deleteTeachCourse",method = RequestMethod.POST)
@ResponseBody
public Msg deleteTeachCourse(@Param("courseid") int courseid,Model model,HttpServletRequest request){
try{
courseService.deleteCourse(courseid);
return Msg.sucess("删除成功");
}
catch (Exception ex)
{
System.out.println(ex.toString());
return Msg.sucess("删除失败");
}
}
@ResponseBody
@RequestMapping(value = "/checkIns"
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【作品名称】:基于java+mysql学生在线选课系统【课程设计】 【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。 【项目介绍】:基于java+mysql学生在线选课系统【课程设计】 数据库src/course_selection_system.sql
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
共 576 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/4530fde4ec954012a1ac6bd3893fbfc9_weixin_44010641.jpg!1)
MarcoPage
- 粉丝: 3495
- 资源: 4619
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)