<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.mybatis.example.userMapper">
<!-- 多条件查询,name模糊匹配,age在最小值和最大值之间 -->
<select id="getUser" parameteType="ConditionUser" resultType="User">
select * from user where
<if test='name!="%null%"'>
name like #{name} and
</if>
age between #{minAge} and #{maxAge}
</select>
</mapper>
动态SQL与模糊查询
最新推荐文章于 2024-08-01 15:59:14 发布