约定参数格式

  参数值⇢
约定格式⇣
1 2 3 4 5 6
  code=0 code= code=0&code=1&cd=2&user=5 cd=2&cd=3 code=0(密文) cd=2(密文)&cd=3(密文)
1 CODE:code CODE = 0 忽略 CODE = 0 忽略 忽略 忽略
2 CODE:%code% CODE LIKE '%0%' 忽略 CODE LIKE '%0%'
忽略 忽略 忽略
3 CODE:%code CODE LIKE '%0' 忽略 CODE LIKE '%0' 忽略 忽略 忽略
4 CODE:code% CODE LIKE '0%' 忽略 CODE LIKE '0%' 忽略 忽略 忽略
5 CODE:%code:cd% CODE LIKE '%0%' 忽略 CODE LIKE '%0%' CODE LIKE '%2%' 忽略 忽略
6 CODE:%code:cd:{9}% CODE LIKE '%0%' CODE LIKE '%9%' CODE LIKE '%0%' CODE LIKE '%2%' 忽略 忽略
7 CODE:%code:cd CODE LIKE '%0' 忽略 CODE LIKE '%0' CODE LIKE '%2' 忽略 忽略
8 CODE:%code:cd:{9} CODE LIKE '%0' CODE LIKE '%9' CODE LIKE '%0' CODE LIKE '%2' 忽略 忽略
9 CODE:[code] CODE = 0 忽略 CODE IN(0,1) 忽略 忽略 忽略
10 CODE:[code:cd] CODE = 0 忽略 CODE IN(0,1) CODE IN(2,3) 忽略 忽略
11 CODE:[cd+] 忽略
忽略
CODE = 2 CODE IN(2,3) 忽略
CODE IN(2,3)
12 CODE:[code:cd:{[6,7,8]}] CODE = 0 CODE IN(6,7,8) CODE IN(0,1) CODE IN(2,3) 忽略 忽略
13 CODE:[code:cd:{6,7,8}]
CODE = 0 CODE IN(6,7,8) CODE IN(0,1) CODE IN(2,3) 忽略 忽略
14 +CODE:code CODE = 0 CODE IS NULL CODE = 0 CODE IS NULL 忽略 忽略
15 ++CODE:code CODE = 0 不执行 CODE = 0 不执行 忽略 忽略
16 CODE:>code CODE > 0 忽略 CODE > 0 忽略 忽略 忽略
17 CODE:>code:cd CODE > 0 忽略 CODE > 0 CODE > 2 忽略 忽略
18 CODE:>code:{9} CODE > 0 CODE > 9 CODE >0 CODE > 9 CODE > 9 CODE > 9
19 CODE:code:cd CODE = 0 忽略 CODE = 2 CODE = 2 忽略 忽略
20 CODE:code:cd:{9} CODE = 0 CODE = 9 CODE = 0 CODE = 2 忽略 忽略
21 CODE:code|cd 只有code取值成功,当前条件才生效,注意与下一条的区别 CODE = 0 忽略 CODE =0 OR CODE = 2 忽略 忽略 忽略
22 CODE:code|{NULL} CODE = 0 OR CODE IS NULL 忽略 CODE = 0 OR CODE IS NULL 忽略
忽略
忽略
23 CODE:code|CODE:cd code与cd不相干,哪个有值取哪个 CODE = 0 忽略 CODE = 0 OR CODE = 1 CODE = 2 忽略 忽略
24 CODE:code|CD:cd 与上一条规则相同 CODE = 0 忽略 CODE = 0 OR CD = 2 CD = 2 忽略 忽略
25 CODE:code:cd|user
CODE = 0 忽略 CODE = 0 OR CODE = 5 CODE = 2 忽略 忽略
26 CODE:code:cd|{9}
CODE = 0
忽略 CODE = 0 OR CODE = 9 CODE = 2 OR CODE = 9 CODE = 9 CODE = 9
27 CODE:code+:{9} http参数值实际应该是密文 CODE = 9 CODE = 9 CODE = 9 CODE = 9 CODE = 0 CODE = 9
28 CODE:code+:cd:{9}code需要密文,cd需要明文 CODE = 9 CODE = 9 CODE = 2 CODE = 2 CODE = 0 CODE = 9
29 CODE:code+:cd+ 忽略
忽略
忽略
忽略
CODE = 0 CODE = 2
30 CODE:code|CODE:cd|CD:cd|CD:code CODE = 0 OR CD = 0 忽略 CODE =0 OR CODE = 2 OR ID =0 OR ID = 2 CODE =2 OR CD =2 忽略 忽略
31 CODE:code:{9}|CD:cd:{9} CODE = 0 OR CD = 9 CODE = 9 OR CD = 9 CODE = 0 OR CD = 2 CODE = 9 OR CD = 2 CODE = 9 OR CD = 9 CODE = 9 OR CD = 9

以上SQL在实际运行中以占位符?生成,类似CODE > '0'的条件实际是CODE > ?,java中通过 preapreStatement赋值,最终执行结果与数据类型有

忽略:表示合成SQL时不拼接当前查询条件

不执行:表示整个SQL不执行,querys返回长度为0的DataSet,query返回null

"+"开头表示必须条件,如果没有值传则生成CODE IS NULL的条件(仅"="时有效,其他IN,>时,当前条件忽略)

“++”开头时,如果没有传值则整个SQL不执行,返回长度为零的DataSet

其他文档