最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Java畢業(yè)設(shè)計實戰(zhàn)之學(xué)生管理系統(tǒng)的實現(xiàn)

 更新時間:2022年03月16日 14:13:42   作者:qq_1334611189  
只學(xué)書上的理論是遠遠不夠的,只有在實戰(zhàn)中才能獲得能力的提升,本篇文章手把手帶你用java+Springboot+Maven+mybatis+Vue+Mysql實現(xiàn)學(xué)生管理系統(tǒng),大家可以在過程中查缺補漏,提升水平

一、項目簡述

本系統(tǒng)功能包括: 學(xué)生管理,教師管理,課程管理,成績管理,系統(tǒng)管理等等。

二、項目運行

環(huán)境配置:

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

項目技術(shù):

Springboot + Maven + mybatis+ Vue 等等組成,B/S模式 + Maven管理等等。

用戶管理控制器:

/**
 * 用戶管理控制器
 */
@RequestMapping("/user/")
@Controller
public class UserController {
    @Autowired
    private IUserService userService;
    @Autowired
    private IRoleService roleService;
 
    @Resource
    private ProcessEngineConfiguration configuration;
    @Resource
    private ProcessEngine engine;
 
    @GetMapping("/index")
    @ApiOperation("跳轉(zhuǎn)用戶頁接口")
    @PreAuthorize("hasRole('管理員')")
    public String index(String menuid,Model model){
        List<Role> roles = queryAllRole();
        model.addAttribute("roles",roles);
        model.addAttribute("menuid",menuid);
        //用戶首頁
        return "views/user/user_list";
    }
 
