基于javaweb+mysql的ssm+maven教务管理系统(java+ssm+jsp+layui+echarts+mysql)

基于javaweb+mysql的ssm+maven教务管理系统(java+ssm+jsp+layui+echarts+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM+Maven教务管理系统(java+ssm+jsp+layui+echarts+mysql)

项目介绍

随着中国教育体制的不断改革与完善,学校的学生教师管理员等对互联网的使用也越来越频繁。随着学生与教师数量的不断增多,教务管理的容量,安全性,便捷性显得尤为重要。传统的人工管理的劣势也慢慢显现出来,但是其中的一优点还需要继续采纳,所以传统的人工与计算机的结合成为了目前的主流。对此我开发了一套基于SSM框架的教务管理系统。 该系统采用的是Spring、SpringMVC、Mybatis、Shiro、LayUI、腾讯云。

该项目分为管理员、教师、学生三种角色。 主要实现了用户的登录注册,公告的浏览,选课操作,不同的管理员对不同信息的管理,教师对课程评分,教师结课等功能。该系统我在完成基础功能的前提下完成了上线。 关键词:教务;教务管理系统;云服务器;JAVA;SSM

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 8.0版本; 6.是否Maven项目:是;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis+Shiro 2. 前端:JSP+LayUI+Echarts+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录 管理员:admin 123456 学生:zhangsan 123456 教师:wangliu 123456

    @RequestMapping("/index")
    public String index() throws Exception{
        return "system/teacher/index";
    }

    @RequestMapping("/list")
    @ResponseBody
    public Map<String, Object> list(@RequestParam(defaultValue = "1") Integer page,
                                    @RequestParam(defaultValue = "10") Integer limit,
                                    EasTeacher easTeacher) throws Exception{
        Map<String, Object> map = new HashMap<>();

//        分页不能用待修改。。。

        Page<EasTeacher> pager = PageHelper.startPage(page,limit);
//        List<EasTeacher> list = easTeacherService.getList(easTeacher);
        List<EasTeacher> list = easTeacherService.findTeacherList(easTeacher);
//        System.out.println("获取信息总条数为:" + list.size());
//        for (EasTeacher e:list
//             ) {
//            System.out.println(e.getUser().getUsername());
//            System.out.println(e.getName());
//        }
        map.put("count",pager.getTotal());
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");

        return map;
    }

    @RequestMapping("/search")
    @ResponseBody
    public List<EasTeacher> search() throws Exception{
        return easTeacherService.getAll();
    }

}

     * @param page
     * @param limit
     * @param isAll
     * @param searchKey
     * @return
     */
    @RequestMapping(value="/choiceList")
    @ResponseBody
    public Map<String, Object> getCourseChoiceList(@RequestParam(defaultValue = "1") Integer page,
                                      @RequestParam(defaultValue = "10") Integer limit,
                                      @RequestParam(defaultValue="1") int isAll,
                                      @RequestParam(defaultValue="")String searchKey) throws Exception {
        Map<String, Object> map = new HashMap<>();

        EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
        String username = easUser.getUsername();
//        System.out.println("教师用户名为:"+username);
        EasStudent easStudent = easStudentService.getStudentByUsername(username);
        if (easStudent.getUsername() == null || easStudent.getUsername().equals("")){
            map.put("code",1);
            map.put("msg","目前还没有选课信息");
        }else{
            PageUtil pageUtil = new PageUtil(page,limit);
            int sId = easStudent.getId();
            int count = easCourseService.getTotalItemsCountBySid(isAll, searchKey, sId);

            List<EasCourse> list = easCourseService.getCourseListBySid(isAll, searchKey, sId,pageUtil);

            map.put("count",count);
            map.put("data",list);
            map.put("code",0);
            map.put("msg","");
        }

        return map;
    }

}

        PageUtil pageUtil = new  PageUtil(page,limit);
        List<EasBaseCourse> list = easBaseCourseService.getList(easBaseCourse,pageUtil);

        map.put("count",count);
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");

        return map;
    }

    @RequestMapping("/baseCourseAddForm")
    public String baseCourseAddForm() throws Exception {
        return "system/baseCourse/baseCourseAddForm";
    }

    @RequestMapping(value = "/addBaseCourse",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> addBaseCourse(EasBaseCourse easBaseCourse) throws Exception{
        Map<String,Object> map = new HashMap<>();

//        System.out.println("我是基本课程名称:"+easBaseCourse.getCoursename());
//        System.out.println("我是基本课程简介:"+easBaseCourse.getSynopsis());
        List<EasBaseCourse> list = easBaseCourseService.findBaseCourseName(easBaseCourse.getCoursename());

        if (list.size() != 0){
            map.put("msg","基本课程已存在");
            map.put("result",false);
        }else if(easBaseCourse.getCoursename().length() <= 0){
            map.put("msg","课程名称不能为空");
            map.put("result",false);
        }else{
            //课程为null也可以添加 待完善
            easBaseCourseService.addBaseCourse(easBaseCourse);
            map.put("msg","添加成功");
            map.put("result",true);
        }
        return map;
    }

    @RequestMapping("/batchDeleteBaseCourse")
    @ResponseBody
    @RequiresPermissions("basecourse:delete")
    public Map<String, Object> batchDeleteBaseCourse(Integer[] ids) throws Exception{
        Map<String,Object> map = new HashMap<String,Object>();
        easBaseCourseService.batchDeleteBaseCourse(ids);
        map.put("msg","删除成功");
        map.put("result",true);
        return map;
    }

    @RequestMapping(value = "/getBaseCourseView")
    @ResponseBody
//        System.out.println("页面输入的密码为:"+password);

        List<EasUser> list = easUserService.findUserName(username);
        if(list.size() > 0){
            map.put("code",1);
            map.put("msg","用户名已存在,请重新输入");
        }else if(password.length() <= 0 || password2.length() <= 0 || username.length() <= 0){
            map.put("code",1);
            map.put("msg","用户名密码不能为空,请重新输入");
        }else if(!password.equals(password2)){
            map.put("code",1);
            map.put("msg","两次输入密码不一致,请重新输入");
        }else if(!matches){
            map.put("code",1);
            map.put("msg","密码必须包含字母、数字且长度为6-20位");
        }else if(matches){
            //由密码和用户名组成MD5加密  用户名为盐值
//            Md5Hash Md5Hash = new Md5Hash(password, username);
//            System.out.println("我是MD5Hash"+Md5Hash);
            String algorithmName = "MD5";//加密算法
            Object source = password;//要加密的密码
            Object salt = username;//盐值,一般都是用户名或者userid,要保证唯一
            int hashIterations = 1;//加密次数

            SimpleHash simpleHash = new SimpleHash(algorithmName,source,salt,hashIterations);
//            System.out.println("我是SimpleHash:"+simpleHash);

            EasUser easUser = new EasUser();
            easUser.setUsername(username);
            easUser.setPassword(simpleHash.toString());
            easUser.setSalt(username);
            easUser.setLocked("0");

            easUserService.addUser(easUser);

            map.put("code",0);
        }else{
            map.put("code",1);
            map.put("msg","注册失败,请联系管理员邮箱1260298750@qq.com!!!");
        }

        return map;
    }

}

