展开全部
select * from 表 where 。。。
resultType 可以是任意Object对象,如果多条数据,这这个方法返e5a48de588b662616964757a686964616f31333335326130回的是List,
如果确认是单条数据,可以直接 Object? ***(**); 。
没有封装成对象时,默认返回的是List>这样的数据。Dao接口:
List> list(Integer id);
SQL:
select * from aaa
id >#{id}
以上示例中表示查询id>某个数值的所有结果,返回类型为MAP
执行脚本后没有返回结果的吧,看ScriptRunner源码,没有提供任何返回结果的。private void executeStatement(String command) throws SQLException, UnsupportedEncodingException {
boolean hasResults = false;
Statement statement = connection.createStatement();
statement.setEscapeProcessing(escapeProcessing);
String sql = command;
if (removeCRs)
sql = sql.replaceAll("\r\n", "\n");
if (stopOnError) {
hasResults = statement.execute(sql);
} else {
try {
hasResults = statement.execute(sql);
} catch (SQLException e) {
String message = "Error executing: " + command + ". Cause: " + e;
printlnError(message);
}
}
printResults(statement, hasResults);
try {
statement.close();
} catch (Exception e) {
// Ignore to workaround a bug in some connection pools
}
}
...
有结果时,最后调用了这个方法打印出来而已。
private void print(Object o) {
if (logWriter != null) {
logWriter.print(o);
logWriter.flush();
}
}
你可以调用
public void setLogWriter(PrintWriter logWriter) {
this.logWriter = logWriter;
}
传入你自己的Writer。