diff --git a/src/main/java/com/fjy/spring/controller/DataController.java b/src/main/java/com/fjy/spring/controller/DataController.java index b164ac2..cadd76d 100644 --- a/src/main/java/com/fjy/spring/controller/DataController.java +++ b/src/main/java/com/fjy/spring/controller/DataController.java @@ -1,15 +1,9 @@ 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.domain.*; 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; +import com.fjy.spring.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -31,6 +25,12 @@ public class DataController { @Autowired private CourseService courseService; + @Autowired + private UserService userService; + + @Autowired + private HomeworkService homeworkService; + @GetMapping("/home/findAllHomework") public List findAllHomework(){ List homeworks = workDetailService.findAll(); @@ -70,4 +70,24 @@ public class DataController { new UserException(ResultEnum.EMPTY_DATA); return null; } + + @GetMapping("/home/findalluser") + public List findAllUser(){ + List users = userService.findAllUser(); + if (users!=null){ + return users; + } + new UserException(ResultEnum.EMPTY_DATA); + return null; + } + + @GetMapping("/home/findallvhomework") + public List findAllVHomework(){ + List vHomeworks = homeworkService.findAllVHomework(); + if (vHomeworks!=null){ + return vHomeworks; + } + new UserException(ResultEnum.EMPTY_DATA); + return null; + } } diff --git a/src/main/java/com/fjy/spring/domain/VHomework.java b/src/main/java/com/fjy/spring/domain/VHomework.java new file mode 100644 index 0000000..62ab4fd --- /dev/null +++ b/src/main/java/com/fjy/spring/domain/VHomework.java @@ -0,0 +1,89 @@ +package com.fjy.spring.domain; + +import org.hibernate.annotations.Immutable; +import org.hibernate.annotations.Subselect; + +import javax.persistence.*; + +@Entity +@Immutable +@Subselect("SELECT * FROM v_homework") +public class VHomework { + @Id + @Column(name = "workid") + private Integer Id; + + @Column(name = "workname") + private String Name; + + @Column(name = "worktime") + private String Time; + + @Column(name = "colfileid") + private Integer fileid; + + @Column(name = "workfolder") + private String Folder; + + @Column(name = "coursename") + private String courseName; + + @Column(name = "workremark") + private String Remark; + + public Integer getId() { + return Id; + } + + public void setId(Integer id) { + Id = id; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getTime() { + return Time; + } + + public void setTime(String time) { + Time = time; + } + + public Integer getFileid() { + return fileid; + } + + public void setFileid(Integer fileid) { + this.fileid = fileid; + } + + public String getFolder() { + return Folder; + } + + public void setFolder(String folder) { + Folder = folder; + } + + public String getCourseName() { + return courseName; + } + + public void setCourseName(String courseName) { + this.courseName = courseName; + } + + public String getRemark() { + return Remark; + } + + public void setRemark(String remark) { + Remark = remark; + } +} diff --git a/src/main/java/com/fjy/spring/domain/VLog.java b/src/main/java/com/fjy/spring/domain/VLog.java index 4c1f1d2..d17f2be 100644 --- a/src/main/java/com/fjy/spring/domain/VLog.java +++ b/src/main/java/com/fjy/spring/domain/VLog.java @@ -7,7 +7,7 @@ import javax.persistence.*; @Entity @Immutable -@Subselect("SELECT *FROM v_log LIMIT 0, 20") +@Subselect("SELECT * FROM v_log ORDER BY coltime LIMIT 0, 20") public class VLog { @Id private Integer logid; diff --git a/src/main/java/com/fjy/spring/repository/VHomeworkRepository.java b/src/main/java/com/fjy/spring/repository/VHomeworkRepository.java new file mode 100644 index 0000000..f8f5ba8 --- /dev/null +++ b/src/main/java/com/fjy/spring/repository/VHomeworkRepository.java @@ -0,0 +1,8 @@ +package com.fjy.spring.repository; + +import com.fjy.spring.domain.VHomework; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface VHomeworkRepository extends JpaRepository { +} diff --git a/src/main/java/com/fjy/spring/service/HomeworkService.java b/src/main/java/com/fjy/spring/service/HomeworkService.java index 552d5e6..5ac3f42 100644 --- a/src/main/java/com/fjy/spring/service/HomeworkService.java +++ b/src/main/java/com/fjy/spring/service/HomeworkService.java @@ -1,8 +1,10 @@ package com.fjy.spring.service; import com.fjy.spring.domain.Homework; +import com.fjy.spring.domain.VHomework; import com.fjy.spring.domain.VWorkDetail; import com.fjy.spring.repository.HomeworkRepository; +import com.fjy.spring.repository.VHomeworkRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -13,7 +15,14 @@ public class HomeworkService { @Autowired private HomeworkRepository homeworkRepository; + @Autowired + private VHomeworkRepository vHomeworkRepository; + public List findAll(){ return homeworkRepository.findAll(); } + + public List findAllVHomework(){ + return vHomeworkRepository.findAll(); + } } diff --git a/src/main/java/com/fjy/spring/service/UserService.java b/src/main/java/com/fjy/spring/service/UserService.java index b789b5a..b644a23 100644 --- a/src/main/java/com/fjy/spring/service/UserService.java +++ b/src/main/java/com/fjy/spring/service/UserService.java @@ -7,6 +7,8 @@ import com.fjy.spring.repository.TbUserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class UserService { @@ -37,4 +39,8 @@ public class UserService { } return false; } + + public List findAllUser(){ + return tbUserRepository.findAll(); + } } diff --git a/src/main/resources/static/js/common.js b/src/main/resources/static/js/common.js index 4ae6a53..440d04a 100644 --- a/src/main/resources/static/js/common.js +++ b/src/main/resources/static/js/common.js @@ -1,30 +1,12 @@ -/* -/!* - * the first time to call - *!/ -setTimeout(function () { - Push(); -// alert("setTimeout called"); -}, 200); - -setInterval(function () { - Push(); - //alert("setInterval called"); -}, 3000); - -//con.showMsg('登录成功'); -function Push() { - $.ajax({ - type: "POST", - url: "../CheckLoginServlet?dt=" + new Date().getTime(),//why getTime and wont use - data: {}, - beforeSend: function () { - }, - success: function (data) { - var obj = eval("(" + data + ")");//eval使用前要先加括号,才能得到完整的json数据 - if (obj.msg != 0) { - con.showMsg(obj.msg); - } - } - }) -};*/ \ No newline at end of file +function getRootPath_web() { + //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp + var curWwwPath = window.document.location.href; + //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp + var pathName = window.document.location.pathname; + var pos = curWwwPath.indexOf(pathName); + //获取主机地址,如: http://localhost:8083 + var localhostPaht = curWwwPath.substring(0, pos); + //获取带"/"的项目名,如:/uimcardprj + var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); + return (localhostPaht + projectName); +} diff --git a/src/main/resources/static/js/homework.js b/src/main/resources/static/js/homework.js index f644aac..449f485 100644 --- a/src/main/resources/static/js/homework.js +++ b/src/main/resources/static/js/homework.js @@ -6,45 +6,33 @@ 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 弄' - }], + homeworkData: [ + { + fileid: 56, + courseName: "信息安全", + name: "实验报告", + id: 1, + time: "2018-02-06 20:44:08.0", + remark: "3000字以上", + folder: "第一次作业" + } + ], multipleSelection: [] } }, + mounted() { + this.$nextTick(() => { + var that = this; + axios.get('http://localhost:8080/cms/home/findallvhomework') + .then(function (response) { + console.log(response.data); + that.homeworkData = response.data; + }) + .catch(function (error) { + console.log(error); + }); + }) + }, methods: { togglePost(url){ axios({ diff --git a/src/main/resources/static/js/manageuser.js b/src/main/resources/static/js/manageuser.js index 93a35c6..93d8f28 100644 --- a/src/main/resources/static/js/manageuser.js +++ b/src/main/resources/static/js/manageuser.js @@ -2,45 +2,41 @@ var Main = { data() { return { activeIndex: '1', - 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 弄' - }], + userData: [ + { + coluserid: 53, + colname: "FFFF", + colpassword: "330399941720950163549766122324520082468573044291", + colemail: "123@gmail.com", + colstudentno: "123456", + colrealname: "ENMM" + } + ], multipleSelection: [] } }, + mounted() { + this.$nextTick(() => { + var that = this; + axios.get('http://localhost:8080/cms/home/findalluser') + .then(function (response) { + console.log(response.data); + that.userData = response.data; + }) + .catch(function (error) { + console.log(error); + }); + /*axios.get('http://localhost:8080/cms/home/findvfeedback') + .then(function (response) { + console.log(response.data); + that.feedbackData = response.data; + //that.limitTime = response.data; + }) + .catch(function (error) { + console.log(error); + });*/ + }) + }, methods: { togglePost(url){ /*axios({ diff --git a/src/main/resources/templates/home/admin.html b/src/main/resources/templates/home/admin.html index 688e1af..1c6ed38 100644 --- a/src/main/resources/templates/home/admin.html +++ b/src/main/resources/templates/home/admin.html @@ -16,21 +16,7 @@ - -
- 管理员
- 管理员号 -
-
- 后台主页 -
- 课程管理 -
- 作业管理 -
- 用户管理 -
-
+
diff --git a/src/main/resources/templates/home/homework.html b/src/main/resources/templates/home/homework.html index 1abf68c..bef2a0f 100644 --- a/src/main/resources/templates/home/homework.html +++ b/src/main/resources/templates/home/homework.html @@ -1,65 +1,23 @@ - - - - - 作业管理 - - - + + + - - - - - +
- - - 首页 - - - 选项1 - 选项2 - 选项3 - - 关于 - 意见反馈 - 登出 - - + - - -
- 用户名
- 学号 -
-
- 首页
- 个人中心
- 关于
- 意见反馈 -
-
+ + - -
- 管理员
- 管理员号 -
-
- 用户管理
- 课程/老师管理
- 作业管理
- 公告/日志 -
-
+ +
@@ -69,16 +27,19 @@ 取消选择 删除作业
- - + - - + - + - + + + + + @@ -123,7 +84,7 @@ - - + + diff --git a/src/main/resources/templates/home/managecourse.html b/src/main/resources/templates/home/managecourse.html index fc1cb54..7c1110f 100644 --- a/src/main/resources/templates/home/managecourse.html +++ b/src/main/resources/templates/home/managecourse.html @@ -16,18 +16,8 @@ - -
- 管理员
- 管理员号 -
-
- 用户管理
- 课程/老师管理
- 作业管理
- 公告/日志 -
-
+ +
diff --git a/src/main/resources/templates/home/manageuser.html b/src/main/resources/templates/home/manageuser.html index a532788..908d558 100644 --- a/src/main/resources/templates/home/manageuser.html +++ b/src/main/resources/templates/home/manageuser.html @@ -1,85 +1,43 @@ - - - - - 用户管理 - - - + + + - - - - - - +
- - - 首页 - - - 选项1 - 选项2 - 选项3 - - 关于 - 意见反馈 - 登出 - - + - - -
- 用户名
- 学号 -
-
- 首页
- 个人中心
- 关于
- 意见反馈 -
-
+ + - -
- 管理员
- 管理员号 -
-
- 用户管理
- 课程/老师管理
- 作业管理
- 公告/日志 -
-
+ +
@@ -88,14 +46,11 @@
- - +
- - + +