//            //type = 1 全员可见 type = 2 教师可见  type = 3 草稿  管理员可见
//            int type = 1;
//            int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
//            pageUtil.setTotal(count);
//            pageUtil.setCount(limit);
//            int totalPage = pageUtil.getTotalPage();
            System.out.println("总页数为"+totalPage);
//
//            List<EasNotice> list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
//            map.put("totalPage",totalPage);
//            map.put("count",count);
//            map.put("data",list);
//            map.put("code",0);
//            map.put("msg","");
//        }else if(roleId == 3){//增加教师公告可见
//            int type = 2;
//            int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
//            List<EasNotice> list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//            pageUtil.setTotal(count);
//            pageUtil.setCount(limit);
//            int totalPage = pageUtil.getTotalPage();
            System.out.println("总页数为"+totalPage);
//
//            map.put("totalPage",totalPage);
//            map.put("count",count);
//            map.put("data",list);
//            map.put("code",0);
//            map.put("msg","");
//        }else{//管理员可见全部
//            int type = 3;
//            int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
//            List<EasNotice> list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
//            pageUtil.setTotal(count);
//            pageUtil.setCount(limit);
//            int totalPage = pageUtil.getTotalPage();
//
//            map.put("totalPage",totalPage);
//
//            map.put("count",count);
//            map.put("data",list);
//            map.put("code",0);
//            map.put("msg","");
//        }
//
        return "system/baseCourse/baseCourseAddForm";
    }

    @RequestMapping(value = "/addBaseCourse",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> addBaseCourse(EasBaseCourse easBaseCourse) throws Exception{
        Map<String,Object> map = new HashMap<>();

//        System.out.println("我是基本课程名称:"+easBaseCourse.getCoursename());
//        System.out.println("我是基本课程简介:"+easBaseCourse.getSynopsis());
        List<EasBaseCourse> list = easBaseCourseService.findBaseCourseName(easBaseCourse.getCoursename());

        if (list.size() != 0){
            map.put("msg","基本课程已存在");
            map.put("result",false);
        }else if(easBaseCourse.getCoursename().length() <= 0){
            map.put("msg","课程名称不能为空");
            map.put("result",false);
        }else{
            //课程为null也可以添加 待完善
            easBaseCourseService.addBaseCourse(easBaseCourse);
            map.put("msg","添加成功");
            map.put("result",true);
        }
        return map;
    }

    @RequestMapping("/batchDeleteBaseCourse")
    @ResponseBody
    @RequiresPermissions("basecourse:delete")
    public Map<String, Object> batchDeleteBaseCourse(Integer[] ids) throws Exception{
        Map<String,Object> map = new HashMap<String,Object>();
        easBaseCourseService.batchDeleteBaseCourse(ids);
        map.put("msg","删除成功");
        map.put("result",true);
        return map;
    }

    @RequestMapping(value = "/getBaseCourseView")
    @ResponseBody
    public EasBaseCourse getBaseCourseView(Integer id) throws Exception {
        return easBaseCourseService.getBaseCourseView(id);
    }
@RequestMapping("/easLogin")
public class EasLoginController {
    @Autowired
    private EasPermissionMapper easPermissionMapper;

    @RequestMapping("/main")
    public String main() throws Exception{
        return "main";
    }
//    @RequestMapping("/home")
//    public String home() throws Exception{
//        return "system/home/homePage";
//    }

    @RequestMapping("/success")
    @ResponseBody
    public Map<String,Object> success(HttpSession session) throws Exception{
        Map<String,Object> map = new HashMap<>();
        map.put("code",0);
        EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();
        session.setAttribute(Constants.LOGIN_USER,easUser);

        List<EasPermission> list = easPermissionMapper.getPersByUserId(easUser.getId());
        session.setAttribute(Constants.LOGIN_USER_PERS,list);

        return map;
    }

    @RequestMapping(value = "/login",method = RequestMethod.GET)
    public String login() throws Exception{
        return "login";
    }

    /**
     * post方式的login方式什么时候调用?
     * 身份认证失败的时候会自动调用
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    @ResponseBody
    public Map<String,Object> login(HttpServletRequest request) throws Exception{
        Map<String,Object> map = new HashMap<>();
//        System.out.println("认证失败了吧!来我这了吧");
        String exceptionName = request.getAttribute("shiroLoginFailure").toString();

        if (exceptionName.equals(UnknownAccountException.class.getName())){
            map.put("code",1);
            map.put("msg","用户名不正确");
            map.put("msg","批量评分失败,请联系管理员!");
        }

        return map;
    }

    @RequestMapping("/myScore")
    @ResponseBody
    public Map<String, Object> myScore(@RequestParam(defaultValue = "1") Integer page,
                                       @RequestParam(defaultValue = "10") Integer limit,
                                        Integer result) throws Exception {
        Map<String, Object> map = new HashMap<>();

        EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
        String username = easUser.getUsername();
        EasStudent easStudent = easStudentService.getStudentByUsername(username);

        PageUtil pageUtil = new PageUtil(page,limit);
        int sId = easStudent.getId();
        int count = easScoreService.getTotalItemsCount(sId,result);

        List<EasCourse> list = easScoreService.getCourseListBySid(sId,result,pageUtil);

        map.put("count",count);
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");

        return map;
    }

}

    }

}

/**
 */
@Controller
@RequestMapping("/easTeacher")
public class EasTeacherController {
    @Autowired
    private EasTeacherService easTeacherService;

    @RequestMapping("/index")
    public String index() throws Exception{
        return "system/teacher/index";
    }

    @RequestMapping("/list")
    @ResponseBody
    public Map<String, Object> list(@RequestParam(defaultValue = "1") Integer page,
                                    @RequestParam(defaultValue = "10") Integer limit,
                                    EasTeacher easTeacher) throws Exception{
        Map<String, Object> map = new HashMap<>();

//        分页不能用待修改。。。

        Page<EasTeacher> pager = PageHelper.startPage(page,limit);
    public String peopleEchart(){
        return "echarts/peopleEcharts";
    }

    @RequestMapping("/getAllStuAndTea")
    @ResponseBody
    public Map<String,Object> getAllStuAndTea(){
        Map<String, Object> map = new HashMap<>();

        int totalStu = easStudentService.getTotal();
        int totalTea = easTeacherService.getTotal();

//        System.out.println("教师总行数---->"+totalTea);

        map.put("totalStu",totalStu);
        map.put("totalTea",totalTea);
        map.put("code",0);
        map.put("msg","我是返回的内容");

        return map;
    }

    @RequestMapping("/getAllSex")
    @ResponseBody
    public Map<String,Object> getAllSex(){
        Map<String, Object> map = new HashMap<>();

        int totalMan = easStudentService.getTotalSex("男");
        int totalWoman = easStudentService.getTotalSex("女");
        map.put("totalMan",totalMan);
        map.put("totalWoman",totalWoman);
        map.put("code",0);
        map.put("msg","我是返回的内容");

        return map;
    }

    @RequestMapping("/getAllClassScore")
    @ResponseBody
    public Map<String,Object> getAllClassScore(Integer baseCourseId) throws Exception {
        Map<String, Object> map = new HashMap<>();
//        System.out.println("基础课程id为:"+baseCourseId);

        //根据基本课程id 和是否结束 来获取每门课程 合格条数 和不合格条数
        EasBaseCourse easBaseCourse = easBaseCourseService.getBaseCourseById(baseCourseId);
        String coursename = easBaseCourse.getCoursename();
    }

    @RequestMapping("/courseAddForm")
    public String courseAddForm() throws Exception{
        return "system/course/courseAddForm";
    }

    @RequestMapping("/courseEditForm")
    public String courseEditForm() throws Exception{
        return "system/course/courseEditForm";
    }

    @RequestMapping("/getCourseList")
    @ResponseBody
    public Map<String,Object> getCourseList(@RequestParam(defaultValue = "1") Integer page,
                                            @RequestParam(defaultValue = "10") Integer limit,
                                            EasCourse easCourse) throws Exception{
        Map<String,Object> map = new HashMap<>();
        int count = easCourseService.getCount();
//        System.out.println("总行数:"+count);
        PageUtil pageUtil = new  PageUtil(page,limit);
        List<EasCourse> list = easCourseService.getList(easCourse,pageUtil);

        map.put("count",count);
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");

        return map;
    }

    @RequestMapping("/baseCourseAddForm")
    public String baseCourseAddForm() throws Exception {
        return "system/baseCourse/baseCourseAddForm";
    }

    @RequestMapping(value = "/addCourse",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> addCourse(EasCourse easCourse) throws Exception{
        Map<String,Object> map = new HashMap<>();

//        System.out.println("课程id:"+easCourse.getBaseCourseId());
//        System.out.println("教师id:"+easCourse.gettId());

        int res = 0;
        //查询是否有课程对应老师
        List<EasCourse> list = easCourseService.findCourseByBaseCourseIdAndTeacherId(easCourse.getBaseCourseId(),easCourse.gettId());
        EasTeacher easTeacher = easTeacherService.findTeacherByUsername(username);

        //获取行数
        int count = easStudentService.getEndingCountBytIdandcId(easTeacher.getId(),baseCourseId,classId);
        PageUtil pageUtil = new  PageUtil(page,limit);

        List<EasStudent> list = easStudentService.getStudentScoreListByTid(easTeacher.getId(),baseCourseId,classId,pageUtil);

        map.put("count",count);
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");

        return map;
    }

    /**
     * 获取我的学生选课信息
     * @param page
     * @param limit
     * @param baseCourseId
     * @param classId
     * @return
     * @throws Exception
     */
    @RequestMapping("/stuSelectCourseList")
    @ResponseBody
    public Map<String, Object> stuSelectCourseList(@RequestParam(defaultValue = "1") Integer page,
                                            @RequestParam(defaultValue = "10") Integer limit,
                                            @RequestParam(required=false) Integer baseCourseId,
                                            @RequestParam(required=false) Integer classId) throws Exception {
        //    @requestparam(required = false)不传值后台也不会报错

        Map<String, Object> map = new HashMap<>();
        //获取当前教师id
        EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
        String username = easUser.getUsername();
        EasTeacher easTeacher = easTeacherService.findTeacherByUsername(username);

        //获取行数
        int count = easStudentService.getCountBytIdandcId(easTeacher.getId(),baseCourseId,classId);
        map.put("result",true);
        return map;
    }

    @RequestMapping(value = "/getBaseCourseView")
    @ResponseBody
    public EasBaseCourse getBaseCourseView(Integer id) throws Exception {
        return easBaseCourseService.getBaseCourseView(id);
    }

    @RequestMapping(value = "/editBaseCourse",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> editBaseCourse(EasBaseCourse easBaseCourse) throws Exception{
        Map<String, Object> map = new HashMap<>();

        easBaseCourseService.updateBaseCourse(easBaseCourse);

        map.put("result",true);
        return map;
    }

    @RequestMapping("/search")
    @ResponseBody
    public List<EasBaseCourse> search() throws Exception{
        return easBaseCourseService.getAll();
    }

}

//
//        String strRoleId =roleId +"";
        System.out.println("roleId:"+roleId);
        System.out.println("strRoleId:"+strRoleId);
//        PageUtil pageUtil = new  PageUtil(page,limit);
//
//        //没有角色
//        if(roleId == null || !(strRoleId.length() >0 || roleId == 2)){//全体可见的部分公告,没要求
//            //type = 1 全员可见 type = 2 教师可见  type = 3 草稿  管理员可见
//            int type = 1;
//            int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
//            pageUtil.setTotal(count);
//            pageUtil.setCount(limit);
//            int totalPage = pageUtil.getTotalPage();
            System.out.println("总页数为"+totalPage);
//
//            List<EasNotice> list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
//            map.put("totalPage",totalPage);
//            map.put("count",count);
//            map.put("data",list);
//            map.put("code",0);
//            map.put("msg","");
//        }else if(roleId == 3){//增加教师公告可见
//            int type = 2;
//            int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
//            List<EasNotice> list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//            pageUtil.setTotal(count);
//            pageUtil.setCount(limit);
//            int totalPage = pageUtil.getTotalPage();
            System.out.println("总页数为"+totalPage);
//
//            map.put("totalPage",totalPage);
//            map.put("count",count);
//            map.put("data",list);
//            map.put("code",0);
//            map.put("msg","");
//        }else{//管理员可见全部
//            int type = 3;
//            int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
//            List<EasNotice> list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
//            pageUtil.setTotal(count);
//            pageUtil.setCount(limit);
//            int totalPage = pageUtil.getTotalPage();
//
//            map.put("totalPage",totalPage);
//
//            map.put("count",count);
//            map.put("data",list);
//            map.put("code",0);
//            map.put("msg","");
//        }
//

/**
 */
@RequestMapping("/easScore")
@Controller
public class EasScoreController {
    @Autowired
    private EasScoreService easScoreService;
    @Autowired
    private EasStudentService easStudentService;
    @Autowired
    private EasTeacherService easTeacherService;

    //教师查看选我课的学生成绩列表 进行打分
    @RequestMapping("/scoreIndex")
    public String scoreIndex() throws Exception {
        return "system/score/studentScoreIndex";
    }

    //学生查看我的成绩页面
    @RequestMapping("/myScoreIndex")
    public String myScoreIndex() throws Exception {
        return "system/score/myScoreIndex";
        List<EasClass> list = easClassService.getList(easClass,pageUtil);

        map.put("count",count);
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");

        return map;
    }

    @RequestMapping("/classForm")
    public String classForm() throws Exception {
        return "system/class/classForm";
    }

    @RequestMapping(value = "/addClass",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> addClass(EasClass easClass) throws Exception{
        Map<String,Object> map = new HashMap<>();

//        System.out.println("我是基本课程名称:"+easBaseCourse.getCoursename());
//        System.out.println("我是基本课程简介:"+easBaseCourse.getSynopsis());
        List<EasClass> list = easClassService.findClassName(easClass.getClasses());

        if (list.size() != 0){
            map.put("msg","班级已存在");
            map.put("result",false);
        }else if(easClass.getClasses().length() <= 0){
            map.put("msg","班级不能为空");
            map.put("result",false);
        }else{
            //课程为null也可以添加 待完善
            easClassService.addClass(easClass);
            map.put("msg","添加成功");
            map.put("result",true);
        }
        return map;
    }

    @RequestMapping("/batchDeleteClass")
    public Map<String, Object> batchDeleteCourse(Integer[] ids) throws Exception{
        Map<String,Object> map = new HashMap<String,Object>();
        try{
            easCourseService.batchDeleteCourse(ids);
            map.put("msg","删除成功");
            map.put("result",true);
        }catch (Exception e){
            e.printStackTrace();
            map.put("result",false);
        }

        return map;
    }

    /**
     * 返回教师自己教的课程列表
     */
    @ResponseBody
    @RequestMapping(value="/getMyCourseList")
    public Map<String, Object> getMyCourseList(@RequestParam(defaultValue = "1") Integer page,
                                               @RequestParam(defaultValue = "10") Integer limit) {
        Map<String,Object> map = new HashMap<>();
        //获取用户信息
        EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
        String username = easUser.getUsername();
//        System.out.println("教师用户名为:"+username);
        EasTeacher easTeacher = easTeacherService.findTeacherByUsername(username);
        if (easTeacher.getUsername() == null || easTeacher.getUsername().equals("")){
            map.put("code",1);
            map.put("msg","您还没有教授课程");
        }else{
//            System.out.println("教师id为:"+easTeacher.getId());
            int count = easCourseService.getCountBytId(easTeacher.getId());

            PageUtil pageUtil = new  PageUtil(page,limit);
            List<EasCourse> list = easCourseService.getCourseListBytId(easTeacher.getId(),pageUtil);

            map.put("count",count);
            map.put("data",list);
            map.put("code",0);
            map.put("msg","");
        }

        return map;
    }

//                if(list2.size() > 0){
//                    easTeacherService.deleteTeacher(user.getUsername());
//                }
//                easStudentService.addUsername(user.getUsername());
//            }
//        }else if(roleid == 3){
//            if(list2.size() == 0){
//                if(list1.size() > 0){
//                    easStudentService.deleteStudent(user.getUsername());
//                }
//                easTeacherService.addUsername(user.getUsername());
//            }
//        }

        map.put("result",true);
        return map;
    }

    @RequestMapping("/passwordRestIndex")
    public String passwordRestIndex(){
        return "system/user/changePwd";
    }

    @RequestMapping(value = "/passwordRest",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> passwordRest(HttpServletRequest request) throws Exception {
        Map<String, Object> map = new HashMap<>();

        //获取页面输入的新旧密码
        String oldPassword = request.getParameter("oldPassword");
        String newPassword1 = request.getParameter("newPassword1");
        String newPassword2 = request.getParameter("newPassword2");

        String regex = "^(?!([a-zA-Z]+|\\d+)$)[a-zA-Z\\d]{6,20}$";

        boolean matches = newPassword1.matches(regex);

        //获取用户信息
        EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值