如果条件是2就在sql条件后拼接and B='${B}',
${if(条件=0,"and b='"+B+"'","")}
where 1=1 ${if(条件1," and a='"+A+"'"," and b='"+b+"'")}
select * from 表 where 1=1
${if(参数='1','" and A='"+A+"'"," and B='"+B+"'")}
select * from table
where 1=1
${if(a=1,"and a='"+A+"'",if(a=2,"and b='"+B+"'",""))}