• 大小: 58M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-08-26
  • 语言: 其他
  • 标签: 其他  

资源简介

moocDemo-master.zip

资源截图

代码片段和文件信息

package com.ssdut.demo.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.ssdut.demo.pojo.course;
import com.ssdut.demo.pojo.coursedetails;
import com.ssdut.demo.pojo.user_info;
import com.ssdut.demo.service.impl.CourseDetailServiseImpl;
import com.ssdut.demo.service.impl.CourseServiceImpl;
import com.ssdut.demo.service.impl.UserServiceImpl;

@Controller
@RequestMapping(“/course“)
public class CourseController {
@Autowired
private CourseServiceImpl courseService;
@Autowired
private UserServiceImpl userInfoService;
@Autowired
private CourseDetailServiseImpl coursedetailService;
@RequestMapping(“/addCourse“)
public ModelAndView addCourse(course recordHttpSession httpSession) {
//根据上传的piurl获得图片名
int userid = (Integer)httpSession.getAttribute(“userid“);
String picurl = record.getPicurl();
//System.out.println(“picurl:“+picurl);
picurl = userid+“_“+picurl.substring(picurl.lastIndexOf(“\\“)+1);
System.out.println(“picurl:“+picurl);
record.setPicurl(picurl);
if(record.getCourseid()!=null){
courseService.updateCourse(record);
}
else{
courseService.addCourse(record);
}
String username = (String) httpSession.getAttribute(“username“);
user_info user = userInfoService.getUserByUserName(username);
//System.out.println(user.getUserid());
List course_list = courseService.getCourseByTeacherId(user.getUserid());
ModelAndView modelAndView = new ModelAndView(“teacher/home“);
modelAndView.addobject(“usertype““教师“);
modelAndView.addobject(“user“user);
//还需要获取user所有的课程,传递给home
modelAndView.addobject(“course_list“course_list);
return modelAndView;
}
/*
 * 删除当前课程
 */
@RequestMapping(“/deleteCourse“)
public ModelAndView deleteCourse(int courseIdHttpSession httpSession) {
//根据上传的piurl获得图片名
//Integer id = (Integer) request.getAttribute(“courseId“);
//request.get
System.out.println(“id:“+courseId);
//if(courseId!=null){
courseService.deleteCourseById(courseId);
//}
String username = (String) httpSession.getAttribute(“username“);
user_info user = userInfoService.getUserByUserName(username);
//System.out.println(user.getUserid());
List course_list = courseService.getCourseByTeacherId(user.getUserid());
ModelAndView modelAndView = new ModelAndView(“teacher/home“);
modelAndView.addobject(“usertype““教师“);
modelAndView.addobject(“user“user);
//还需要获取user所有的课程,传递给home
modelAndView.addobject(“course_list“course_list);
return modelAndView;
}
/*
 * 返回我的课程界面
 * 
 */
@RequestMapping(“/toMyCourse“)
public ModelAndView toMyCourse(HttpSession httpSession) {
String username = (String) httpSession

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-06-01 09:44  moocDemo-master\
     文件         349  2017-06-01 09:44  moocDemo-master\README.md
     目录           0  2017-06-01 09:44  moocDemo-master\demo\
     文件        1859  2017-06-01 09:44  moocDemo-master\demo\.classpath
     文件        1043  2017-06-01 09:44  moocDemo-master\demo\.project
     目录           0  2017-06-01 09:44  moocDemo-master\demo\.settings\
     文件         626  2017-06-01 09:44  moocDemo-master\demo\.settings\.jsdtscope
     文件         137  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.core.resources.prefs
     文件         422  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.jdt.core.prefs
     文件          86  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.m2e.core.prefs
     文件         726  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.wst.common.component
     文件         245  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件          48  2017-06-01 09:44  moocDemo-master\demo\.settings\org.eclipse.wst.validation.prefs
     文件         162  2017-06-01 09:44  moocDemo-master\demo\.tern-project
     文件        5766  2017-06-01 09:44  moocDemo-master\demo\pom.xml
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\main\
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\main\java\
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\controller\
     文件        5409  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\controller\CourseController.java
     文件        5865  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\controller\CourseDetailController.java
     文件        5665  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\controller\UploadController.java
     文件        6994  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\controller\UserInfoController.java
     目录           0  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\dao\
     文件         507  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\dao\courseMapper.java
     文件         533  2017-06-01 09:44  moocDemo-master\demo\src\main\java\com\ssdut\demo\dao\coursedetailsMapper.java
............此处省略404个文件信息

评论

共有 条评论