基于javaweb+mysql的springboot教务管理系统(java+thymeleaf+html+spring+springboot+layui+maven)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot教务管理系统(java+thymeleaf+html+spring+springboot+layui+maven)
一、项目简述
功能包括: 三角色教师 管理员,学生教务管理系统,包括院系管理,课题综合管理,信息管理,以及差旅管理,学生选题等等。
二、项目运行 环境配置:
Jdk1.8 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
if (projects != null) {
for (int i = 0; i < projects.size(); i++) {
if (projects.get(i).getSelectFlag() == 0) projects.get(i).setProjectGB("可选");
else if (projects.get(i).getSelectFlag() == 1) projects.get(i).setProjectGB("不可选");
}
}
return projects;
}
public int delete_specialty(Long specialty_id) {
return specialtyMapper.deleteByPrimaryKey(specialty_id);
}
@Override
public int update_specialty(Long specialty_id, Long section_id, String specialty_name) {
Specialty specialty = new Specialty();
specialty.setId(specialty_id);
specialty.setIdSection(section_id);
specialty.setSpecialtyName(specialty_name);
return specialtyMapper.updateByPrimaryKeySelective(specialty);
}
@Override
public List<Specialty> select_specialty(Long institute_id, Long section_id, Long specialty_id, String specialty_name) {
return specialtyMapper.select_specialty(institute_id, section_id, specialty_id, specialty_name); // 根据学院id 或者 教研室id 查所有专业方向
}
@Override
public List<Institute> select_institute(Long institute_id, String institute_name) {
InstituteExample instituteExample = new InstituteExample();
InstituteExample.Criteria criteria = instituteExample.createCriteria();
if (institute_id != null && institute_id != 0) criteria.andIdEqualTo(institute_id);
if (institute_name != null && institute_name.length() > 0) criteria.andInstituteNameEqualTo(institute_name);
return instituteMapper.selectByExample(instituteExample);
}
}
public class WordUtils {
for(Cookie cookie : cookies){
// System.out.println("cookie:"+cookie.getName());
// System.out.println("value:"+cookie.getValue());
// System.out.println("path:"+cookie.getPath());
// System.out.println();
String path = cookie.getPath();
String name = cookie.getName();
String value = cookie.getValue();
if(
name.equals("token") &&
value!=null &&
value.length()!=0
)
{
token = cookie.getValue();
break;
}
}
if(token == null){
token = request.getHeader("Authorization");
}
if(token == null){
return null;
}
try {
//选用 HMAC256 算法 ,私钥为 JWT_SECRET
JWTVerifier verifier = JWT.require(Algorithm.HMAC256(JWT_SECRET))
// .withIssuer("zz")
.build(); //Reusable verifier instance
//验证Token的合法性
DecodedJWT jwt = verifier.verify(token);
User user = JSON.parseObject(jwt.getClaim("user").asString(),User.class);
return user;
} catch ( TokenExpiredException e){
// e.printStackTrace();
throw new LoginTimeoutException("登录超时");
} catch (JWTVerificationException exception ){
// exception.printStackTrace();
}
return null;
}
}
@ResponseBody
public String modifyinfodao(Student student, String className, Model model) {
Student Tstudent = (Student) request.getSession().getAttribute("student");
MyClass Tclass = indexService.selectByclassName(className);
int count = -1;
student.setIdClass(Tclass.getId());
System.out.println("******"+Tstudent.toString());
System.out.println("******"+student.toString());
if (student.getStunum().equals(Tstudent.getStunum())) {
student.setStunum(null);
}
if (student.getIdClass().equals(Tstudent.getIdClass())) {
student.setIdClass(null);
}
if (student.getName().equals(Tstudent.getName())) {
student.setName(null);
}
if (student.getGender().equals(Tstudent.getGender())) {
student.setGender(null);
}
if (student.getGender() == null && student.getName() == null && student.getIdClass() == null && student.getStunum() == null) {
} else {
student.setId(Tstudent.getId());
count = indexService.updateBymodifyinfo(student);
student = indexService.selectByid(Tstudent.getId());
model.addAttribute("student", student);
}
if (count > 0) {
request.getSession().setAttribute("student",student);
request.getSession().setAttribute("modifyFlag",1);
return "200";
} else {
request.getSession().setAttribute("modifyFlag",0);
return "201";
}
}*/
/**
* 跳转页面(修改密码)
*/
@RequestMapping("/changepsw")
public String changepsw() {
return "student/changepsw";
}
/**
* 200修改成功
* 201对不起密码错误
@PostMapping("/specialty")
public Msg postSpecialty(
@RequestBody @Validated({Add.class}) Specialty specialty,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) specialtyService.postSpecialty(specialty, id_institute));
}
// 班级
@GetMapping("/ClassManagement")
public String Class() {
return "admin/Department/ClassManagement";
// //获取管理员的 学院id
// public static Long getIdInstitute(ModelMap modelMap) {
// Subadmin subadmin = (Subadmin) modelMap.get("admin");
// return subadmin.getIdInstitute();
// }
}
@ResponseBody
@GetMapping("/classes")
public Msg getClasses(
@RequestParam("offset") Integer offset,
@RequestParam(required = false) Long specialtyId,
@RequestParam(required = false) String keyWord,
@ModelAttribute("id_institute") long id_institute) {
long total = classService.getClassesCount(offset, keyWord, specialtyId, id_institute);
return Msg.success()
.add("classes", classService.getClasses(offset, keyWord, specialtyId, id_institute))
.add("total", total);
}
@ResponseBody
@DeleteMapping("/class")
public Msg delClass(
@RequestBody MyClass myClass,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) classService.delClass(myClass, id_institute));
}
@ResponseBody
@PutMapping("/class")
public Msg putClass(
@RequestBody @Validated({One.class}) MyClass myClass,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) classService.putClass(myClass, id_institute));
}
cell.setCellStyle(style3);
region = new CellRangeAddress(index, index, (short) 2, (short) 6);
sheet.addMergedRegion(region);
fun8(region, sheet, workBook);
cell = row.createCell(2);
cell.setCellValue(aa[j]);
cell.setCellStyle(style3);
row.setHeightInPoints(30);
}
//获取科研及成果
String achievementsInScientificResearch = debriefingYear.getAchievementsinscientificresearch();
aa = achievementsInScientificResearch.split("/");
row = sheet.createRow(index);
region = new CellRangeAddress(index, index + aa.length - 1, (short) 0, (short) 0);
sheet.addMergedRegion(region);
fun8(region, sheet, workBook);
//填充科研及成果
for (int j = 0; j < aa.length; index++, j++) {
row = sheet.createRow(index);
cell = row.createCell(1);
cell.setCellValue(j + 1);
cell.setCellStyle(style3);
cell = row.createCell(0);
cell.setCellValue("科研及成果");
cell.setCellStyle(style3);
region = new CellRangeAddress(index, index, (short) 2, (short) 6);
sheet.addMergedRegion(region);
fun8(region, sheet, workBook);
cell = row.createCell(2);
cell.setCellValue(aa[j]);
cell.setCellStyle(style3);
row.setHeightInPoints(30);
}
//获取其它方面工作
String otherWork = debriefingYear.getOtherwork();
aa = otherWork.split("/");
region = new CellRangeAddress(index, index + aa.length - 1, (short) 0, (short) 0);
sheet.addMergedRegion(region);
fun8(region, sheet, workBook);
File dirs = new File(savePath);
//判断路径是否存在,如果不存在就创建一个
if (!dirs.exists()) {
dirs.mkdirs();
}
file.transferTo(new File(dirs, uploadFileName)); // 开始接受文件
SubjectWithBLOBs project = subject1;
project.setProjectname(projectName);
project.setIdProjecttype(idProjecttype);
project.setIdProjectsource(idProjectsource);
project.setFilepath(saveFileName);
project.setMarchspecialty(marchspecialty.trim());
project.setTeachernames(teachernames);
//修改后状态置 0
project.setSelectFlag(0);
project.setVerifyprojectFlag(0);
project.setReleaseFlag(0);
int i = subjectService.updateSubjectByid(project);
return Msg.success();
}
}
@Controller
public class LoginController {
private static final Logger LOGGER = LoggerFactory.getLogger(LoginController.class);
@Autowired
AdminService adminService;
@GetMapping("/cs")
public String cs() {
return "cs";
}
@GetMapping("/login")
public String login() {
return "login";
}
@PostMapping("/login")
@ResponseBody
public Msg login(String name, String pwd, HttpSession httpSession) {
name = name.trim();
// LOGGER.info("{}--{}",name,pwd);
return adminService.login(name, pwd, httpSession);
}
}
public interface ExcelService {
// HttpHeaders headers = new HttpHeaders();
// headers.setContentLength(100000);
//
// headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
// String encodeFilename = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
// headers.setContentDispositionFormData("attachment", encodeFilename);
response.setCharacterEncoding("utf-8");
response.setContentType("application/force-download");
String outputName = fileName;
String encodeFilename = URLEncoder.encode(outputName, StandardCharsets.UTF_8.toString());
response.setHeader("Content-disposition", "attachment; filename=" + encodeFilename );
byte[] buffer = new byte[1024];
FileInputStream fis = null;
BufferedInputStream bis = null;
try {
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
OutputStream os = response.getOutputStream();
int i = bis.read(buffer);
while (i != -1) {
os.write(buffer, 0, i);
i = bis.read(buffer);
}if (os != null){
os.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
teacher.setName(name);
teacher.setGender(gender);
teacherService.teacherupdateInfo(teacher);
return Msg.success();
}
//教师出差模块
//查询所有教师出差申请信息
@GetMapping("/select_work_all")
@ResponseBody
public Msg fun1(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectTeacherWorkAll(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询申请成功教师出差申请
@GetMapping("/select_work_success")
@ResponseBody
public Msg fun2(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSuccess(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询申请失败教师出差申请
@GetMapping("/select_work_failed")
@ResponseBody
public Msg fun3(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkFailed(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询已提交教师出差申请
@GetMapping("/select_work_submitted")
@ResponseBody
public Msg fun4(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSubmitted(teacher.getId());
return Msg.success().add("workinfo", list);
}
//删除申请失败的教师出差
@GetMapping("/examine")
@ResponseBody
public Msg fun3(Integer pn, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
PageHelper.startPage(pn, 9);
List<WorkapprovalWithBLOBs> list = staticService.selectAllWorkApproval(teacher.getIdSection());
PageInfo page = new PageInfo(list, 5);
return Msg.success().add("workInfo", page);
}
//审核员审核出差申请
@PostMapping("/SH_work")
@ResponseBody
public Msg fun4(Long zt, Long workID, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
WorkapprovalWithBLOBs workapprovalWithBLOBs = teacherService.selectWorkById(workID);
if (zt == 1) {
workapprovalWithBLOBs.setAppovalflag(1);
} else {
workapprovalWithBLOBs.setAppovalflag(2);
}
Date date = new Date();
workapprovalWithBLOBs.setAppovaldate(date);
workapprovalWithBLOBs.setIdSubadmin(teacher.getId());
staticService.updateShWorkApproval(workapprovalWithBLOBs);
return Msg.success();
}
//下载年度专业技术人员考核表
@GetMapping("/down_technical_personnel")
public void fun5(Long year, HttpSession httpSession, HttpServletResponse response) throws IOException {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
response.setCharacterEncoding("utf-8");
response.setContentType("application/ms-word");
OutputStream output = response.getOutputStream();
String outputName = "专业技术人员考核表(一年一张)";
String encodeFilename = URLEncoder.encode(outputName, StandardCharsets.UTF_8.toString());
response.setHeader("Content-disposition", "attachment; filename=" + encodeFilename + ".docx");
TechnicalPersonnelWithBLOBs technicalPersonnelWithBLOBs = teacherService.selectTechnicalPersonnelInfo(teacher.getId(), year);
@RequestParam(required = false) Long sectionId,
@RequestParam(required = false) String keyWord,
@ModelAttribute("id_institute") long id_institute) {
long total = subjectService.selectSubjectsCount(offset, keyWord, sectionId, id_institute);
return Msg.success()
.add("subjects", subjectService.selectSubjects(offset, keyWord, sectionId, id_institute))
.add("total", total);
}
@ResponseBody
@PostMapping("/subject")
public Msg addSubject(
@RequestBody @Validated(Add.class) SubjectWithBLOBs subject,
@ModelAttribute("id_institute") long id_institute) throws MyException {
return Msg.sqlChange((int) subjectService.insertSubject(subject, id_institute));
}
@ResponseBody
@DeleteMapping("/subject")
public Msg delSubject(
@RequestBody SubjectWithBLOBs subject,
@ModelAttribute("id_institute") long id_institute) throws MyException {
return Msg.sqlChange(subjectService.delSubject(subject, id_institute));
}
@ResponseBody
@PutMapping("/subject")
public Msg updateSubject(
@RequestBody @Validated(Update.class) SubjectWithBLOBs subject,
@ModelAttribute("id_institute") long id_institute) throws MyException {
return Msg.sqlChange(subjectService.updateSuject(subject, id_institute));
}
//get学生选题的状态
@GetMapping("/SRS")
@ResponseBody
public Msg getSelectSubjected(
@ModelAttribute("id_institute") long id_institute
) {
System.out.println(subjectService.getSelectSubjected(null, id_institute));
return Msg.success().add("SRS", subjectService.getSelectSubjected(null, id_institute));
}
//get 选某个课题的所有学生
@GetMapping("/studentsBySubject")
@ResponseBody
public Msg getStuentBySubject(
@RequestParam("id") Long id,
@ModelAttribute("id_institute") long id_institute
) {
return subjectService.getStuentBySubject(id, id_institute);
//查询出差类型
@GetMapping("/work_type")
@ResponseBody
public Msg fun1() {
List<Workapprovaltype> list = staticService.selectAllWorkApprovalType();
return Msg.success().add("workInfo", list);
}
//提交出差申请
@PostMapping("/upload_work")
@ResponseBody
public Msg fun2(String idType, String worktitle, String beginDate, String endDate, String location,
String member, HttpSession httpSession) throws ParseException {
//获取教师信息
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
//字符串转换为时间
Date currentTime = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date start = sdf.parse(beginDate);
Date end = sdf.parse(endDate);
WorkapprovalWithBLOBs workapprovalWithBLOBs = new WorkapprovalWithBLOBs();
workapprovalWithBLOBs.setIdType(Long.parseLong(idType));
workapprovalWithBLOBs.setIdTeacher(teacher.getId());
workapprovalWithBLOBs.setWorktitle(worktitle);
workapprovalWithBLOBs.setBeginDate(start);
workapprovalWithBLOBs.setEndDate(end);
workapprovalWithBLOBs.setLocation(location);
workapprovalWithBLOBs.setMember(member);
workapprovalWithBLOBs.setWorkcontent("待定");
//0待审核,1审核通过,2审核未通过
workapprovalWithBLOBs.setAppovalflag(0);
workapprovalWithBLOBs.setSumbitdate(currentTime);
int i = staticService.insertWorkapproval(workapprovalWithBLOBs);
return Msg.success();
}
// 审核员
// 审核员查看审核
//需要更改,现所查无条件,更改为按教研室或学院
@GetMapping("/examine")
@ResponseBody
public Msg fun3(Integer pn, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
public String workLoad() {
return "teacher/fillouttable/workload";
}
@GetMapping("/technical_personnel")
public String technicalPersonnel() {
return "teacher/fillouttable/technicalpersonnel";
}
@GetMapping("/term_business")
public String termBusiness() {
return "teacher/fillouttable/termbusiness";
}
//查看表格页面
@GetMapping("/show_year_debriefing")
public String showYearDebriefing() {
return "teacher/showtable/yeardebriefing";
}
@GetMapping("/show_term_debriefing")
public String showTermDebriefing() {
return "teacher/showtable/termdebriefing";
}
@GetMapping("/show_annual_assessment")
public String showAnnualAssessment() {
return "teacher/showtable/annualassessment";
}
@GetMapping("/show_technical_personnel")
public String showTechnicalPersonnel() {
return "teacher/showtable/technicalpersonnel";
}
@GetMapping("/show_workload")
public String showWorkLoad() {
return "teacher/showtable/workload";
}
@GetMapping("/exit")
public String exit(HttpServletResponse response) {
//将Cookie 中的token 置空
Cookie cookie = new Cookie("token", null);
cookie.setPath("/");
response.addCookie(cookie);
return "redirect:/";
style1.setAlignment(HorizontalAlignment.CENTER);//左右居中
style1.setVerticalAlignment(VerticalAlignment.CENTER);//上下居中
style1.setBorderBottom(BorderStyle.THIN);//下边框
style1.setBorderBottom(BorderStyle.THIN);//下边框
style1.setBorderLeft(BorderStyle.THIN);//左边框
style1.setBorderTop(BorderStyle.THIN);//上边框
style1.setBorderRight(BorderStyle.THIN);//右边框
row = sheet.getRow(0);
XSSFCell cell = row.getCell(0);
cell.setCellStyle(style1); //获取指定行并赋值样式
//设置标题单元格样式
XSSFCellStyle style2 = workBook.createCellStyle();
f = workBook.createFont();
f.setFontHeightInPoints((short) 12);//字号
f.setFontName("仿宋_GB2312");//设置字体
f.setBold(true);//加粗
style2.setFont(f);
style2.setAlignment(HorizontalAlignment.CENTER);//左右居中
style2.setVerticalAlignment(VerticalAlignment.CENTER);//上下居中
style2.setAlignment(HorizontalAlignment.CENTER);
style2.setBorderBottom(BorderStyle.THIN);
style2.setBorderLeft(BorderStyle.THIN);
style2.setBorderRight(BorderStyle.THIN);
style2.setBorderTop(BorderStyle.THIN);
// 创建行,标题行
row = sheet.createRow(1);
cell = row.createCell(0);
cell.setCellValue("部 门");
cell.setCellStyle(style2); //获取指定行并赋值样式
region = new CellRangeAddress(1, 1, (short) 1, (short) 3);
sheet.addMergedRegion(region);
fun8(region, sheet, workBook);
cell = row.createCell(1);
cell.setCellValue(teacher.getInstituteName());
cell.setCellStyle(style2); //获取指定行并赋值样式
cell = row.createCell(4);
cell.setCellValue("填报人");
cell.setCellStyle(style2); //获取指定行并赋值样式
region = new CellRangeAddress(1, 1, (short) 4, (short) 5);
sheet.addMergedRegion(region);
fun8(region, sheet, workBook);
cell = row.createCell(6);
cell.setCellValue(teacher.getName());
cell.setCellStyle(style2); //获取指定行并赋值样式
row.setHeightInPoints(30);
//教师信息修改
//修改教师密码
@PostMapping("/teacherupdetpwd")
@ResponseBody
public Msg fun6(String oldpwd, String newpwd, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
int flag = teacherService.teacherUpdetpwd(teacher.getUsername(), oldpwd, newpwd);
return Msg.success().add("flag", flag);
}
//修改教师信息
@PostMapping("/teacherupdeteinfo")
@ResponseBody
public Msg updateinfo(String name, String gender, HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
teacher.setName(name);
teacher.setGender(gender);
teacherService.teacherupdateInfo(teacher);
return Msg.success();
}
//教师出差模块
//查询所有教师出差申请信息
@GetMapping("/select_work_all")
@ResponseBody
public Msg fun1(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectTeacherWorkAll(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询申请成功教师出差申请
@GetMapping("/select_work_success")
@ResponseBody
public Msg fun2(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSuccess(teacher.getId());
return Msg.success().add("workinfo", list);
}
//查询申请失败教师出差申请
Student student = (Student) request.getSession().getAttribute("student");
removeSession();
List<Static_student> list = adminService.select_student(null, null, student.getIdClass(), null, null);
System.out.println(list);
model.addAttribute("list", list);
return "student/classinfo";
}
/**
* 查看课题
*/
@RequestMapping("/topics")
public String Topics(Model model,HttpSession httpSession) {
Student student = (Student) request.getSession().getAttribute("student");
removeSession();
List<topicsinfo> topicsinfolist = topicsService.topics(student.getIdClass());
System.out.println(topicsinfolist);
model.addAttribute("topicsinfolist", topicsinfolist);
return "student/topicsinfo";
}
/**
* 课题具体信息
*/
@RequestMapping("/topicsto")
public String Topicsto(Long project_id,int selectFlag,String projectName, Model model, HttpSession httpSession) {
List<topicsto> topicstos = topicsService.topicsinfo(project_id);
Student student = (Student) request.getSession().getAttribute("student");
Long flag = topicsService.state(student);
Long flagto = topicsService.flag(project_id);
if (flagto != 0) {
flag = 3L;
}
model.addAttribute("selectFlag",selectFlag);
model.addAttribute("flag", flag);
model.addAttribute("topicstos", topicstos);
model.addAttribute("projectName", projectName);
@GetMapping("/sujecttypes")
public Msg getType() {
return Msg.success().add("sujecttypes", subjectService.selectSubjectTypes());
}
@ResponseBody
@PostMapping("/sujecttype")
public Msg addType(@RequestBody @Validated SubjectType type) throws MyException {
return Msg.sqlChange((int) subjectService.insertSubjectType(type.getTypename()));
}
@ResponseBody
@DeleteMapping("/sujecttype")
public Msg delType(@RequestBody SubjectType type) throws MyException {
return Msg.sqlChange(subjectService.delSubjectType(type.getId()));
}
@ResponseBody
@PutMapping("/sujecttype")
public Msg updateType(@RequestBody @Validated SubjectType type) {
return Msg.sqlChange(subjectService.updateSubjectType(type));
}
//课题管理
@GetMapping("/SubjectManagement")
public String Subject() {
return "admin/Subject/SubjectManagement";
}
@ResponseBody
@GetMapping("/subjects")
public Msg getSubjects(
@RequestParam Integer offset,
@RequestParam(required = false) Long sectionId,
@RequestParam(required = false) String keyWord,
@ModelAttribute("id_institute") long id_institute) {
long total = subjectService.selectSubjectsCount(offset, keyWord, sectionId, id_institute);
return Msg.success()
.add("subjects", subjectService.selectSubjects(offset, keyWord, sectionId, id_institute))
.add("total", total);
}
@ResponseBody
@PostMapping("/subject")
public Msg addSubject(
@RequestBody @Validated(Add.class) SubjectWithBLOBs subject,
@ModelAttribute("id_institute") long id_institute) throws MyException {