我是这样解决的:select userName from users where userId > 0 and 别的条件。如果你要通用的,也可以在这样写:
select userName from ysers where 1=1 and 条件
根本不是这么写的啊。。。。mybatis这个建议你去看看教程。
正常的格式是用这个自带的isNotEmpty来进行判断的
AND t1.id = #{id}
用trim 去除 前缀第一个and 或者or
用
格式是这样,每一个if格式都是这样,由于手机手打,就不写全了
Where mechanismCode is not null and m.mechanism_code=#{mechanismCode}