Configuration configuration = session.getConfiguration();
//sqlId为配置文件中的sqlid
MappedStatement mappedStatement = configuration.getMappedStatement(sqlId);
//param为传入到sql语句中的参数
BoundSql boundSql = mappedStatement.getBoundSql(param);
//得到sql语句
String sql = boundSql.getSql();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("info-sql: "+sdf.format(new Date())+" "+sql);