需求;我们在添加用户的时候,需要上传员工的个人照片,还需要上传员工的身份证照片,这时候,就需要进行多文件的上传。
向数据库表smbms_user表中添加添加workpicpath
alter table smbms_user add workPicPath varchar(200) null DEFAULT NULL COMMENT ‘上传个人工作证照片存储路径‘;--默认是将新加的字段添加到了原来表中最后一个字段的后面。
useradd.js
useradd.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/WEB-INF/jsp/common/head.jsp"%> <div class="right"> <div class="location"> <strong>你现在所在的位置是:</strong> <span>用户管理页面 >> 用户添加页面</span> </div> <div class="providerAdd"> <form id="userForm" name="userForm" method="post" action="${pageContext.request.contextPath }/user/useraddsave.html" enctype="multipart/form-data"> <input type="hidden" name="method" value="add"> <!--div的class 为error是验证错误,ok是验证成功--> <div> <label for="userCode">用户编码:</label> <input type="text" name="userCode" id="userCode" value=""> <!-- 放置提示信息 --> <font color="red"></font> </div> <div> <label for="userName">用户名称:</label> <input type="text" name="userName" id="userName" value=""> <font color="red"></font> </div> <div> <label for="userPassword">用户密码:</label> <input type="password" name="userPassword" id="userPassword" value=""> <font color="red"></font> </div> <div> <label for="ruserPassword">确认密码:</label> <input type="password" name="ruserPassword" id="ruserPassword" value=""> <font color="red"></font> </div> <div> <label >用户性别:</label> <select name="gender" id="gender"> <option value="1" selected="selected">男</option> <option value="2">女</option> </select> </div> <div> <label for="birthday">出生日期:</label> <input type="text" Class="Wdate" id="birthday" name="birthday" readonly="readonly" onclick="WdatePicker();"> <font color="red"></font> </div> <div> <label for="phone">用户电话:</label> <input type="text" name="phone" id="phone" value=""> <font color="red"></font> </div> <!-- 两个 --> <div> <input type="hidden" id="errorinfo" value="${uploadFileError }"/> <label for="a_idPicPath">证件照:</label> <input type="file" name="attachs" id="a_idPicPath"> <font color="red"></font> </div> <div> <input type="hidden" id="errorinfo_wp" value="${uploadwpFileError }"/> <label for="a_workPicPath">免冠照:</label> <input type="file" name="attachs" id="a_workPicPath"> <font color="red"></font> </div> <div> <label for="address">用户地址:</label> <input name="address" id="address" value=""> </div> <div> <label >用户角色:</label> <!-- 列出所有的角色分类 --> <!-- <select name="userRole" id="userRole"></select> --> <select name="userRole" id="userRole"> <option value="1">系统管理员</option> <option value="2">经理</option> <option value="3" selected="selected">普通用户</option> </select> <font color="red"></font> </div> <div class="providerAddBtn"> <input type="button" name="add" id="add" value="保存" > <input type="button" id="back" name="back" value="返回" > </div> </form> </div> </div> </section> <%@include file="/WEB-INF/jsp/common/foot.jsp" %> <script type="text/javascript" src="${pageContext.request.contextPath }/statics/js/useradd.js"></script>
UserController.java
// 其中request对象主要用来存放错误信息,便于前台获取进行相应的提示,现在是多文件上传 @RequestMapping(value = "/useraddsave.html", method = RequestMethod.POST) public String addUserSave( User user, HttpSession session, HttpServletRequest request, @RequestParam(value = "attachs", required = false) MultipartFile[] attachs) { // 编写文件上传的代码 // 1.判断上传的文件是否为空 String idPicPath = null; String workPicPath = null; String errorInfo = null;// 定义统一的错误信息提示 boolean flag = true; String path = request.getSession().getServletContext() .getRealPath("statics" + File.separator + "uploadfiles"); logger.info("uploadFile path ============== > " + path); // 现在传过来的是多文件,使用的是数组,要进行循环遍历 for (int i = 0; i < attachs.length; i++) { MultipartFile attach = attachs[i]; // 如果上传的文件不为空 与系统有关的默认名称分隔符。此字段被初始化为包含系统属性 file.separator 的值的第一个字符。在 // UNIX 系统上,此字段的值为 ‘/‘;在 Microsoft Windows 系统上,它为 ‘\\‘。 if (i == 0) { errorInfo = "uploadFileError"; } else if (i == 1) { errorInfo = "uploadwpFileError"; } String oldFileName = attach.getOriginalFilename();// 原来你存在电脑盘符的文件名 logger.info("原来的文件名 ============== > " + oldFileName); String prefix = FilenameUtils.getExtension(oldFileName); logger.info("上传文件的后缀:" + prefix); int filesize = 500000;// 表示文件大小是500k if (!attach.isEmpty()) { if (attach.getSize() > filesize) { request.setAttribute("errorInfo", "上传的文件大小不得超过500k"); flag = false; // 判断文件的上传文件的格式 } else if (prefix.equalsIgnoreCase("jpg") || prefix.equalsIgnoreCase("png") || prefix.equalsIgnoreCase("pneg")) { String fileName = System.currentTimeMillis() + RandomUtils.nextInt(10000000) + "Personal.jpg"; logger.debug("new fileName======== " + attach.getName()); File targetFile = new File(path, fileName); logger.info("上传到服务器的文件名是:" + targetFile.toString()); // 如果服务器的文件路径存在的话,就进行创建 if (!targetFile.exists()) { /* * mkdirs()可以建立多级文件夹, mkdir()只会建立一级的文件夹, 如下: * new File("/tmp/one/two/three").mkdirs(); * 执行后, 会建立tmp/one/two/three四级目录 * new File("/tmp/one/two/three").mkdir(); * 则不会建立任何目录, 因为找不到/tmp/one/two目录, 结果返回false */ targetFile.mkdirs(); } try { attach.transferTo(targetFile); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); request.setAttribute("errorInfo", "上传文件失败"); flag = false; } // 文件路径 if (i == 0) { idPicPath = path + File.separator + fileName; } else if (i == 1) { workPicPath = path + File.separator + fileName; } logger.debug("idPicPath: " + idPicPath); logger.debug("workPicPath: " + workPicPath); } else { request.setAttribute("errorInfo", " * 上传图片格式不正确"); flag = false; } } } if (flag) { user.setCreatedBy(((User) session .getAttribute(Constants.USER_SESSION)).getId()); user.setCreationDate(new Date()); user.setIdPicPath(idPicPath); user.setWorkPicPath(workPicPath); if (userService.add(user)) { return "redirect:/user/userlist.html"; } } return "useradd"; }
UserDaoImpl.java
package cn.smbms.dao.user; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Repository; import com.mysql.jdbc.StringUtils; import cn.smbms.dao.BaseDao; import cn.smbms.pojo.User; /** * dao层抛出异常,让service层去捕获处理 * @author Administrator * */ @Repository public class UserDaoImpl implements UserDao{ @Override public int add(Connection connection, User user) throws Exception { // TODO Auto-generated method stub PreparedStatement pstm = null; int updateRows = 0; if(null != connection){ String sql = "insert into smbms_user (userCode,userName,userPassword," + "userRole,gender,birthday,phone,address,creationDate,createdBy,idPicPath,workPicPath) " + "values(?,?,?,?,?,?,?,?,?,?,?,?)"; Object[] params = {user.getUserCode(),user.getUserName(),user.getUserPassword(), user.getUserRole(),user.getGender(),user.getBirthday(), user.getPhone(),user.getAddress(),user.getCreationDate(),user.getCreatedBy(),user.getIdPicPath(),user.getWorkPicPath()}; updateRows = BaseDao.execute(connection, pstm, sql, params); BaseDao.closeResource(null, pstm, null); } return updateRows; } @Override public User getLoginUser(Connection connection, String userCode) throws Exception { // TODO Auto-generated method stub PreparedStatement pstm = null; ResultSet rs = null; User user = null; if(null != connection){ String sql = "select * from smbms_user where userCode=?"; Object[] params = {userCode}; rs = BaseDao.execute(connection, pstm, rs, sql, params); if(rs.next()){ user = new User(); user.setId(rs.getInt("id")); user.setUserCode(rs.getString("userCode")); user.setUserName(rs.getString("userName")); user.setUserPassword(rs.getString("userPassword")); user.setGender(rs.getInt("gender")); user.setBirthday(rs.getDate("birthday")); user.setPhone(rs.getString("phone")); user.setAddress(rs.getString("address")); user.setUserRole(rs.getInt("userRole")); user.setCreatedBy(rs.getInt("createdBy")); user.setCreationDate(rs.getTimestamp("creationDate")); user.setModifyBy(rs.getInt("modifyBy")); user.setModifyDate(rs.getTimestamp("modifyDate")); } BaseDao.closeResource(null, pstm, rs); } return user; } @Override public List<User> getUserList(Connection connection, String userName,int userRole,int currentPageNo, int pageSize) throws Exception { // TODO Auto-generated method stub PreparedStatement pstm = null; ResultSet rs = null; List<User> userList = new ArrayList<User>(); if(connection != null){ StringBuffer sql = new StringBuffer(); sql.append("select u.*,r.roleName as userRoleName from smbms_user u,smbms_role r where u.userRole = r.id"); List<Object> list = new ArrayList<Object>(); if(!StringUtils.isNullOrEmpty(userName)){ sql.append(" and u.userName like ?"); list.add("%"+userName+"%"); } if(userRole > 0){ sql.append(" and u.userRole = ?"); list.add(userRole); } sql.append(" order by creationDate DESC limit ?,?"); currentPageNo = (currentPageNo-1)*pageSize; list.add(currentPageNo); list.add(pageSize); Object[] params = list.toArray(); System.out.println("sql ----> " + sql.toString()); rs = BaseDao.execute(connection, pstm, rs, sql.toString(), params); while(rs.next()){ User _user = new User(); _user.setId(rs.getInt("id")); _user.setUserCode(rs.getString("userCode")); _user.setUserName(rs.getString("userName")); _user.setGender(rs.getInt("gender")); _user.setBirthday(rs.getDate("birthday")); _user.setPhone(rs.getString("phone")); _user.setUserRole(rs.getInt("userRole")); _user.setUserRoleName(rs.getString("userRoleName")); userList.add(_user); } BaseDao.closeResource(null, pstm, rs); } return userList; } @Override public int deleteUserById(Connection connection,Integer delId) throws Exception { // TODO Auto-generated method stub PreparedStatement pstm = null; int flag = 0; if(null != connection){ String sql = "delete from smbms_user where id=?"; Object[] params = {delId}; flag = BaseDao.execute(connection, pstm, sql, params); BaseDao.closeResource(null, pstm, null); } return flag; } @Override public User getUserById(Connection connection, String id) throws Exception { // TODO Auto-generated method stub User user = null; PreparedStatement pstm = null; ResultSet rs = null; if(null != connection){ String sql = "select u.*,r.roleName as userRoleName from smbms_user u,smbms_role r where u.id=? and u.userRole = r.id"; Object[] params = {id}; rs = BaseDao.execute(connection, pstm, rs, sql, params); if(rs.next()){ user = new User(); user.setId(rs.getInt("id")); user.setUserCode(rs.getString("userCode")); user.setUserName(rs.getString("userName")); user.setUserPassword(rs.getString("userPassword")); user.setGender(rs.getInt("gender")); user.setBirthday(rs.getDate("birthday")); user.setPhone(rs.getString("phone")); user.setAddress(rs.getString("address")); user.setUserRole(rs.getInt("userRole")); user.setCreatedBy(rs.getInt("createdBy")); user.setCreationDate(rs.getTimestamp("creationDate")); user.setModifyBy(rs.getInt("modifyBy")); user.setModifyDate(rs.getTimestamp("modifyDate")); user.setUserRoleName(rs.getString("userRoleName")); } BaseDao.closeResource(null, pstm, rs); } return user; } @Override public int modify(Connection connection, User user) throws Exception { // TODO Auto-generated method stub int flag = 0; PreparedStatement pstm = null; if(null != connection){ String sql = "update smbms_user set userName=?,"+ "gender=?,birthday=?,phone=?,address=?,userRole=?,modifyBy=?,modifyDate=? where id = ? "; Object[] params = {user.getUserName(),user.getGender(),user.getBirthday(), user.getPhone(),user.getAddress(),user.getUserRole(),user.getModifyBy(), user.getModifyDate(),user.getId()}; flag = BaseDao.execute(connection, pstm, sql, params); BaseDao.closeResource(null, pstm, null); } return flag; } @Override public int updatePwd(Connection connection, int id, String pwd) throws Exception { // TODO Auto-generated method stub int flag = 0; PreparedStatement pstm = null; if(connection != null){ String sql = "update smbms_user set userPassword= ? where id = ?"; Object[] params = {pwd,id}; flag = BaseDao.execute(connection, pstm, sql, params); BaseDao.closeResource(null, pstm, null); } return flag; } @Override public int getUserCount(Connection connection, String userName, int userRole) throws Exception { // TODO Auto-generated method stub PreparedStatement pstm = null; ResultSet rs = null; int count = 0; if(connection != null){ StringBuffer sql = new StringBuffer(); sql.append("select count(1) as count from smbms_user u,smbms_role r where u.userRole = r.id"); List<Object> list = new ArrayList<Object>(); if(!StringUtils.isNullOrEmpty(userName)){ sql.append(" and u.userName like ?"); list.add("%"+userName+"%"); } if(userRole > 0){ sql.append(" and u.userRole = ?"); list.add(userRole); } Object[] params = list.toArray(); System.out.println("sql ----> " + sql.toString()); rs = BaseDao.execute(connection, pstm, rs, sql.toString(), params); if(rs.next()){ count = rs.getInt("count"); } BaseDao.closeResource(null, pstm, rs); } return count; } }
UserServiceImpl.java
package cn.smbms.service.user; import java.sql.Connection; import java.sql.SQLException; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import cn.smbms.dao.BaseDao; import cn.smbms.dao.user.UserDao; import cn.smbms.pojo.User; /** * service层捕获异常,进行事务处理 * 事务处理:调用不同dao的多个方法,必须使用同一个connection(connection作为参数传递) * 事务完成之后,需要在service层进行connection的关闭,在dao层关闭(PreparedStatement和ResultSet对象) * @author Administrator * */ @Service public class UserServiceImpl implements UserService{ @Resource private UserDao userDao; @Override public boolean add(User user) { // TODO Auto-generated method stub boolean flag = false; Connection connection = null; try { connection = BaseDao.getConnection(); connection.setAutoCommit(false);//开启JDBC事务管理 int updateRows = userDao.add(connection,user); connection.commit(); if(updateRows > 0){ flag = true; System.out.println("add success!"); }else{ System.out.println("add failed!"); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); try { System.out.println("rollback=================="); connection.rollback(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }finally{ //在service层进行connection连接的关闭 BaseDao.closeResource(connection, null, null); } return flag; } @Override public User login(String userCode, String userPassword) { // TODO Auto-generated method stub Connection connection = null; User user = null; try { connection = BaseDao.getConnection(); user = userDao.getLoginUser(connection, userCode); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ BaseDao.closeResource(connection, null, null); } //匹配密码 if(null != user){ if(!user.getUserPassword().equals(userPassword)) user = null; } return user; } @Override public List<User> getUserList(String queryUserName,int queryUserRole,int currentPageNo, int pageSize) { // TODO Auto-generated method stub Connection connection = null; List<User> userList = null; System.out.println("queryUserName ---- > " + queryUserName); System.out.println("queryUserRole ---- > " + queryUserRole); System.out.println("currentPageNo ---- > " + currentPageNo); System.out.println("pageSize ---- > " + pageSize); try { connection = BaseDao.getConnection(); userList = userDao.getUserList(connection, queryUserName,queryUserRole,currentPageNo,pageSize); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ BaseDao.closeResource(connection, null, null); } return userList; } @Override public User selectUserCodeExist(String userCode) { // TODO Auto-generated method stub Connection connection = null; User user = null; try { connection = BaseDao.getConnection(); user = userDao.getLoginUser(connection, userCode); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ BaseDao.closeResource(connection, null, null); } return user; } @Override public boolean deleteUserById(Integer delId) { // TODO Auto-generated method stub Connection connection = null; boolean flag = false; try { connection = BaseDao.getConnection(); if(userDao.deleteUserById(connection,delId) > 0) flag = true; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ BaseDao.closeResource(connection, null, null); } return flag; } @Override public User getUserById(String id) { // TODO Auto-generated method stub User user = null; Connection connection = null; try{ connection = BaseDao.getConnection(); user = userDao.getUserById(connection,id); }catch (Exception e) { // TODO: handle exception e.printStackTrace(); user = null; }finally{ BaseDao.closeResource(connection, null, null); } return user; } @Override public boolean modify(User user) { // TODO Auto-generated method stub Connection connection = null; boolean flag = false; try { connection = BaseDao.getConnection(); if(userDao.modify(connection,user) > 0) flag = true; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ BaseDao.closeResource(connection, null, null); } return flag; } @Override public boolean updatePwd(int id, String pwd) { // TODO Auto-generated method stub boolean flag = false; Connection connection = null; try{ connection = BaseDao.getConnection(); if(userDao.updatePwd(connection,id,pwd) > 0) flag = true; }catch (Exception e) { // TODO: handle exception e.printStackTrace(); }finally{ BaseDao.closeResource(connection, null, null); } return flag; } @Override public int getUserCount(String queryUserName, int queryUserRole) { // TODO Auto-generated method stub Connection connection = null; int count = 0; System.out.println("queryUserName ---- > " + queryUserName); System.out.println("queryUserRole ---- > " + queryUserRole); try { connection = BaseDao.getConnection(); count = userDao.getUserCount(connection, queryUserName,queryUserRole); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ BaseDao.closeResource(connection, null, null); } return count; } }
运行结果:
运行日志:
(475854 ms) - 2020-1-30 16:50:59[DEBUG](FrameworkServlet.java:983) Successfully completed request - (505303 ms) - 2020-1-30 16:51:28[DEBUG](DispatcherServlet.java:819) DispatcherServlet with name ‘springmvc‘ processing POST request for [/SMBMS_C11_01/user/useraddsave.html] - (505310 ms) - 2020-1-30 16:51:28[DEBUG](CommonsFileUploadSupport.java:259) Found multipart file [attachs] of size 423722 bytes with original filename [微信图片_20200130152415.png], stored at [D:\SoftWare\tomcat\apache-tomcat-6.0.53\work\Catalina\localhost\SMBMS_C11_01\upload_3a923b64_16ff5a10d73__8000_00000032.tmp] - (505310 ms) - 2020-1-30 16:51:28[DEBUG](CommonsFileUploadSupport.java:259) Found multipart file [attachs] of size 33326 bytes with original filename [sunFlower.jpg], stored at [D:\SoftWare\tomcat\apache-tomcat-6.0.53\work\Catalina\localhost\SMBMS_C11_01\upload_3a923b64_16ff5a10d73__8000_00000033.tmp] - (505310 ms) - 2020-1-30 16:51:28[DEBUG](AbstractHandlerMethodMapping.java:229) Looking up handler method for path /user/useraddsave.html - (505310 ms) - 2020-1-30 16:51:28[DEBUG](AbstractHandlerMethodMapping.java:234) Returning handler method [public java.lang.String cn.smbms.controller.UserController.addUserSave(cn.smbms.pojo.User,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest,org.springframework.web.multipart.MultipartFile[])] - (505311 ms) - 2020-1-30 16:51:28[DEBUG](AbstractBeanFactory.java:243) Returning cached instance of singleton bean ‘userController‘ - (505312 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:193) uploadFile path ============== > D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles - (505312 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:207) 原来的文件名 ============== > 微信图片_20200130152415.png - (505312 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:209) 上传文件的后缀:png - (505312 ms) - 2020-1-30 16:51:28[DEBUG](UserController.java:221) new fileName======== attachs - (505312 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:223) 上传到服务器的文件名是:D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles\1580384074093Personal.jpg - (505317 ms) - 2020-1-30 16:51:28[DEBUG](CommonsMultipartFile.java:139) Multipart file ‘attachs‘ with original filename [微信图片_20200130152415.png], stored at [D:\SoftWare\tomcat\apache-tomcat-6.0.53\work\Catalina\localhost\SMBMS_C11_01\upload_3a923b64_16ff5a10d73__8000_00000032.tmp]: moved to [D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles\1580384074093Personal.jpg] - (505317 ms) - 2020-1-30 16:51:28[DEBUG](UserController.java:249) idPicPath: D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles\1580384074093Personal.jpg - (505318 ms) - 2020-1-30 16:51:28[DEBUG](UserController.java:250) workPicPath: null - (505318 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:207) 原来的文件名 ============== > sunFlower.jpg - (505318 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:209) 上传文件的后缀:jpg - (505318 ms) - 2020-1-30 16:51:28[DEBUG](UserController.java:221) new fileName======== attachs - (505318 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:223) 上传到服务器的文件名是:D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles\1580376977645Personal.jpg - (505320 ms) - 2020-1-30 16:51:28[DEBUG](CommonsMultipartFile.java:139) Multipart file ‘attachs‘ with original filename [sunFlower.jpg], stored at [D:\SoftWare\tomcat\apache-tomcat-6.0.53\work\Catalina\localhost\SMBMS_C11_01\upload_3a923b64_16ff5a10d73__8000_00000033.tmp]: moved to [D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles\1580376977645Personal.jpg] - (505320 ms) - 2020-1-30 16:51:28[DEBUG](UserController.java:249) idPicPath: D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles\1580384074093Personal.jpg - (505321 ms) - 2020-1-30 16:51:28[DEBUG](UserController.java:250) workPicPath: D:\SoftWare\tomcat\apache-tomcat-6.0.53\webapps\SMBMS_C11_01\statics\uploadfiles\1580376977645Personal.jpg add success! - (505329 ms) - 2020-1-30 16:51:28[DEBUG](DispatcherServlet.java:1198) Rendering view [org.springframework.web.servlet.view.RedirectView: name ‘redirect:/user/userlist.html‘; URL [/user/userlist.html]] in DispatcherServlet with name ‘springmvc‘ - (505329 ms) - 2020-1-30 16:51:28[DEBUG](CommonsFileUploadSupport.java:282) Cleaning up multipart file [attachs] with original filename [微信图片_20200130152415.png], stored at [D:\SoftWare\tomcat\apache-tomcat-6.0.53\work\Catalina\localhost\SMBMS_C11_01\upload_3a923b64_16ff5a10d73__8000_00000032.tmp] - (505329 ms) - 2020-1-30 16:51:28[DEBUG](CommonsFileUploadSupport.java:282) Cleaning up multipart file [attachs] with original filename [sunFlower.jpg], stored at [D:\SoftWare\tomcat\apache-tomcat-6.0.53\work\Catalina\localhost\SMBMS_C11_01\upload_3a923b64_16ff5a10d73__8000_00000033.tmp] - (505329 ms) - 2020-1-30 16:51:28[DEBUG](FrameworkServlet.java:983) Successfully completed request - (505332 ms) - 2020-1-30 16:51:28[DEBUG](DispatcherServlet.java:819) DispatcherServlet with name ‘springmvc‘ processing GET request for [/SMBMS_C11_01/user/userlist.html] - (505332 ms) - 2020-1-30 16:51:28[DEBUG](AbstractHandlerMethodMapping.java:229) Looking up handler method for path /user/userlist.html - (505332 ms) - 2020-1-30 16:51:28[DEBUG](AbstractHandlerMethodMapping.java:234) Returning handler method [public java.lang.String cn.smbms.controller.UserController.getUserList(org.springframework.ui.Model,java.lang.String,java.lang.String,java.lang.String)] - (505332 ms) - 2020-1-30 16:51:28[DEBUG](AbstractBeanFactory.java:243) Returning cached instance of singleton bean ‘userController‘ - (505332 ms) - 2020-1-30 16:51:28[DEBUG](DispatcherServlet.java:906) Last-Modified value for [/SMBMS_C11_01/user/userlist.html] is: -1 - (505333 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:109) getUserList ---- > queryUserName: null - (505333 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:110) getUserList ---- > queryUserRole: null - (505333 ms) - 2020-1-30 16:51:28[ INFO](UserController.java:111) getUserList ---- > pageIndex: null queryUserName ---- > queryUserRole ---- > 0 sql ----> select count(1) as count from smbms_user u,smbms_role r where u.userRole = r.id queryUserName ---- > queryUserRole ---- > 0 currentPageNo ---- > 1 pageSize ---- > 5 sql ----> select u.*,r.roleName as userRoleName from smbms_user u,smbms_role r where u.userRole = r.id order by creationDate DESC limit ?,? - (505361 ms) - 2020-1-30 16:51:28[DEBUG](DispatcherServlet.java:1198) Rendering view [org.springframework.web.servlet.view.JstlView: name ‘userlist‘; URL [/WEB-INF/jsp/userlist.jsp]] in DispatcherServlet with name ‘springmvc‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](AbstractView.java:375) Added model object ‘userList‘ of type [java.util.ArrayList] to request in view with name ‘userlist‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](AbstractView.java:375) Added model object ‘roleList‘ of type [java.util.ArrayList] to request in view with name ‘userlist‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](AbstractView.java:375) Added model object ‘queryUserName‘ of type [java.lang.String] to request in view with name ‘userlist‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](AbstractView.java:382) Removed model object ‘queryUserRole‘ from request in view with name ‘userlist‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](AbstractView.java:375) Added model object ‘totalPageCount‘ of type [java.lang.Integer] to request in view with name ‘userlist‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](AbstractView.java:375) Added model object ‘totalCount‘ of type [java.lang.Integer] to request in view with name ‘userlist‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](AbstractView.java:375) Added model object ‘currentPageNo‘ of type [java.lang.Integer] to request in view with name ‘userlist‘ - (505362 ms) - 2020-1-30 16:51:28[DEBUG](InternalResourceView.java:236) Forwarding to resource [/WEB-INF/jsp/userlist.jsp] in InternalResourceView ‘userlist‘ - (505367 ms) - 2020-1-30 16:51:28[DEBUG](FrameworkServlet.java:983) Successfully completed request
原文地址:https://www.cnblogs.com/dongyaotou/p/12243115.html
时间: 2024-10-02 00:29:55