SSM模糊查询配合动态SQL语句

SSM里面写动态的模糊查询语句,当没有条件时则查全部,根据条件查询。

<select id="findAll" parameterType="string">
		select * from employee 
		<where>
			<if test="name != null">
				name like concat('%', #{name}, '%')
			</if>
		</where>
</select>

以上代码就是一条最简单的动态SQL查询语句。

发布了15 篇原创文章 · 获赞 11 · 访问量 2797

猜你喜欢

转载自blog.csdn.net/YCarlos/article/details/99484713