select count(*) from o_org where( case when ?='条件' and org_no='43101' then 1 when ?!='条件' then 1 else 0 end )=1
两个条件相同 ,? 是参数的值 ,通过对?值的判断 动态添加条件 org_no='43101'
select * from o_org where( case when 1='1' and org_no='43101' then 1 when 1!='1' then 1 else 0 end )=1
只查到 org_No =‘43101’ 这条记录
相当于select * from o_org where org_no='43101'
------------------------------
select count(*) from o_org where( case when 2='1' and org_no='43101' then 1 when 2!='1' then 1 else 0 end )=1
如果不等于1 就相当于查询所有的记录