对学生表实现条件查询
1、创建学生映射器配置文件
<?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="net.zy.mybatis.mapper.StudentMapper">
<select id="findByCondition" parameterType="java.util.Map" resultMap="studentResultMap">
SELECT * FROM t_student
<trim prefix="WHERE" prefixOverrides="AND|OR">
<if test="name != null">
s_name Like CONCAT(#{name},'%')
</if>
<if test="gender != null">
AND s_gender = #{gender}
</if>
<if test="age != null">
AND s_age = #{age}
</if>
</trim>
</select>
<resultMap id="studentResultMap" type="Student">
<result column="s_id" property="id"/>
<result column="s_name" property