    @GetMapping("/listpage")
    @ApiOperation("查詢用戶分頁數(shù)據(jù)接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "UserQuery", value = "用戶查詢對象", defaultValue = "userQuery對象")
    })
    @ResponseBody
    @PreAuthorize("hasRole('管理員')")
    public PageList listpage(UserQuery userQuery){
        return  userService.listpage(userQuery);
    }
 
    //添加用戶
    @PostMapping("/addUser")
    @ApiOperation("添加用戶接口")
    @ResponseBody
    public Map<String,Object> addUser(User user){
        Map<String, Object> ret = new HashMap<>();
        ret.put("code",-1);
        if(StringUtils.isEmpty(user.getUsername())){
            ret.put("msg","請?zhí)顚懹脩裘?);
            return ret;
        }
        if(StringUtils.isEmpty(user.getPassword())){
            ret.put("msg","請?zhí)顚懨艽a");
            return ret;
        }
        if(StringUtils.isEmpty(user.getEmail())){
            ret.put("msg","請?zhí)顚戉]箱");
            return ret;
        }
        if(StringUtils.isEmpty(user.getTel())){
            ret.put("msg","請?zhí)顚懯謾C號");
            return ret;
        }
        if(StringUtils.isEmpty(user.getHeadImg())){
            ret.put("msg","請上傳頭像");
            return ret;
        }
        if(userService.addUser(user)<=0) {
            ret.put("msg", "添加用戶失敗");
            return ret;
        }
        ret.put("code",0);
        ret.put("msg","添加用戶成功");
        return ret;
    }
 
    /**
     * 修改用戶信息操作
     * @param user
     * @return
     */
    @PostMapping("/editSaveUser")
    @ApiOperation("修改用戶接口")
    @PreAuthorize("hasRole('管理員')")
    @ResponseBody
    public Message editSaveUser(User user){
        if(StringUtils.isEmpty(user.getUsername())){
          return Message.error("請?zhí)顚懹脩裘?);
        }
        if(StringUtils.isEmpty(user.getEmail())){
            return Message.error("請?zhí)顚戉]箱");
        }
        if(StringUtils.isEmpty(user.getTel())){
            return Message.error("請?zhí)顚懯謾C號");
        }
        try {
            userService.editSaveUser(user);
            return Message.success();
        } catch (Exception e) {
            e.printStackTrace();
            return Message.error("修改用戶信息失敗");
        }
 
    }
 
    //添加用戶
    @GetMapping("/deleteUser")
    @ApiOperation("刪除用戶接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "如:88",required = true)
    })
    @PreAuthorize("hasRole('管理員')")
    @ResponseBody
    public AjaxResult deleteUser(@RequestParam(required = true) Long id){
        AjaxResult ajaxResult = new AjaxResult();
        try {
            userService.deleteUser(id);
        } catch (Exception e) {
            e.printStackTrace();
            return new AjaxResult("刪除失敗");
        }
 
        return ajaxResult;
    }
 
    @PostMapping(value="/deleteBatchUser")
    @ApiOperation("批量刪除用戶接口")
    @PreAuthorize("hasRole('管理員')")
    @ResponseBody
    public AjaxResult deleteBatchUser(String ids){
        String[] idsArr = ids.split(",");
        List list = new ArrayList();
        for(int i=0;i<idsArr.length;i++){
            list.add(idsArr[i]);
        }
        try{
            userService.batchRemove(list);
            return new AjaxResult();
        }catch(Exception e){
           return new AjaxResult("批量刪除失敗");
        }
    }
 
    //查詢所有角色
    public List<Role> queryAllRole(){
        return roleService.queryAll();
    }
 
    //添加用戶的角色
    @PostMapping("/addUserRole")
    @ApiOperation("添加用戶角色接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "paramMap", value = "如:{userId:1,[1,2,3,4]]}")
    })
    @ResponseBody
    public AjaxResult addUserRole(@RequestBody Map paramMap){
        AjaxResult ajaxResult = new AjaxResult();
        String userId = (String)paramMap.get("userId");
        List roleIds = (List) paramMap.get("roleIds");
        try {
            //添加用戶對應(yīng)的角色
            roleService.addUserRole(userId,roleIds);
            return ajaxResult;
        }catch (Exception e){
            e.printStackTrace();
            return new AjaxResult("保存角色失敗");
        }
 
    }
 
 
 
 
    //添加用戶
    @RequestMapping("/regSaveUser")
    @ResponseBody
    public Long addTeacher(User user){
        System.out.println("保存用戶...."+user);
        userService.addUser(user);
 
        //保存工作流程操作
        IdentityService is = engine.getIdentityService();
        // 添加用戶組
        org.activiti.engine.identity.User userInfo = userService.saveUser(is, user.getUsername());
        // 添加用戶對應(yīng)的組關(guān)系
        Group stuGroup = new GroupEntityImpl();
        stuGroup.setId("stuGroup");
        Group tGroup = new GroupEntityImpl();
        tGroup.setId("tGroup");
        if(user.getType() == 2) {
            //保存老師組
            userService.saveRel(is, userInfo, tGroup);
        }
        if(user.getType() == 3) {
            //保存學(xué)生組
            userService.saveRel(is, userInfo, stuGroup);
        }
 
        Long userId = user.getId();
        return userId;
    }
 
    /**
     * 修改密碼頁面
     * @return
     */
    @RequestMapping(value="/update_pwd",method=RequestMethod.GET)
    public String updatePwd(){
        return "views/user/update_pwd";
    }
 
    /**
     * 修改密碼操作
     * @param oldPwd
     * @param newPwd
     * @return
     */
    @ResponseBody
    @PostMapping("/update_pwd")
    public Message updatePassword(@RequestParam(name="oldPwd",required=true)String oldPwd,
                                  @RequestParam(name="newPwd",required=true)String newPwd){
        String username = CommonUtils.getLoginUser().getUsername();
        User userByUserName = userService.findUserByUserName(username);
        if(userByUserName!=null){
            String password = userByUserName.getPassword();
            BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
            boolean matches = bCryptPasswordEncoder.matches(oldPwd, password);
            if(!matches){
                return Message.error("舊密碼不正確");//true
            }
            userByUserName.setPassword(bCryptPasswordEncoder.encode(newPwd));
 
            if(userService.editUserPassword(userByUserName)<=0){
                return Message.error("密碼修改失敗");
            }
        }
        return Message.success();
    }
 
    /**
     * 清除緩存
     * @param request
     * @param response
     * @return
     */
    @ResponseBody
    @PostMapping("/clear_cache")
    public Message clearCache(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setHeader("Cache-Control","no-store");
        response.setHeader("Pragrma","no-cache");
        response.setDateHeader("Expires",0);
      return  Message.success();
    }
}

角色控制層:

@Controller
public class RoleController {
 
    @Autowired
    private IRoleService roleService;
 
    @Autowired
    private IPermissionService permissionService;
 
 
 
 
    @PreAuthorize("hasRole('管理員')")
    @ResponseBody
    @RequestMapping("/role/doAdd")
    public String doAdd(Role role){
        //角色添加
        return "ok";
    }
    //添加角色
    @RequestMapping("/role/addRole")
    @PreAuthorize("hasRole('管理員')")
    @ResponseBody
    public AjaxResult addRole(Role role){
        System.out.println("保存角色...."+role);
        try {
            roleService.saveRole(role);
            return new AjaxResult();
        } catch (Exception e) {
            e.printStackTrace();
            return new AjaxResult("操作失敗");
        }
    }
 
    @PreAuthorize("hasRole('管理員')")
    @RequestMapping("/role/index")
    public String index(Model model){
        List<Permission> permisisons = permissionService.findAllPermisisons();
        model.addAttribute("permissions",permisisons);
        //返回角色
        return "views/role/role_list";
    }
 
