<?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：命名空间，随便写，一般保证命名空间唯一 -->
<mapper namespace="MyMapper">
   <!-- statement，内容：sql语句。id：唯一标识，随便写，在同一个命名空间下保持唯一
      resultType：sql语句查询结果集的封装类型,tb_user即为数据库中的表
    -->
   <select id="selectUser" resultType="com.cesgroup.mybatiswork.entity.User">
      select * from mybatis where id = #{id}
   </select>
   <insert id="insert" parameterType="com.cesgroup.mybatiswork.entity.User">
    INSERT INTO mybatis (id, name, info)
          VALUES(#{id}, #{name}, #{info})
</insert>
<insert id="insertBatch">
    INSERT INTO mybatis
            (id, name, info)
    VALUES
    <foreach collection ="list" item="user" separator =",">
         (#{user.id}, #{user.name}, #{user.info})
    </foreach >
</insert>
</mapper>