Mybatis学习第一天
<select id="selectUser" parameterType="User" resultType="User">select * from user
<where>
<if test="id!=0">
id = #{id}
</if>
<if test="name!=null">
andname like '%'||#{name}||'%'
</if>
</where>
</select>
其中,and是必须写的,如果id为0的时候,mybatis会自动将“and”过滤。
页:
[1]