Hint
This article is generated by AI translation.
Argument Rules
These rules define or process data, such as MD5 hashing, UUID generation, encryption/decryption.
| Rule | Description |
|---|---|
@{md5, argExpr} | Evaluate argExpr via OGNL, then compute MD5 and use the MD5 value as the SQL argument. |
@{uuid32} | Generate a 32-character UUID and add it to SQL arguments. |
@{uuid36} | Generate a 36-character UUID and add it to SQL arguments. |
@{pairs} | Iterate Map/List/Array collections and generate query conditions using a fixed template. |
MD5 Rule
Query user by account/password (password already MD5)
select * from users where account = :loginName and password = @{md5, loginPassword}
UUID Rule
Insert user and auto-generate 32-length UUID as UID
insert into users (id,uid,name,time) values (:id, @{uuid32}, :name, now());
PAIRS Rule
Usage: @{pairs, <param>, <template>}. In the template you can use:
:k— collection key; for Map it is the key, for other collections it is the index (same as:i).:v— collection value; for List/Array it is the element value.:i— current zero-based index.
A Map example
Map<String, String> hashData = new HashMap<>();
hashData.put("field1", "value1");
hashData.put("field2", "value2");
Store Map into Redis HASH
HSET myKey1 @{pairs, :arg0, :k :v}
- Explanation
- :arg0: first argument
- :k: Map key
- :v: Map value
- Generated statement:
HSET ? ? ? ? ?HSET myKey1 field1 value1 field2 value2