exists
最后更新:2024-09-29 05:30:06
|
状态:未完成
如果比较简单可以直接放到query方法参数中
service.query("SSO_USER AS M", "exists(SELECT * FROM HR_USER AS H WHERE H.ID = M.ID)")
如果exists比较复杂,如涉及到动态条件可以先构造RunPrepare
生成SQL
service.query("SSO_USER AS M", "exists(SELECT * FROM HR_USER AS H WHERE H.ID = M.ID)")
如果exists比较复杂,如涉及到动态条件可以先构造RunPrepare
TableBuilder builder = TableBuilder.init("HR_USER AS H"); RunPrepare prepare = builder.build(); ConfigStore cfs = prepare.condition(); cfs.and("H.ID = F.ID"); cfs.and("H.CODE", ""); cfs.and("H.ID", 100); ConfigStore configs = new DefaultConfigStore(); configs.exists(prepare); Table table = new Table("FI_USER"); table.setAlias("F"); ServiceProxy.querys(table, configs);
生成SQL
SELECT * FROM FI_USER AS F WHERE EXISTS( SELECT * FROM HR_USER AS H WHERE (H.ID = F.ID AND H.ID = ?) ) ] [param: param0=100(java.lang.Integer)