——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明





基于javaweb的SSM图书借阅管理系统(java+ssm+mysql+jsp)
首页:
http://localhost:8080/ssmtushu/media/login.jsp
管理员:
admin 123456
用户:
user1 123456
user2 123456
管理员可以管理图书和学生
学生可以借书和还书
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { MultipartFile mf = entity.getValue(); String imgName = ToolUtil.getUploadImageNamejpg("ue");
String imgDate = ToolUtil.getCurSystemDate("yyyyMMddhhmmss")+getSixNumber();
String imageName = "ue"+"_"+imgDate+".jpg";
ToolUtil.createFile(path+imgName); File uploadFile = new File(path+imgName);
FileCopyUtils.copy(mf.getBytes(), uploadFile);
map.put("state","SUCCESS"); map.put("url",IP+imgName); map.put("original",IP+imgName); map.put("name",imgName);
} return JSONObject.toJSONString(map);
}catch (Exception e){ e.printStackTrace(); } }else if("listimage".equals(action)){ String path = request.getSession().getServletContext().getRealPath( File.separator+"upload"+File.separator+"ueditor"+File.separator)+File.separator; ToolUtil.createDir(path); File fileDir = new File(path);
String[] files= fileDir.list();
String start = request.getParameter("start"); String size = request.getParameter("size"); map.put("state","SUCCESS");
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| * @param session * @param request * @return */ @RequestMapping(params = "addUser") @ResponseBody public Map addUser(PowerUser paramT,HttpSession session,HttpServletRequest request) { Map<Object, Object> map = new HashMap<Object, Object>(); String[] roleId=request.getParameterValues("roleId"); try { PowerUser u=(PowerUser)session.getAttribute("users"); paramT.setUpdateUserId(u.getId()); paramT.setUpdateUserName(u.getUserName()); paramT.setUpdateTime(Time.nowDateToString()); paramT.setState(1); paramT.setMobilePowerState(1); paramT.setPassword(MD5.pass("123456")); if(paramT.getId()!=null && !"".equals(paramT.getId())){ powerUserDao.updateByPrimaryKeySelective(paramT); }else { paramT.setId(IDGenerator.getID()); powerUserDao.insertSelective(paramT); } roleUserDao.deleteByPrimaryUserId(paramT.getId()); for(int i=0;i<roleId.length;i++) { PowerRoleUser roleUser=new PowerRoleUser(); roleUser.setId(IDGenerator.getID()); roleUser.setRoleId(roleId[i]); roleUser.setPowId("0"); roleUser.setUserId(paramT.getId()); roleUserDao.insertSelective(roleUser); } map.put("msg", "保存成功"); map.put("success", true); } catch (Exception e) { e.printStackTrace(); map.put("success", false); map.put("msg", "保存失败"); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| Map<Object, Object> map = new HashMap<Object, Object>(); try { List<MobileUser> list = mobileUserDao.get(queryMap); map.put("rows", list); map.put("total", mobileUserDao.getCount(queryMap)); map.put("success",true); map.put("page", page); map.put("msg","查询成功"); } catch (Exception e) { map.put("success",false); map.put("msg","查询失败"); return map; } return map; }
@RequestMapping(params = "delMoreEvent") @ResponseBody public Map<Object, Object> deleteMore(String id,HttpServletRequest request){ Map<Object, Object> map = new HashMap<Object, Object>(); try { List<String> listId = new ArrayList<String>(); String[] arrId = id.split(","); for(int i = 0 ; i < arrId.length ; i ++ ){ listId.add(arrId[i]); Map<Object, Object> queryMap = new HashMap<Object, Object>(); queryMap.put("id", arrId[i]); } if( listId.size() > 0 ){ mobileUserDao.deleteMoreByPK(listId); map.put("msg", "删除成功"); map.put("success", true); }else{ map.put("msg", "缺少删除条件"); map.put("success", false); } return map; } catch (Exception e) {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| if (list.size() <= 0){ map.put("success", false); }else { this.addlog(list.get(0),1,request); map.put("success", true); session.setAttribute("users",list.get(0)); } } } catch (Exception e) { e.printStackTrace(); } return map; }
public String getIpAddr(HttpServletRequest request) { String ip = request.getHeader("X-Real-IP"); if (null != ip && !"".equals(ip.trim()) && !"unknown".equalsIgnoreCase(ip)) { return ip; } ip = request.getHeader("X-Forwarded-For"); if (null != ip && !"".equals(ip.trim()) && !"unknown".equalsIgnoreCase(ip)) { int index = ip.indexOf(','); if (index != -1) { return ip.substring(0, index); } else { return ip; } } return request.getRemoteAddr(); }
@RequestMapping(params="mobilelogin") @ResponseBody public Map mobilelogin(PowerUser user, HttpServletRequest request,HttpSession session){ Map map = new HashMap();
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| public Map<Object, Object> deleteMore(String id){ Map<Object, Object> map = new HashMap<Object, Object>(); try { List<String> listId = new ArrayList<String>(); String[] arrId = id.split(","); for(int i = 0 ; i < arrId.length ; i ++ ){ listId.add(arrId[i]); } if( listId.size() > 0 ){ dao.deleteMoreByPK(listId); map.put("msg", "操作成功"); map.put("success", true); }else{ map.put("msg", "缺少删除条件"); map.put("success", false); } return map; } catch (Exception e) { e.printStackTrace(); map.put("msg", "删除失败"); map.put("success", false); return map; } } @RequestMapping(params = "delMoreh") @ResponseBody public Map<Object, Object> deleteMoreh(String id){ Map<Object, Object> map = new HashMap<Object, Object>(); try { List<String> listId = new ArrayList<String>(); String[] arrId = id.split(","); for(int i = 0 ; i < arrId.length ; i ++ ){ listId.add(arrId[i]); } if( listId.size() > 0 ){ dao.deleteMoreByPKh(listId); map.put("msg", "操作成功"); map.put("success", true); }else{
map.put("success", false); } return map;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| // } // } // } // return tmp.toString(); try { return URLDecoder.decode(src, "UTF-8"); } catch (UnsupportedEncodingException e) { return ""; } }
public static void main(String[] args) { // String para = ""; // System.out.println("=====para=" + para); // para = Util.addPara(para, "column_id", 101); // para = Util.addPara(para, "content_id", 201); // String tmp = "~!@#$%^&*()_+|\\=-,./?><;'][{}\""; /* * String tmp = "a中国人a"; System.out.println("testing escape : " + tmp); * tmp = escape(tmp); System.out.println(tmp); * System.out.println("testing unescape :" + tmp); * System.out.println(unescape(tmp)); * System.out.println(substring("1我2我3我我456", 1, 2)); * System.out.println(substring("1我2我3我我456", 1, 3)); * System.out.println(substring("1我2我3我我456", 2, 3)); * System.out.println(substring("1我2我3我我456", 2, 4)); String var = * "1我2我3我我4561我2我3我我4561我2我3我我4561我2我3我我456"; * System.out.println(substring(var, 18, strlen(var))); * System.out.println(substring(var, 19, strlen(var))); * System.out.println(substring(var, 20, strlen(var))); var = * "我我4561我2我3我我456"; System.out.println(substring(var, 18, * strlen(var))); */ // System.out.println("getRandomNumber()=" + getRandomNumber(4)); // System.out.println("getCurSystemDate()=" + getCurSystemDate()); // String str = "hello!! 全角转换,DAO 053288631653"; // System.out.println(getCurrentMonday()); // System.out.println(getCurrentWeekend()); }
public static int getMondayPlus() { Calendar cd = Calendar.getInstance(); int dayOfWeek = cd.get(Calendar.DAY_OF_WEEK) - 1; if (dayOfWeek == 1) { return 0; } else { return 1 - dayOfWeek; } }
// 获取本周周一的日期
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=031323382409201gb
https://javayms.pages.dev?id=031323382409201gb