    @RequestMapping("/role/listpage")
    @ResponseBody
    public PageList listpage(RoleQuery roleQuery){
        System.out.println("傳遞參數(shù):"+roleQuery);
        return  roleService.listpage(roleQuery);
    }
 
 
    //修改用戶editSaveUser
    @RequestMapping("/role/editSaveRole")
    @ResponseBody
    public AjaxResult editSaveRole(Role role){
        System.out.println("修改角色...."+role);
        try {
            roleService.editSaveRole(role);
            return new AjaxResult();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new AjaxResult("修改失敗");
    }
 
    //添加角色
    @RequestMapping("/role/deleteRole")
    @ResponseBody
    public AjaxResult deleteRole(Long id){
        System.out.println("刪除角色...."+id);
        AjaxResult ajaxResult = new AjaxResult();
        try {
            roleService.deleteRole(id);
        } catch (Exception e) {
            e.printStackTrace();
            return new AjaxResult("刪除失敗");
        }
        return ajaxResult;
    }
 
    //添加角色權(quán)限 addRolePermission
    @RequestMapping("/role/addRolePermission")
    @ResponseBody
    public AjaxResult addRolePermission(@RequestBody Map paramMap){
        AjaxResult ajaxResult = new AjaxResult();
        String roleId = (String)paramMap.get("roleId");
        List permissionIds = (List) paramMap.get("permissionIds");
        try {
            //添加角色對應(yīng)的權(quán)限
            roleService.addRolePermission(roleId,permissionIds);
            return ajaxResult;
        }catch (Exception e){
            e.printStackTrace();
            return new AjaxResult("保存權(quán)限失敗");
        }
 
    }
 
}

權(quán)限維護Controller:

/**
 *  權(quán)限維護Controller
 */
@RequestMapping("/permission")
@Controller
public class PermissionController {
 
    @Autowired
    private IPermissionService permissionService;
 
    @PreAuthorize("hasRole('管理員')")
    @RequestMapping("/index")
    public String index(Model model){
        List<Permission> allPermisisons = permissionService.findAllPermisisons();
        model.addAttribute("permissions",allPermisisons);
        //返回菜單頁面
        return "views/permission/permission_list";
    }
 
    //添加頂級菜單 addTopMenu
    @PreAuthorize("hasRole('管理員')")
    @RequestMapping("/addBtnPermisison")
    @ResponseBody
    public AjaxResult addBtnPermission(@RequestBody Permission permission){
        AjaxResult ajaxResult = new AjaxResult();
        try{
            //{name:xxx,pid:xxx,title:xxx}
            permissionService.addBtnPermisison(permission);
            return ajaxResult;
        }catch(Exception e){
            e.printStackTrace();
            return new AjaxResult("保存失敗");
        }
    }
 
    /**
     * 編輯數(shù)據(jù)操作
     * @param id
     * @return
     */
    @PreAuthorize("hasRole('管理員')")
    @GetMapping("/editPermission")
    @ResponseBody
    public Map<String,Object> editPermission(@RequestParam("id")Long id){
        Map<String, Object> ret = new HashMap<>();
        ret.put("code","-1");
        Permission byId = permissionService.findById(id);
        if(byId==null){
            ret.put("msg","未找到該權(quán)限");
            return ret;
        }
        ret.put("code",0);
        ret.put("data",byId);
        return ret;
    }
 
 
    /**
     * 編輯權(quán)限數(shù)據(jù)操作
     * @param permission
     * @return
     */
    @PreAuthorize("hasRole('管理員')")
    @PostMapping("/editPermission")
    @ResponseBody
    public Map<String,Object> editPermission(Permission permission){
        Map<String, Object> ret = new HashMap<>();
        ret.put("code","-1");
        if(StringUtils.isEmpty(permission.getName())){
            ret.put("msg","請?zhí)顚憴?quán)限值");
            return ret;
        }
        if(StringUtils.isEmpty(permission.getTitle())){
            ret.put("msg","請?zhí)顚憴?quán)限名稱");
            return ret;
        }
        if(permissionService.edit(permission)<=0){
            ret.put("msg","權(quán)限編輯失敗");
            return ret;
        }
        ret.put("code",0);
        return ret;
    }
 
    /**
     * 根據(jù)id刪除權(quán)限
     * @param id
     * @return
     */
    @PreAuthorize("hasRole('管理員')")
    @ResponseBody
    @PostMapping("/deletePermission")
    public Map<String,Object> deletePermission(@RequestParam("id")Long id){
        Map<String, Object> ret = new HashMap<>();
        ret.put("code","-1");
        try{
            permissionService.deleteById(id);
        }catch (Exception e){
            ret.put("msg","刪除失敗,存在關(guān)聯(lián)數(shù)據(jù)");
            return ret;
        }
        ret.put("code",0);
        return ret;
    }
}

到此這篇關(guān)于Java畢業(yè)設(shè)計實戰(zhàn)之學(xué)生管理系統(tǒng)的實現(xiàn)的文章就介紹到這了,更多相關(guān)Java 學(xué)生管理系統(tǒng)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • HDFS-Hadoop NameNode高可用機制

