Hint
This article is generated by AI translation.
@Call Annotation
Marks an interface method and accepts a string or string array that represents a stored procedure invocation.
info
If you pass a string array, the elements are concatenated with a single space between them.
This makes it easy to manage SQL in a readable way.
Example
@SimpleMapper
public interface UserMapper {
// Input/output argument
@Call("{call proc_select_user(#{abc, mode=inout, jdbcType=decimal})}")
Map<String, Object> callSelectUser1(@Param("abc") int argAbc);
// Output-only argument
@Call("{call proc_select_user(#{abc, mode=out, jdbcType=decimal})}")
Map<String, Object> callSelectUser2();
}
UserMapper mapper = ...
Map<String, Object> res1 = mapper.callSelectUser1(23);
// res1.get("abc") retrieves the INOUT argument "abc"
Map<String, Object> res2 = mapper.callSelectUser2();
// res2.get("abc") retrieves the OUT argument "abc"
- When using @Call to invoke a stored procedure, the method return type must be Map<String,Object>. See Stored Procedures for SQL syntax.
- Stored procedure input arguments: passed in through method arguments
- Stored procedure output arguments: read from the returned map
- Result sets produced by the stored procedure: read from the returned map
- Stored procedure input arguments: passed in through method arguments
Properties
| Property | Description |
|---|---|
| value | 必选 SQL to execute. |
| timeout | 可选 If set to a value greater than 0, the value is applied to java.sql.Statement.setQueryTimeout(int) to enforce a timeout in seconds. Default is -1. |
| bindOut | 可选 Filters the output arguments to decide which ones will be received. If omitted, all arguments are captured. |