java动态条件查询sql语句
时间:2018-07-06 11:11:39
收藏:0
阅读:273
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>
*
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>
原文:http://blog.51cto.com/10972685/2136975
评论(0)