关于几种OR条件查询的情况
最后更新:2023-10-18 21:02:28
|
状态:未完成
//以下三种格式,只有cd取值成功时,条件才生效 //当cd=1,id=2时 WHERE CODE = 1 OR CODE =2 //当cd=null,id=2时 条件不生效 //当cd=1,id=null时 WHERE CODE = 1 service.querys("HR_USER", condition("CODE:cd|id")); //当cd=1时 WHERE CODE =1 OR CODE = 9 //当cd=null时 条件不生效 service.querys("HR_USER", condition("CODE:cd|{9}")); //当cd=1时 WHERE CODE =1 OR CODE IS NULL //当cd=null时 条件不生效 service.querys("HR_USER", condition("CODE:cd|{NULL}"));
//当type=1,dept=null时 WHERE TYPE_CODE = 1 //当type=1,dept=2时 WHERE TYPE_CODE =1 OR DEPT_ID =2 //当type=null,dept=2时 WHERE DEPT_ID = 2 service.querys("HR_USER", condition("TYPE_CODE:type|DEPT_ID:dept"));
//依次取c1,c2的值,如果c1取值成功则忽略c2,如果都失败则取默认值9 service.querys("HR_USER", condition("CODE:c1:c2:{9}"));