test.xml 867 Bytes
<?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.canrd.patent.dal.mapper.TestMapper">
    <select id="finds" resultType="TestModel"><![CDATA[
SELECT
	id, name,age
FROM test
]]></select>
    <insert id="add" parameterType="com.canrd.patent.dal.model.TestModel">
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
		   select LAST_INSERT_ID()
	    </selectKey>
        insert into test(name,age)
        values(#{name},#{age})
    </insert>

    <delete id="delete" parameterType="int">
        delete from test where id=#{id}
    </delete>

    <update id="update" parameterType="com.canrd.patent.dal.mapper.TestMapper">
        update test set name=#{name},age=#{age}
        where id=#{id}
    </update>
</mapper>