SSMP一次请求数据处理过程分析
控制器代码
@RequestMapping("/changeUserPwd") public TranMessage changeUserPwd(String oriPwd, String newPwd) { try{ cfgSvc.changeUserPwd(oriPwd, newPwd); } catch (Exception e){ return new TranMessage(false, ZUtil.obtainDbErrorInfo(e.toString())); } return new TranMessage(true); }
服务层代码
public void changeUserPwd(String oriPwd, String newPwd){ SysUser user = getCurLoginUser(); cn.zdp.itsys.autogen.mybatisplus.entity.SysUser userEt = new cn.zdp.itsys.autogen.mybatisplus.entity.SysUser(); userEt = userEt.selectById(user.getId()); if (!userEt.getPassword().equals(oriPwd)) throw new RuntimeException("原密码不正确"); userEt.setPassword(newPwd); userEt.updateById(); }
2018-06-26 13:46:35,430 [http-nio-8080-exec-153] DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'maindispatcher' processing POST request for [/itsys/cfg/changeUserPwd] // 请求分配给DispatcherServlet的实例maindispatcher /cfg/changeUserPwd
2018-06-26 13:46:35,430 [http-nio-8080-exec-153] DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Looking up handler method for path /cfg/changeUserPwd // 查找请求映射/cfg/changeUserPwd
2018-06-26 13:46:35,430 [http-nio-8080-exec-153] DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Returning handler method [public cn.zdp.itsys.page.TranMessage cn.zdp.itsys.controller.ConfigController.changeUserPwd(java.lang.String,java.lang.String)] // 找到对应的控制器方法ConfigController.changeUserPwd
2018-06-26 13:46:35,430 [http-nio-8080-exec-153] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'configController' // 从缓存里得到控制器实例configController
2018-06-26 13:46:35,431 [http-nio-8080-exec-153] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource // 取数据库连接
2018-06-26 13:46:35,431 [http-nio-8080-exec-153] DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [oracle.jdbc.driver.T4CConnection@3eb803] will not be managed by Spring // 由spring接管数据库连接
2018-06-26 13:46:35,431 [http-nio-8080-exec-153] DEBUG [cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.selectById] - ==> Preparing: SELECT ID AS id,USERNAME AS username,PASSWORD AS password,REALNAME AS realname,ROLE_ID AS roleId,CUSTOMER_ID AS customerId FROM SYS_USER WHERE ID=? // MP的实体类的selectById方法
2018-06-26 13:46:35,436 [http-nio-8080-exec-153] DEBUG [cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.selectById] - ==> Parameters: 1(Integer) // 参数
2018-06-26 13:46:35,447 [http-nio-8080-exec-153] DEBUG [cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.selectById] - <== Total: 1
2018-06-26 13:46:35,448 [http-nio-8080-exec-153] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource
Time:14 ms - ID:cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.selectById
Execute SQL:SELECT ID AS id,USERNAME AS username,PASSWORD AS password,REALNAME AS realname,ROLE_ID AS roleId,CUSTOMER_ID AS customerId FROM SYS_USER WHERE ID=? // 返回数据库连接
2018-06-26 13:46:35,454 [http-nio-8080-exec-153] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Fetching JDBC Connection from DataSource //取数据连接
2018-06-26 13:46:35,454 [http-nio-8080-exec-153] DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [oracle.jdbc.driver.T4CConnection@3eb803] will not be managed by Spring // 由spring接管数据库连接
2018-06-26 13:46:35,455 [http-nio-8080-exec-153] DEBUG [cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.updateById] - ==> Preparing: UPDATE SYS_USER SET USERNAME=?, PASSWORD=?, REALNAME=?, ROLE_ID=?, CUSTOMER_ID=? WHERE ID=? // 执行MP实体类的updateById
2018-06-26 13:46:35,457 [http-nio-8080-exec-153] DEBUG [cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.updateById] - ==> Parameters: zdp(String), 321(String), 系统管理员(String), 1.0(Double), 1.0(Double), 1.0(Double) // 参数
2018-06-26 13:46:35,461 [http-nio-8080-exec-153] DEBUG [cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.updateById] - <== Updates: 1
Time:4 ms - ID:cn.zdp.itsys.autogen.mybatisplus.mapper.SysUserMapper.updateById
Execute SQL:UPDATE SYS_USER SET USERNAME=?, PASSWORD=?, REALNAME=?, ROLE_ID=?, CUSTOMER_ID=? WHERE ID=?
2018-06-26 13:46:35,462 [http-nio-8080-exec-153] DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] - Returning JDBC Connection to DataSource // 返回数据库连接
2018-06-26 13:46:35,463 [http-nio-8080-exec-153] DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor] - Written [cn.zdp.itsys.page.TranMessage@4e4782ae] as "application/json;charset=UTF-8" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@2fa8ac7d] // ResponseBody注解返回对象json
2018-06-26 13:46:35,463 [http-nio-8080-exec-153] DEBUG [org.springframework.web.servlet.DispatcherServlet] - Null ModelAndView returned to DispatcherServlet with name 'maindispatcher': assuming HandlerAdapter completed request handling // 处理完成,无视图返回
2018-06-26 13:46:35,463 [http-nio-8080-exec-153] DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request
2018-06-26 13:46:35,463 [http-nio-8080-exec-153] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'sqlSessionFactory' // 返回sqlSessionFactory bean到缓存