欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Java畢業(yè)設計實戰(zhàn)之教室預訂管理系統(tǒng)的實現(xiàn)

 更新時間:2022年02月05日 13:33:16   作者:OldWinePot  
這是一個使用了java+SpringBoot+Maven+Vue+mysql開發(fā)的教室預訂管理系統(tǒng),是一個畢業(yè)設計的實戰(zhàn)練習,具有教室預訂管理該有的所有功能,感興趣的朋友快來看看吧

一、項目運行

環(huán)境配置:

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

項目技術(shù):

Spring + SpringBoot+ mybatis + Maven + 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 {
            //添加用戶對應的角色
            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());
        // 添加用戶對應的組關(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) {
            //保存學生組
            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 {
            //添加角色對應的權(quán)限
            roleService.addRolePermission(roleId,permissionIds);
            return ajaxResult;
        }catch (Exception e){
            e.printStackTrace();
            return new AjaxResult("保存權(quán)限失敗");
        }
 
    }
 
}

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

相關(guān)文章

  • java線程池ThreadPoolExecutor類使用小結(jié)

    java線程池ThreadPoolExecutor類使用小結(jié)

    這篇文章主要介紹了java線程池ThreadPoolExecutor類使用,本文主要對ThreadPoolExecutor的使用方法進行一個詳細的概述,示例代碼介紹了ThreadPoolExecutor的構(gòu)造函數(shù)的相關(guān)知識,感興趣的朋友一起看看吧
    2022-03-03
  • 分模塊構(gòu)建Maven工程的方法步驟

    分模塊構(gòu)建Maven工程的方法步驟

    這篇文章主要介紹了分模塊構(gòu)建Maven工程的方法步驟,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-10-10
  • IDEA類與方法注釋模板設置圖文教程(非常詳細)

    IDEA類與方法注釋模板設置圖文教程(非常詳細)

    IDEA自帶的注釋模板不是太好用,我本人到網(wǎng)上搜集了很多資料系統(tǒng)的整理了一下制作了一份比較完整的模板來分享給大家,下面這篇文章主要給大家介紹了關(guān)于IDEA類與方法注釋模板設置的相關(guān)資料,需要的朋友可以參考下
    2022-09-09
  • 詳解備忘錄模式及其在Java設計模式編程中的實現(xiàn)

    詳解備忘錄模式及其在Java設計模式編程中的實現(xiàn)

    這篇文章主要介紹了詳解備忘錄模式及其在Java設計模式編程中的實現(xiàn),備忘錄模式數(shù)據(jù)的存儲過程中應當注意淺拷貝和深拷貝的問題,需要的朋友可以參考下
    2016-04-04
  • 利用Java實現(xiàn)在PDF中添加工具提示

    利用Java實現(xiàn)在PDF中添加工具提示

    這篇文章主要介紹了如何通過Java在PDF中添加工具提示,文中的示例代碼講解詳細,對我們學習或工作有一定的參考價值,感興趣的可以學習一下
    2022-01-01
  • Java實現(xiàn)無損Word轉(zhuǎn)PDF的示例代碼

    Java實現(xiàn)無損Word轉(zhuǎn)PDF的示例代碼

    本文將利用Java中的兩個jar包:pdfbox和aspose-words實現(xiàn)無損Word轉(zhuǎn)PDF功能,文中的示例代碼講解詳細,感興趣的小伙伴可以動手嘗試一下
    2022-06-06
  • Java深入探究關(guān)鍵字abstract的使用

    Java深入探究關(guān)鍵字abstract的使用

    如果一個方法使用 abstract 來修飾,則說明該方法是抽象方法,抽象方法只有聲明沒有實現(xiàn)。需要注意的是 abstract 關(guān)鍵字只能用于普通方法,不能用于 static 方法或者構(gòu)造方法中
    2022-05-05
  • Springboot如何加載靜態(tài)圖片

    Springboot如何加載靜態(tài)圖片

    這篇文章主要介紹了Springboot如何加載靜態(tài)圖片,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • springboot集成與使用Sentinel的方法

    springboot集成與使用Sentinel的方法

    這篇文章主要介紹了springboot集成與使用Sentinel的方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-11-11
  • Java實現(xiàn)雪花算法(snowflake)

    Java實現(xiàn)雪花算法(snowflake)

    這篇文章主要介紹了Java實現(xiàn)雪花算法(snowflake),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-08-08

最新評論