java动态条件查询sql语句

select
*
from
table
where
1=1
<if test="tUserId!=null and tUserId!=''">
and t_user_id=#{tUserId}
</if>
<if test="toolCode!=null and toolCode!=''">
and .tool_code=#{toolCode}
</if>
<if test="workCode!=null and workCode!=''">
and work_code=#{workCode}
</if>
<if test="bDate!=null and bDate!=''">
and b_date>#{bDate}
</if>

猜你喜欢

转载自blog.51cto.com/10972685/2136975
今日推荐