项目介绍
后端技术包含springboot+mybatis+spring security+mysql+redis
前端技术包含 semanticUI + thymeleaf模板引擎
使用教程
-
下载项目之后 等待maven安装对应jar包
-
自行下载redis 并按照资源包下的application.yml要求进行配置
-
自行安装MySQL数据库 执行资源包下的sql文件
使用说明
-
运行redis服务器
-
启动项目
-
访问localhost:8080
-
用户名:admin 密码:admin
注意事项
若导出信息时报错,则需要设置mysql,设置方式如下:
SELECT @@sql_mode; 查看是否包含ONLY_FULL_GROUP_BY;若包含,则执行以下命令:
SET GLOBAL sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’;
SET SESSION sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’;
执行完成后,再通过SELECT @@sql_mode; 来查看;
注意:该方法仅用于临时修改,重启mysql后,以上设置失效。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@RequestMapping("changePassword")
public String changePassword(ModelMap modelMap){
modelMap.put("currentUser",userService.getById(MySysUser.id()));
return "admin/user/changePassword";
}
@CrossOrigin
@SysLog("用户修改密码")
@PostMapping("changePassword")
@ResponseBody
public ResponseEntity changePassword(@RequestParam(value = "userName",required = false)String userName,
@RequestParam(value = "oldPwd",required = false)String oldPwd,
@RequestParam(value = "newPwd",required = false)String newPwd,
@RequestParam(value = "confirmPwd",required = false)String confirmPwd){
if(StringUtils.isBlank(oldPwd)){
return ResponseEntity.failure("旧密码不能为空");
}
if(StringUtils.isBlank(newPwd)){
return ResponseEntity.failure("新密码不能为空");
}
if(StringUtils.isBlank(confirmPwd)){
return ResponseEntity.failure("确认密码不能为空");
}
if(!confirmPwd.equals(newPwd)){
return ResponseEntity.failure("确认密码与新密码不一致");
}
//小程序修改密码
if(StringUtils.isBlank(userName)){
// System.out.println(gradeDBS);
return gradeDBS;
}
@RequestMapping("selCl")
@ResponseBody
public Object selCl(Integer gid){
// System.out.println(gid);
List<ClassinfoDB> classinfoDBS = selCourseManageService.selClass(gid);
// System.out.println(classinfoDBS);
return classinfoDBS;
}
@RequestMapping("selSt")
@ResponseBody
public Object selSt(Integer classid){
//System.out.println(classid);
List<StudentDB> studentDBS = selCourseManageService.selSt(classid);
// System.out.println(studentDBS);
return studentDBS;
}
@RequestMapping("selCo")
@ResponseBody
public Object selCo(){
//System.out.println(classid);
List<CourseDB> courseDBS = selCourseManageService.selCo();
url = uploadService.upload(file);
map.put("url", url);
map.put("name", file.getOriginalFilename());
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.failure(e.getMessage());
}
return ResponseEntity.success("操作成功").setAny("data",map);
}
}
学生管理控制层:
@Controller
public class StudentController extends BaseController {
@Autowired
private StudentService studentService;
// 跳转学生查询页面
@RequestMapping("/selectStudent")
public String selectStudent(){
return "view/student/selStudent";
}
// 查询所有学生
@RequestMapping("selStudent")
@ResponseBody
public LayuiResult<Map> selectStu(pageCount pageCount, StudentVO studentVO){
LayuiResult<Map> result = new LayuiResult<>();
int count = studentService.selCount(studentVO);
result.setData(list);
result.setCount(count);
return result;
}
// 查询所有专业
@RequestMapping("selDepartment")
@ResponseBody
public LayuiResult<Map> selDepartment(){
List<DepartmentDB> selDepartment = studentService.selDepartment();
LayuiResult result = new LayuiResult();
result.setData(selDepartment);
return result;
}
// 根据系部查询专业
@RequestMapping("selectdid")
@ResponseBody
public LayuiResult<Map> selMajorDB(Integer did){
modelMap.put("roleIds",roleIds);
modelMap.put("roleList",roleList);
return "admin/user/edit";
}
@RequiresPermissions("sys:user:edit")
@PostMapping("edit")
@ResponseBody
@SysLog("保存系统用户编辑数据")
public ResponseEntity edit(@RequestBody User user){
if(StringUtils.isBlank(user.getId())){
return ResponseEntity.failure("用户ID不能为空");
}
if(StringUtils.isBlank(user.getLoginName())){
return ResponseEntity.failure("登录名不能为空");
}
if(user.getRoleLists() == null || user.getRoleLists().size() == 0){
return ResponseEntity.failure("用户角色至少选择一个");
}
User oldUser = userService.findUserById(user.getId());
if(StringUtils.isNotBlank(user.getEmail())){
if(!user.getEmail().equals(oldUser.getEmail())){
if(file == null){
return ResponseEntity.failure("上传文件为空 ");
}
String url = null;
Map map = new HashMap();
try {
url = uploadService.upload(file);
map.put("url", url);
map.put("name", file.getOriginalFilename());
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.failure(e.getMessage());
}
return ResponseEntity.success("操作成功").setAny("data",map);
}
}
学生管理控制层:
return ResponseEntity.failure("登录名不能为空");
}
if(user.getRoleLists() == null || user.getRoleLists().size() == 0){
return ResponseEntity.failure("用户角色至少选择一个");
}
User oldUser = userService.findUserById(user.getId());
if(StringUtils.isNotBlank(user.getEmail())){
if(!user.getEmail().equals(oldUser.getEmail())){
if(userService.userCount(user.getEmail())>0){
return ResponseEntity.failure("该邮箱已被使用");
}
}
}
if(StringUtils.isNotBlank(user.getLoginName())){
if(!user.getLoginName().equals(oldUser.getLoginName())) {
if (userService.userCount(user.getLoginName()) > 0) {
return ResponseEntity.failure("该登录名已存在");
}
}
}
if(StringUtils.isNotBlank(user.getTel())){
if(!user.getTel().equals(oldUser.getTel())) {
if (userService.userCount(user.getTel()) > 0) {
return ResponseEntity.failure("该手机号已经被绑定");
}
}
}
Date date=format.parse(birthday);
studentDB.setSbirthday(date);
studentService.updateStudent(studentDB);
LayuiResult result= new LayuiResult();
//删除提示
result.setMsg("修改成功!");
return result;
}
}
课程管理控制层:
@Controller
public class SelCourseManController {
@Autowired
private SelCourseManageService selCourseManageService;
@RequestMapping("selCourses")
public String selCourses(){
System.out.println("----------------------");
return "SelCourseMan";
}
@RequestMapping("selSc")
@ResponseBody
public Object selSc(Integer page, Integer limit, StuCourseVO stuCourseVO){
System.out.println(stuCourseVO.getSname());
PageHelper.startPage(page, limit);
List<StuCourseVO> stuCourseVOS = selCourseManageService.selSc(stuCourseVO);
PageInfo pageInfo = new PageInfo(stuCourseVOS);
Map<String, Object> tableData = new HashMap<String, Object>();
//System.out.println(departmentDBS);
return departmentDBS;
}
@RequestMapping("selMa")
@ResponseBody
public Object selMa(Integer did){
//System.out.println(did);
List<MajorDB> majors = selCourseManageService.selMa(did);
//System.out.println(majors);
return majors;
}
@RequestMapping("selGr")
@ResponseBody
public Object selGr(Integer mid){
//System.out.println(mid);
List<GradeDB> gradeDBS = selCourseManageService.selGr(mid);
// System.out.println(gradeDBS);
return gradeDBS;
}
@RequestMapping("selCl")
@ResponseBody