完成课程管理数据读取,修复页面加载css,js错误
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.fjy.spring.controller;
|
||||
|
||||
import com.fjy.spring.domain.VCourse;
|
||||
import com.fjy.spring.domain.VFeedBack;
|
||||
import com.fjy.spring.domain.VLog;
|
||||
import com.fjy.spring.domain.VWorkDetail;
|
||||
import com.fjy.spring.enums.ResultEnum;
|
||||
import com.fjy.spring.exception.UserException;
|
||||
import com.fjy.spring.service.CourseService;
|
||||
import com.fjy.spring.service.FeedBackService;
|
||||
import com.fjy.spring.service.LogService;
|
||||
import com.fjy.spring.service.WorkDetailService;
|
||||
@@ -26,6 +28,9 @@ public class DataController {
|
||||
@Autowired
|
||||
private FeedBackService feedBackService;
|
||||
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
@GetMapping("/home/findAllHomework")
|
||||
public List<VWorkDetail> findAllHomework(){
|
||||
List<VWorkDetail> homeworks = workDetailService.findAll();
|
||||
@@ -55,4 +60,14 @@ public class DataController {
|
||||
new UserException(ResultEnum.EMPTY_DATA);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping("/home/findvcourse")
|
||||
public List<VCourse> findVCourse(){
|
||||
List<VCourse> vCourses = courseService.findAllVCourse();
|
||||
if (vCourses!=null){
|
||||
return vCourses;
|
||||
}
|
||||
new UserException(ResultEnum.EMPTY_DATA);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,27 @@ public class NavController {
|
||||
return "/home/about";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/admin"})
|
||||
@GetMapping(value = {"/home/admin"})
|
||||
public String toAdminPage(){
|
||||
return "/home/admin";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/home/managecourse"})
|
||||
public String toManageCoursePage(){
|
||||
return "/home/managecourse";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/home/manageuser"})
|
||||
public String toManageUserPage(){
|
||||
return "/home/manageuser";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/home/homework"})
|
||||
public String toHomeworkPage(){
|
||||
return "/home/homework";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = {"/home/user"})
|
||||
public String toUserPage(){
|
||||
return "/home/user";
|
||||
|
||||
71
src/main/java/com/fjy/spring/domain/VCourse.java
Normal file
71
src/main/java/com/fjy/spring/domain/VCourse.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.fjy.spring.domain;
|
||||
|
||||
import org.hibernate.annotations.Immutable;
|
||||
import org.hibernate.annotations.Subselect;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Entity
|
||||
@Immutable
|
||||
@Subselect("SELECT * FROM v_course")
|
||||
public class VCourse {
|
||||
@Id
|
||||
@Column(name = "courseno")
|
||||
private Integer courseNo;
|
||||
|
||||
@Column(name = "coursename")
|
||||
private String courseName;
|
||||
|
||||
@Column(name = "coursetime")
|
||||
private String courseTime;
|
||||
|
||||
@Column(name = "colrealname")
|
||||
private String teacherusername;
|
||||
|
||||
@Column(name = "colname")
|
||||
private String teacherrealname;
|
||||
|
||||
public Integer getCourseNo() {
|
||||
return courseNo;
|
||||
}
|
||||
|
||||
public void setCourseNo(Integer courseNo) {
|
||||
this.courseNo = courseNo;
|
||||
}
|
||||
|
||||
public String getCourseName() {
|
||||
return courseName;
|
||||
}
|
||||
|
||||
public void setCourseName(String courseName) {
|
||||
this.courseName = courseName;
|
||||
}
|
||||
|
||||
public String getCourseTime() {
|
||||
return courseTime;
|
||||
}
|
||||
|
||||
public void setCourseTime(String courseTime) {
|
||||
this.courseTime = courseTime;
|
||||
}
|
||||
|
||||
public String getTeacherusername() {
|
||||
return teacherusername;
|
||||
}
|
||||
|
||||
public void setTeacherusername(String teacherusername) {
|
||||
this.teacherusername = teacherusername;
|
||||
}
|
||||
|
||||
public String getTeacherrealname() {
|
||||
return teacherrealname;
|
||||
}
|
||||
|
||||
public void setTeacherrealname(String teacherrealname) {
|
||||
this.teacherrealname = teacherrealname;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.fjy.spring.repository;
|
||||
|
||||
|
||||
import com.fjy.spring.domain.VCourse;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface VCourseRepository extends JpaRepository<VCourse,Integer> {
|
||||
|
||||
}
|
||||
18
src/main/java/com/fjy/spring/service/CourseService.java
Normal file
18
src/main/java/com/fjy/spring/service/CourseService.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.fjy.spring.service;
|
||||
|
||||
import com.fjy.spring.domain.VCourse;
|
||||
import com.fjy.spring.repository.VCourseRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CourseService {
|
||||
@Autowired
|
||||
private VCourseRepository vcourseRepository;
|
||||
|
||||
public List<VCourse> findAllVCourse(){
|
||||
return vcourseRepository.findAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user