Java项目:宿舍管理系统(java+jsp+SSM+Spring+mysql)
源码获取:博客首页 "资源" 里下载!
一、项目简述
功能:包括学生管理,班级管理,宿舍管理,人员信息维 护。维修登记,卫生管理,访客管理等等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + ldea2019 (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven
角色信息控制层:
@Controller
public class RoleController {@Autowiredprivate IRoleService roleService;@Autowiredprivate IPermissionService permissionService;@PreAuthorize("hasRole('管理员')")@ResponseBody@RequestMapping("/role/doAdd")public String doAdd(Role role){//角色添加return "ok";}//添加角色@RequestMapping("/role/addRole")@PreAuthorize("hasRole('管理员')")@ResponseBodypublic 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")@ResponseBodypublic PageList listpage(RoleQuery roleQuery){System.out.println("传递参数:"+roleQuery);return roleService.listpage(roleQuery);}//修改用户editSaveUser@RequestMapping("/role/editSaveRole")@ResponseBodypublic 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")@ResponseBodypublic 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;}//添加角色权限 addRolePermission@RequestMapping("/role/addRolePermission")@ResponseBodypublic AjaxResult addRolePermission(@RequestBody Map paramMap){AjaxResult ajaxResult = new AjaxResult();String roleId = (String)paramMap.get("roleId");List permissionIds = (List) paramMap.get("permissionIds");try {//添加角色对应的权限roleService.addRolePermission(roleId,permissionIds);return ajaxResult;}catch (Exception e){e.printStackTrace();return new AjaxResult("保存权限失败");}}}
用户管理控制器:
/*** 用户管理控制器*/
@RequestMapping("/user/")
@Controller
public class UserController {@Autowiredprivate IUserService userService;@Autowiredprivate IRoleService roleService;@Resourceprivate ProcessEngineConfiguration configuration;@Resourceprivate ProcessEngine engine;@GetMapping("/index")@ApiOperation("跳转用户页接口")@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("查询用户分页数据接口")@ApiImplicitParams({@ApiImplicitParam(name = "UserQuery", value = "用户查询对象", defaultValue = "userQuery对象")})@ResponseBody@PreAuthorize("hasRole('管理员')")public PageList listpage(UserQuery userQuery){return userService.listpage(userQuery);}//添加用户@PostMapping("/addUser")@ApiOperation("添加用户接口")@ResponseBodypublic Map<String,Object> addUser(User user){Map<String, Object> ret = new HashMap<>();ret.put("code",-1);if(StringUtils.isEmpty(user.getUsername())){ret.put("msg","请填写用户名");return ret;}if(StringUtils.isEmpty(user.getPassword())){ret.put("msg","请填写密码");return ret;}if(StringUtils.isEmpty(user.getEmail())){ret.put("msg","请填写邮箱");return ret;}if(StringUtils.isEmpty(user.getTel())){ret.put("msg","请填写手机号");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('管理员')")@ResponseBodypublic Message editSaveUser(User user){if(StringUtils.isEmpty(user.getUsername())){return Message.error("请填写用户名");}if(StringUtils.isEmpty(user.getEmail())){return Message.error("请填写邮箱");}if(StringUtils.isEmpty(user.getTel())){return Message.error("请填写手机号");}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('管理员')")@ResponseBodypublic 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('管理员')")@ResponseBodypublic 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]]}")})@ResponseBodypublic 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")@ResponseBodypublic 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());// 添加用户对应的组关系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
@Api(tags = "文件上传接口")
public class FileUpload {@Autowiredprivate IUserService userService;@Value("${lyy.upload.path}")private String uploadPath;@RequestMapping(value="/file/uploadFile", method= RequestMethod.POST)@ResponseBodypublic AjaxResult upload(HttpServletRequest req, Integer id, @RequestParam("file") MultipartFile file){try {if(file.isEmpty()){return new AjaxResult("文件为空");}String fileName = file.getOriginalFilename();String suffixName = fileName.substring(fileName.lastIndexOf("."));String uuidString = UUID.randomUUID().toString();String newFileName= uuidString + suffixName;File path = new File(uploadPath);if (!path.exists()) path.mkdirs();File savefile = new File(path,newFileName);if (!savefile.getParentFile().exists()) savefile.getParentFile().mkdirs();file.transferTo(savefile);//更新用户表的头像User user = new User();user.setId(Long.parseLong(id+""));user.setHeadImg(newFileName);userService.updateUserHeadImg(user);return new AjaxResult();} catch (IOException e) {e.printStackTrace();}return null;}@RequestMapping(value = "/showimage/{image_name}")public String showphoto(@PathVariable("image_name") String image_name,HttpServletRequest request, HttpServletResponse response)throws Exception {response.setDateHeader("Expires", 0);response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");response.addHeader("Cache-Control", "post-check=0, pre-check=0");response.setHeader("Pragma", "no-cache");response.setContentType("image/jpeg");// 获得的系统的根目录File fileParent = new File(File.separator);// 获得/usr/CBeann目录File file = null ;String os = System.getProperty("os.name");ServletOutputStream out = response.getOutputStream();try {if (os.toLowerCase().startsWith("win")) { //如果是Windows系统file = new File(uploadPath +"\\"+ image_name);} else { //linux 和macfile = new File(fileParent, uploadPath.substring(1) +"/"+ image_name);}IOUtils.copy(new FileInputStream(file),out);out.flush();} finally {out.close();}return null;}}
源码获取:博客首页 "资源" 里下载!
相关文章:

项目管理5大过程组,42个过程一句话讲解
2019独角兽企业重金招聘Python工程师标准>>> 启动过程组:(1)制定项目章程:诞生项目,并为项目经理“正名”;(2)识别干系人:搞清楚谁与项目相关;规划…
Android Q 变更和新特性
安全和隐私变更 隐私保护是Android Q重要的主题之一,Android Q带来了一系列增强用户隐私保护的变更。 1 应用文件存储空间限制 应用访问限制是Android Q影响最大变更之一。在Android Q系统中,应用只可以通过路径读取自己应用沙箱内的文件,如果…

KVell 单机k/v引擎:用最少的CPU 来调度Nvme的极致性能
文章目录前言KVell背景业界引擎使用Nvme的问题CPU 会是 LSM-kv 存储的瓶颈CPU 也会是 Btree-kv 存储的瓶颈KVell 设计亮点 及 总体架构实现KVell 设计亮点1. Share nothing2. Do not sorted on disk, but keep indexes in memory3. Aim for fewer syscalls , not for sequentia…

android录像增加时间记录(源码里修改)
需要做一个功能,录像和播放时都显示录时的时间,参考文章链接找不到了,不好意思,这里记录一下,防止下次找不到了。另一篇关于源码录像的流程请参考 http://www.verydemo.com/demo_c131_i79000.html 在源码CameraSource.…

Java项目:在线旅游系统(java+jsp+SSM+Spring+mysql+maven)
源码获取:博客首页 "资源" 里下载! 一、项目简述 功能:用户的登录注册,旅游景点的展示,旅游预订,收藏,购买,以及酒店住宿留言等等,后台管理员,订单…

混合式APP开发中中间件方案Rexsee
发现Rexsee时,他已经一年多没有更新过了,最后版本是2012年的。 他的实现思路是通过Android自带的Java - Javascript 桥机制,在WebView中的JavaScript同Java进行通信,而这样的话即Javascript可以直接创建原生UI界面,以获…

vue 前端框架 (三)
VUE 生命周期 <!DOCTYPE html> <html><head><meta charset"utf-8"><title></title><script type"text/javascript" src"js/vue.js"></script><link rel"stylesheet" type"te…

Rocksdb 的 MergeOperator 简单使用记录
本篇仅仅是一个记录 MergeOperator 的使用方式。 Rocksdb 使用MergeOperator 来代替Update 场景中的读改写操作,即用户的一个Update 操作需要调用rocksdb的 Get Put 接口才能完成。 而这种情况下会引入一些额外的读写放大,对于支持SQL这种update 频繁的…

Java项目:考试系统Java基础Gui(java+Gui)
源码获取:博客首页 "资源" 里下载! 功能简介: 所属课程、题目内容、题目选项、题目答案、题目等级、学生管理、试卷管理、题目管理、时间控制 服务页面: public class ServerClient extends javax.swing.JFrame {/** …

软件工程需求设计说明书
Java即时通聊天程序 设计需求说明书 专业班级: 计本班1202班 项目组成员: 杨宗坤 刘瑞 满亚洲 指导教师: 张利峰 开始日期: 完成日期: 编写目的: 本说明书是在充分理解系统需求分析…

Nagios 安装文档
安装前的装备工作(1)解决安装Nagios的依赖关系:Nagios基本组件的运行依赖于httpd、gcc和gd。可以通过以下命令来检查nagios所依赖的rpm包是否已经安装完成:#yum -y install httpd gcc glibc glibc-common *gd* php php-mysql mysql mysql-server --skip-…

Comprehensive Guide to build a Recommendation Engine from scratch (in Python) / 从0开始搭建推荐系统...
https://www.analyticsvidhya.com/blog/2018/06/comprehensive-guide-recommendation-engine-python/, 一篇详细的入门级的推荐系统的文章,这篇文章内容详实,格式漂亮,推荐给大家. 下面是翻译,翻译关注的是意思&#x…

关于std::string 在 并发场景下 __grow_by_and_replace free was not allocated 的异常问题
使用string时发现了一些坑。 我们知道stl 容器并不是线程安全的,所以在使用它们的过程中往往需要一些同步机制来保证并发场景下的同步更新。 应该踩的坑还是一个不拉的踩了进去,所以还是记录一下吧。 string作为一个容器,随着我们的append 或…

Java项目:银行管理系统+文档Java基础Gui(java+Gui)
源码获取:博客首页 "资源" 里下载! 功能介绍: 登录、打印、取款、改密、转账、查询、挂失、存款、退卡 服务模块: public class atmFrame extends JFrame {private JPanel contentPane;private user user; // private…

ie旋转滤镜Matrix
旋转一个元素算是一个比较常见的需求了吧,在支持CSS3的浏览器中可以使用transform很容易地实现,这里有介绍:http://www.css88.com/archives/2168,这里有演示http://www.css88.com/tool/css3Preview/Transform.html,就不…

音频(3):iPod Library Access Programming Guide:Introduction
NextIntroduction介绍iPod库访问(iPod Library Access)让应用程序可以播放用户的歌曲、有声书、和播客。这个API设计使得基本播放变得非常简单,同时也支持高级的搜索和播放控制功能。iPod library access 通过打开iOS允许的音乐相关的广阔范围…

【2019/4/30】周进度报告
冲刺可以推迟了,但这不妨碍知识储备(另外这周看了看梦断代码,感觉还是很有意思的一本书)。 第七周所花时间约9个小时代码量700多行,主要是阅读代码为主(框架内代码)博客量1篇了解到的知识点 1.y…

关于 智能指针 的线程安全问题
先说结论,智能指针都是非线程安全的。 多线程调度智能指针 这里案例使用的是shared_ptr,其他的unique_ptr或者weak_ptr的结果都是类似的,如下多线程调度代码: #include <memory> #include <thread> #include <v…

Java项目:无库版商品管理系统(java+Gui+文档)
源码获取:博客首页 "资源" 里下载! 功能介绍: 添加商品、修改商品、删除商品、进货出货、查看流水、注册 登录业务处理: public class LoginView extends JFrame implements ComponentListener{private JPanel center…

LTE QCI分类 QoS
http://blog.163.com/gzf_lte/blog/static/20840310620130140057204/ http://blog.163.com/gzf_lte/blog/static/208403106201301403652527/ http://blog.sina.com.cn/u/1731932381 lte2010 QCI (QoS Class Identifier)同时应用于GBR和Non-GBR承载。一个QCI是一个值࿰…

CSS 单行溢出文本只显示部分内容
.cc-item div { width:175px; text-overflow:clip; //该属性适用于IE6,IE7 max-width:175px; //该属性适用于IE8,FF,谷歌}

Audio声音
转载于:https://www.cnblogs.com/kubll/p/10799187.html

Rocksdb Ribbon Filter : 结合 XOR-filter 以及 高斯消元算法 实现的 高效filter
文章目录前言XOR-filter 实现原理xor filter 的构造原理xor filter 构造总结XOR-filter 和 ADD-filter对比XOR-filter 在计算上的优化Ribbon filter高斯消元法总结参考前言 还是起源于前几天的Rocksdb meetup,其中Peter C. Dillinger 这位大佬分享了自己为rocksdb实…

Java项目:无库版银行管理系统(java+Gui+文档)
源码获取:博客首页 "资源" 里下载! 功能介绍: 注册用户、编辑用户、删除用户、存取款、查看流水 存入业务处理: public class depositFrame extends JFrame {private JPanel contentPane;private JTextField inputFiel…

iptables-save和iptables-restore
iptables-save用来把当前的规则存入一个文件里以备iptables-restore使用。它的使用很简单,只有两个参数:iptables-save [-c] [-t table]参数-c的作用是保存包和字节计数器的值。这可以使我们在重启防火墙后不丢失对包和字节的统计。带-c参数的iptables-s…

代码之美——Doom3源代码赏析2
http://www.csdn.net/article/2013-01-17/2813778-the-beauty-of-doom3-source-code/2 摘要:Dyad作者、资深C工程师Shawn McGrathz在空闲时翻看了Doom3的源代码,发出了这样的惊叹:“这是我见过的最整洁、最优美的代码!”“Doom 3的…

什么是JavaBean
按着Sun公司的定义,JavaBean是一个可重复使用的软件组件。实际上JavaBean是一种Java类,通过封装属性和方法成为具有某种功能或者处理某个业务的对象,简称bean。由于javabean是基于java语言的,因此javabean不依赖平台,具…

关于 linux io_uring 性能测试 及其 实现原理的一些探索
文章目录先看看性能AIO 的基本实现io_ring 使用io_uring 基本接口liburing 的使用io_uring 非poll 模式下 的实现io_uring poll模式下的实现io_uring 在 rocksdb 中的应用总结参考先看看性能 io_uring 需要内核版本在5.1 及以上才支持,liburing的编译安装 很简单&am…

添加引用方式抛出和捕获干净的WebService异常
转载:http://www.cnblogs.com/ahdung/p/3953431.html 说明:【干净】指的是客户端在捕获WebService(下称WS)抛出的异常时,得到的ex.Message就是WS方法中抛出的异常消息,不含任何“杂质”。 前提:…

Java项目:车租赁管理系统(java+Gui+文档)
源码获取:博客首页 "资源" 里下载! 功能介绍: 登陆界面、管理员界面、用户界面、汽车租赁文档 系统主页: SuppressWarnings("serial") public class SystemMainView extends JFrame implements ActionListe…