mybatis 查询条件
- 作者: 说不出LVE
- 来源: 51数据库
- 2020-10-03
mybatis中多条件删除例子如下: delete from tb_duty where ( dscd=#{item.dscd}, and unit_id=#{item.unitid}, and year=#{item.year}, and month=#{item.month}, and flag=#{item.flag} )
当然可以
select id, name, password
from user
where 1=1
<if test="id != null" > and id=#{id}</if>
<if test="name != null" > and name=#{name}</if>
<if test="password != null" >and password=#{password}</if>
当然可以
select id, name, password
from user
where 1=1
<if test="id != null" > and id=#{id}</if>
<if test="name != null" > and name=#{name}</if>
<if test="password != null" >and password=#{password}</if>
推荐阅读