mybatis里的页面的if标签怎么用
1个回答
2017-04-24
展开全部
<select id="selectUser" parameterType="com.test.entity.User" resultMap="BaseResultMap">
select <include refid="basesql"/> from users where 1=1
<if test="userid !=null">and userid=#{userid}</if>
<if test="username!=null">
and username like concat('%',#{username},'%')
</if>
<if test="age!=null">and age=#{age}</if>
</select>
select <include refid="basesql"/> from users where 1=1
<if test="userid !=null">and userid=#{userid}</if>
<if test="username!=null">
and username like concat('%',#{username},'%')
</if>
<if test="age!=null">and age=#{age}</if>
</select>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询