    HDFS-Hadoop NameNode高可用機制

    本文詳細介紹了Hadoop NameNode高可用機制的各個方面內(nèi)容,NameNode 的可用性直接決定了 Hadoop 集群的可用性,感興趣的小伙伴可以參考本文章
    2021-08-08
  • Java 高并發(fā)六:JDK并發(fā)包2詳解

    Java 高并發(fā)六:JDK并發(fā)包2詳解

    本文主要介紹Java高并發(fā)這里整理了詳細資料,并講解了 1. 線程池的基本使用 2. 擴展和增強線程池 3. ForkJoin的知識,有興趣的小伙伴可以參考下
    2016-09-09
  • Java設(shè)計模式之單例模式Singleton Pattern詳解

    Java設(shè)計模式之單例模式Singleton Pattern詳解

    這篇文章主要介紹了Java設(shè)計模式之單例模式Singleton Pattern詳解,一些常用的工具類、線程池、緩存,數(shù)據(jù)庫,數(shù)據(jù)庫連接池、賬戶登錄系統(tǒng)、配置文件等程序中可能只允許我們創(chuàng)建一個對象,這就需要單例模式,需要的朋友可以參考下
    2023-12-12
  • Java的字節(jié)緩沖流與字符緩沖流解析

    Java的字節(jié)緩沖流與字符緩沖流解析

    這篇文章主要介紹了Java的字節(jié)緩沖流與字符緩沖流解析,Java 緩沖流是Java I/O庫中的一種流,用于提高讀寫數(shù)據(jù)的效率,它通過在內(nèi)存中創(chuàng)建緩沖區(qū)來減少與底層設(shè)備的直接交互次數(shù),從而減少了I/O操作的開銷,需要的朋友可以參考下
    2023-11-11
  • Springboot整合nacos報錯無法連接nacos的解決

    Springboot整合nacos報錯無法連接nacos的解決

    這篇文章主要介紹了Springboot整合nacos報錯無法連接nacos的解決方案,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-06-06
  • springboot使用事物注解方式代碼實例

    springboot使用事物注解方式代碼實例

    這篇文章主要介紹了springboot使用事物注解方式代碼實例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友可以參考下
    2019-11-11
  • java動態(tài)規(guī)劃算法——硬幣找零問題實例分析

    java動態(tài)規(guī)劃算法——硬幣找零問題實例分析

    這篇文章主要介紹了java動態(tài)規(guī)劃算法——硬幣找零問題,結(jié)合實例形式分析了java動態(tài)規(guī)劃算法——硬幣找零問題相關(guān)原理、實現(xiàn)方法與操作注意事項,需要的朋友可以參考下
    2020-05-05
  • 深入淺析jcmd:JDK14中的調(diào)試神器

    深入淺析jcmd:JDK14中的調(diào)試神器

    這篇文章主要介紹了jcmd:JDK14中的調(diào)試神器,本文給大家提到了jcmd的語法,通過實例列舉的非常詳細,對大家的學(xué)習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-04-04
  • Java+Nginx實現(xiàn)POP、IMAP、SMTP郵箱代理服務(wù)

    Java+Nginx實現(xiàn)POP、IMAP、SMTP郵箱代理服務(wù)

    本篇文章的內(nèi)容是介紹Java+Nginx如何實現(xiàn)POP、IMAP、SMTP郵箱代理服務(wù),步驟詳細,思路清新,需要的朋友可以參考下
    2015-07-07
  • idea創(chuàng)建springboot項目和springcloud項目的詳細教程

    idea創(chuàng)建springboot項目和springcloud項目的詳細教程

    這篇文章主要介紹了idea創(chuàng)建springboot項目和springcloud項目方法,本文通過圖文并茂的形式給大家介紹的非常詳細,對大家的學(xué)習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-10-10

最新評論

宁国市| 新建县| 吴江市| 革吉县| 鱼台县| 葫芦岛市| 商丘市| 隆子县| 延庆县| 治多县| 凤庆县| 隆安县| 耒阳市| 彭泽县| 永安市| 大埔区| 巴青县| 韶关市| 砀山县| 康平县| 紫阳县| 新乐市| 双柏县| 浦北县| 莒南县| 游戏| 山丹县| 屯昌县| 乌海市| 错那县| 化德县| 桐梓县| 建瓯市| 青海省| 岚皋县| 东光县| 德庆县| 辽宁省| 南乐县| 武宣县| 元谋县|