diff --git a/src/main/java/com/fjy/spring/controller/DataController.java b/src/main/java/com/fjy/spring/controller/DataController.java index 0ad029f..b164ac2 100644 --- a/src/main/java/com/fjy/spring/controller/DataController.java +++ b/src/main/java/com/fjy/spring/controller/DataController.java @@ -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 findAllHomework(){ List homeworks = workDetailService.findAll(); @@ -55,4 +60,14 @@ public class DataController { new UserException(ResultEnum.EMPTY_DATA); return null; } + + @GetMapping("/home/findvcourse") + public List findVCourse(){ + List vCourses = courseService.findAllVCourse(); + if (vCourses!=null){ + return vCourses; + } + new UserException(ResultEnum.EMPTY_DATA); + return null; + } } diff --git a/src/main/java/com/fjy/spring/controller/NavController.java b/src/main/java/com/fjy/spring/controller/NavController.java index b587802..ef2e4b4 100644 --- a/src/main/java/com/fjy/spring/controller/NavController.java +++ b/src/main/java/com/fjy/spring/controller/NavController.java @@ -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"; diff --git a/src/main/java/com/fjy/spring/domain/VCourse.java b/src/main/java/com/fjy/spring/domain/VCourse.java new file mode 100644 index 0000000..65741fb --- /dev/null +++ b/src/main/java/com/fjy/spring/domain/VCourse.java @@ -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; + } +} diff --git a/src/main/java/com/fjy/spring/repository/VCourseRepository.java b/src/main/java/com/fjy/spring/repository/VCourseRepository.java new file mode 100644 index 0000000..155cde0 --- /dev/null +++ b/src/main/java/com/fjy/spring/repository/VCourseRepository.java @@ -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 { + +} diff --git a/src/main/java/com/fjy/spring/service/CourseService.java b/src/main/java/com/fjy/spring/service/CourseService.java new file mode 100644 index 0000000..21c9fd8 --- /dev/null +++ b/src/main/java/com/fjy/spring/service/CourseService.java @@ -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 findAllVCourse(){ + return vcourseRepository.findAll(); + } +} diff --git a/src/main/resources/static/js/admin.js b/src/main/resources/static/js/admin.js index a90f715..32020b3 100644 --- a/src/main/resources/static/js/admin.js +++ b/src/main/resources/static/js/admin.js @@ -17,18 +17,6 @@ var Main = { username: "root", content: "1234214", time: "2018-02-08 10:30:38" - }, - { - id: 72, - username: "root", - content: "afsdas", - time: "2018-02-08 10:31:22" - }, - { - id: 73, - username: "root", - content: "反馈", - time: "2018-02-08 10:35:18" } ], logData:[ diff --git a/src/main/resources/static/js/homePage.js b/src/main/resources/static/js/homePage.js index e365b5c..b70559d 100644 --- a/src/main/resources/static/js/homePage.js +++ b/src/main/resources/static/js/homePage.js @@ -157,7 +157,6 @@ var Main = { console.log(error); }); }) - }, methods: { openNotiSuccess(title,content) { diff --git a/src/main/resources/static/js/managecourse.js b/src/main/resources/static/js/managecourse.js index f644aac..b7ba991 100644 --- a/src/main/resources/static/js/managecourse.js +++ b/src/main/resources/static/js/managecourse.js @@ -6,45 +6,40 @@ var Main = { user: '', region: '' }, - tableData3: [{ - id:'1', - date: '2016-05-03', - name: '王小虎', - address: '上海市普陀区金沙江路 1518 弄' - }, { - id:'2', - date: '2016-05-02', - name: '王小虎', - address: '上海市普陀区金沙江路 1518 弄' - }, { - id:'3', - date: '2016-05-04', - name: '王小虎', - address: '上海市普陀区金沙江路 1518 弄' - }, { - id:'4', - date: '2016-05-01', - name: '王小虎', - address: '上海市普陀区金沙江路 1518 弄' - }, { - id:'5', - date: '2016-05-08', - name: '王小虎', - address: '上海市普陀区金沙江路 1518 弄' - }, { - id:'6', - date: '2016-05-06', - name: '王小虎', - address: '上海市普陀区金沙江路 1518 弄' - }, { - id:'7', - date: '2016-05-07', - name: '王小虎', - address: '上海市普陀区金沙江路 1518 弄' - }], + tableData3: [ + { + courseNo: 1, + courseName: "信息安全", + courseTime: "2018-02-06 20:42:28.0", + teacherusername: "FJY", + teacherrealname: "root" + } + ], multipleSelection: [] } }, + mounted() { + this.$nextTick(() => { + var that = this; + axios.get('http://localhost:8080/cms/home/findvcourse') + .then(function (response) { + console.log(response.data); + that.tableData3 = response.data; + }) + .catch(function (error) { + console.log(error); + }); + /*axios.get('http://localhost:8080/cms/home/findAllHomework') + .then(function (response) { + console.log(response.data); + that.tableHomeworkData = response.data; + //that.limitTime = response.data; + }) + .catch(function (error) { + console.log(error); + });*/ + }) + }, methods: { togglePost(url){ axios({ @@ -70,7 +65,7 @@ var Main = { console.log(key, keyPath); }, ClickToJump(targe){ - window.location.href="http://localhost:8080/cms/" + targe; + window.location.href="http://localhost:8080/cms/home/" + targe; }, toggleSelection(rows) { if (rows) { diff --git a/src/main/resources/templates/home/admin.html b/src/main/resources/templates/home/admin.html index 513d1df..748b39c 100644 --- a/src/main/resources/templates/home/admin.html +++ b/src/main/resources/templates/home/admin.html @@ -22,13 +22,13 @@ 管理员号
- 用户管理 + 后台主页
- 课程/老师管理 + 课程管理
- 作业管理 + 作业管理
- 公告/日志 + 用户管理
@@ -90,7 +90,7 @@ - - + + diff --git a/src/main/resources/templates/home/managecourse.html b/src/main/resources/templates/home/managecourse.html index 9f1fa8d..9884149 100644 --- a/src/main/resources/templates/home/managecourse.html +++ b/src/main/resources/templates/home/managecourse.html @@ -1,51 +1,19 @@ - - - - - 课程|老师 管理 - - - + + + - - - - - +
- - - 首页 - - - 选项1 - 选项2 - 选项3 - - 关于 - 意见反馈 - 登出 - - + - - -
- 用户名
- 学号 -
-
- 首页
- 个人中心
- 关于
- 意见反馈 -
-
+ + @@ -71,14 +39,16 @@
- + + + - + - + - + @@ -98,7 +68,7 @@ 添加 - + @@ -106,14 +76,11 @@ - - + - - + +