<?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="com.nantian.mybatis.dynamicsql.StudentMapper">
<resultMap type="Student" id="student">
<id property="id" column="s_id" javaType="int" jdbcType="INTEGER"/>
<result property="name" column="s_name" javaType="string" jdbcType="VARCHAR"/>
</resultMap>
<select id="dynamicQuery" parameterType="Student" resultMap="student">
select s_id,s_name from student where s_id = #{id}
<if test="name != null">
and s_name like '%${name}%'
</if>
</select>
<select id="">
<where>
<choose>
<when test=""></when>
<otherwise></otherwise>
</choose>
</where>
</select>
</mapper>