Spring中的aware接口详情
293
2022-09-14
Java 实战项目基于遗传算法学校排课系统的实现流程
一、项目简述
本系统功能包括:
排课管理,课程管理,讲师管理,班级管理,学生管理,教学资料,学习文档,在线测试,教材列表,教学设计,帮助中心等等功能。
二、项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。
项目技术:
Springboot + Maven + mybatis+ vue 等等组成,B/S模式 + Maven管理等等。
管理员控制器:
/**
* 管理员控制器
*/
@RestController
public class AdminController {
@Resource(name = "adminService")
private IAdminService adminService;
/**
* 管理员 查询管理员列表
*/
@RequestMapHyuRTguping(value = "/admin/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public ListResult
Map
int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
if (request.containsKey("login_name")) {
param.put("login_name", request.getString("login_name"));
}
if (request.containsKey("name")) {
param.put("name", request.getString("name"));
}
return adminService.qryPage(param, pageNo, pageSize);
}
/**
* 管理员 添加管理员
*/
@RequestMapping(value = "/admin/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
Admin admin = new Admin();
admin.setLoginName(request.getString("login_name"));
admin.setName(request.getString("admin_name"));
admin.setPwd(request.getString("login_name"));
admin.setSex(request.getInteger("sex"));
admin.setUpdateTime(new Date());
return adminService.insert(admin, ImageUtil.stringToBytes(request.getString("admin_image")));
}
/**
* 管理员 更新管理员
*/
@RequestMapping(value = "/admin/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
Admin admin = new Admin();
admin.setLoginName(request.getString("login_name"));
admin.setName(request.getString("admin_name"));
admin.setPwd(request.getString("login_name"));
admin.setSex(request.getInteger("sex"));
admin.setUpdateTime(new Date());
return adminService.update(admin, ImageUtil.stringToBytes(request.getString("admin_image")));
}
/**
* 管理员 删除管理员
*/
@RequestMapping(value = "/admin/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
List
JSONArray array = request.getJSONArray("admin_id_list");
for (int i = 0; i < array.size(); i++) {
adminIdList.add(array.getString(i));
}
return adminService.del(adminIdList);
}
}
学生控制器:
/**
* 学生控制器
*/
@RestController
public class StudentController {
@Resource(name = "studentService")
private IStudentService studentService;
/**
* 管理员 查询学生列表
*/
@RequestMapping(value = "/student/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public ListResult
Map
int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
if (request.containsKey("student_id")) {
param.put("student_id", request.getString("student_id"));
}
if (request.containsKey("name")) {
param.put("name", request.getString("name"));
}
return studentService.qryPage(param, pageNo, pageSize);
}
@RequestMapping(value = "/student/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
Student student = new Student();
student.setStudentId(request.getString("student_id"));
student.setName(request.getString("student_name"));
student.setPwd(request.getString("student_id"));
student.setSex(request.getInteger("sex"));
student.setClassId(request.getString("class_id"));
student.setUpdateTime(new Date());
return studentService.insert(student, ImageUtil.stringToBytes(request.getString("student_image")));
}
@RequestMapping(value = "/student/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnuhttp://m.admin})
public Result
Student student = new Student();
student.setStudentId(request.getString("student_id"));
student.setName(request.getString("student_name"));
student.setPwd(request.getString("student_id"));
student.setSex(request.getInteger("sex"));
student.setClassId(request.getString("class_id"));
student.setUpdateTime(new Date());
return studentService.update(student, ImageUtil.stringToBytes(request.getString("student_image")));
}
@RequestMapping(value = "/student/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
List
JSONArray array = request.getJSONArray("student_id_list");
for (int i = 0; i < array.size(); i++) {
studentIdList.add(array.getString(i));
}
return studentService.del(studentIdList);
}
}
教师控制器:
/**
* 教师控制器
*/
@RestController
public class TeacherController {
@Resource(name = "teacherService")
private ITeacherService teacherService;
/**
* 管理员 查询教师列表
*/
@RequestMapping(value = "/teacher/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public ListResult
Map
int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
if (request.containsKey("teacher_id")) {
param.put("teacher_id", request.getString("teacher_id"));
}
if (request.containsKey("name")) {
param.put("name", request.getString("name"));
}
return teacherService.qryPage(param, pageNo, pageSize);
}
/**
* 管理员 添加教师
*/
@RequestMapping(value = "/teacher/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
Teacher teacher = new Teacher();
teachHyuRTguer.setTeacherId(request.getString("teacher_id"));
teacher.setName(request.getString("teacher_name"));
teacher.setPwd(request.getString("teacher_id"));
teacher.setSex(request.getInteger("sex"));
teacher.setUpdateTime(new Date());
return teacherService.insert(teacher, ImageUtil.stringToBytes(request.getString("teacher_image")));
}
/**
* 管理员 更新教师属性
*/
@RequestMapping(value = "/teacher/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
Teacher teacher = new Teacher();
teacher.setTeacherId(request.getString("teacher_id"));
teacher.setName(request.getString("teacher_name"));
teacher.setPwd(request.getString("teacher_id"));
teacher.setSex(request.getInteger("sex"));
teacher.setUpdateTime(new Date());
return teacherService.update(teacher, ImageUtil.stringToBytes(request.getString("teacher_image")));
}
/**
* 管理员 删除教师
*/
@RequestMapping(value = "/teacher/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public Result
List
JSONArray array = request.getJSONArray("teacher_id_list");
for (int i = 0; i < array.size(); i++) {
teacherIdList.add(array.getString(i));
}
return teacherService.del(teacherIdList);
}
/**
* 管理员 查询所有任教老师
*/
@RequestMapping(value = "/teacher/qryAllList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
@RoleAnnotation(types = {RoleEnum.admin})
public ListResult
return teacherService.qryAllList();
}
}
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~