<?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.UserMapper">
<select id="findAll" resultType="user">
select * from user
</select>
<select id="findUser" resultType="user" parameterType="user">
select * from user
<where>
<if test="id!=null">
and id=#{id}
</if>
<if test="NAME!=''">
and NAME=#{NAME}
</if>
<if test="profession!=''">
and profession=#{profession}
</if>
</where>
</select>
<insert id="findAdd" parameterType="user">
insert into user set id=#{id},NAME=#{NAME},profession=#{profession}
</insert>
<delete id="SelectUser" parameterType="user">
delete from user where id=#{id}
</delete>
</mapper>
4.mapper包接口中的方法
public interface UserMapper {
public List<User> findAll();
public List<User> findUser(User user);
public void findAdministrator(Administrator administrator);
public void findAdd(User user);
public void SelectUser(User user);
}