fix part4

Signed-off-by: Chenx221 <chenx221@yandex.com>
This commit is contained in:
Chenx221 2023-06-19 20:34:38 +08:00
parent bf3e198ed2
commit 0ef50e408c
12 changed files with 41 additions and 56 deletions

View File

@ -100,50 +100,58 @@
- ~/addinfo
- 学生信息添加 [Post]
- admin,teacher
- *Redirect*.infomodv2|*Redirect*.infomodv2_t
- /system
- ~/settings
- 系统设置页
- 系统设置页 [Get]
- admin
- settings
- ~/clean
- 清理垃圾
- 清理垃圾 [Get]
- admin
- *Redirect*.settings
- /teacher
- ~/mamage
- 教师信息管理页
- 教师信息管理页 [Get]
- admin
- teachermanage
- ~/query
- 教师信息查询
- 教师信息查询 [Post]
- admin
- teacherQueryResult
- ~/mod
- 教师信息修改
- 教师信息修改 [Post]
- admin
- ~/del
- 教师信息删除
- 教师信息删除 [Post]
- admin
- ~/add
- 教师信息添加
- 教师信息添加 [Post]
- admin
- /login
- 用户登录页(和/相同)
- everyone
- 用户登录页(和/相同) [Get]
- Everyone
- /signup
- 用户(管理员)注册
- everyone
- 用户(管理员)注册 [Post]
- Everyone
- /user
- ~/usermanage
- 用户管理页
- 用户管理页 [Get]
- admin
- usermanage
- ~/create
- 用户创建
- 用户创建 [Post]
- admin
- *Redirect*.usermanage
- ~/reset
- 重设密码
- 重设密码 [Post]
- admin
- *Redirect*.usermanage
- ~/userdisabled
- 禁用用户
- 禁用用户 [Post]
- admin
- ~/userenabled
- 启用用户
- 启用用户 [Post]
- admin
- /success
- 废弃的成功状态页
@ -152,11 +160,6 @@
- 废弃的失败状态页
- None
- /dashboard
- 管理员登陆后的首页
- admin
- /dashboard-t
- 教师登陆后的首页
- teacher
- /dashborad-s
- 学生登录后的首页
- student
- 登陆后的首页
- admin,teacher,student
- dashboard|dashboard_t|dashboard_s

View File

@ -1,8 +1,6 @@
package cyou.chenx221.controller;
import cyou.chenx221.helper.UsernameHelper;
import cyou.chenx221.pojo.Course;
import cyou.chenx221.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@ -12,7 +10,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.io.File;
import java.text.DecimalFormat;
import java.util.List;
@Controller
@RequestMapping("/system")
@ -28,7 +25,7 @@ public class SystemController {
model.addAttribute("message", message);
}
model.addAttribute("trashSize", formatFileSize(getTrashSize()));
return "settings";
return "system/settings";
}
public long getTrashSize() {

View File

@ -4,7 +4,6 @@ import cyou.chenx221.helper.CsvHelper;
import cyou.chenx221.helper.UsernameHelper;
import cyou.chenx221.pojo.Course;
import cyou.chenx221.pojo.Teacher;
import cyou.chenx221.service.CourseService;
import cyou.chenx221.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@ -41,7 +40,7 @@ public class TeacherController {
model.addAttribute("errorMessage", errorMessage);
List<Teacher> teacherList = teacherService.getAllTeachers();
model.addAttribute("teacherList", teacherList);
return "teachermanage";
return "teacher/teachermanage";
}
@PostMapping(value = "/query", produces = "application/x-www-form-urlencoded;charset=UTF-8")
@ -103,7 +102,7 @@ public class TeacherController {
List<Teacher> teachers = teacherService.getQueryTeachers(teacher);
model.addAttribute("teachers", teachers);
model.addAttribute("download", new CsvHelper().generateTeacherCSVFile(teachers));
return "teacherQueryResult";
return "teacher/teacherQueryResult";
}
@ResponseBody

View File

@ -92,7 +92,7 @@ public class UserController {
model.addAttribute("userList", userList);
model.addAttribute("successMessage", successMessage);
model.addAttribute("errorMessage", errorMessage);
return "usermanage";
return "user/usermanage";
}
@RequestMapping(path = "/user/create", method = {RequestMethod.POST})

View File

@ -10,41 +10,27 @@ import org.springframework.web.bind.annotation.RequestMethod;
public class ViewController {
@RequestMapping(path = "/success", method = {RequestMethod.GET, RequestMethod.POST}) //弃用
public String success() {
return "views/success"; // 视图文件名
return "success"; // 视图文件名
}
@RequestMapping(path = "/fail", method = {RequestMethod.GET, RequestMethod.POST}) //弃用
public String fail() {
return "views/fail"; // 视图文件名
return "fail"; // 视图文件名
}
@RequestMapping(path = "/dashboard", method = {RequestMethod.GET, RequestMethod.POST})
@RequestMapping(path = "/dashboard", method = {RequestMethod.GET})
public String showDashboard(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
// model.addAttribute("errorMessage","null");
return "dashboard"; // 返回 dashboard 视图名
}
@RequestMapping(path = "/dashboard-t", method = {RequestMethod.GET, RequestMethod.POST})
public String showDashboardT(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
String role = new UsernameHelper().getCurrentRole();
if (role.equals("[ROLE_admin]"))
return "dashboard/dashboard";
else if (role.equals("[ROLE_teacher]")) {
return "dashboard/dashboard_t";
} else {
return "dashboard/dashboard_s";
}
// model.addAttribute("errorMessage","null");
return "dashboard_t"; // 返回 dashboard 视图名
}
@RequestMapping(path = "/dashboard-s", method = {RequestMethod.GET, RequestMethod.POST})
public String showDashboardS(Model model) {
String username = new UsernameHelper().getCurrentUsername();
if (username != null) {
model.addAttribute("username", username);
}
// model.addAttribute("errorMessage","null");
return "dashboard_s"; // 返回 dashboard 视图名
}
}