1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <?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="test04.mapper.crud.EmpMapper"> <insert id="addEmp" databaseId="mysql" useGeneratedKeys="true" keyProperty="id"> insert into t_emp(last_name,email,gender) values(#{lastName},#{email},#{gender}) </insert> <insert id="addEmp2" databaseId="oracle"> <selectKey keyProperty="id" resultType="integer" order="BEFORE"> select emp_seq.nextval from dual </selectKey> insert into t_emp(id,last_name,email,gender) values(#{id},#{lastName},#{email},#{gender}) </insert> <insert id="addEmp3" databaseId="oracle"> <selectKey keyProperty="id" resultType="integer" order="AFTER"> select emp_seq.currentval from dual </selectKey> insert into t_emp(id,last_name,email,gender) values(emp_seq.nextval,#{lastName},#{email},#{gender}) </insert> <select id="getEmpById" resultType="emp" databaseId="mysql"> select * from t_emp where id = #{id} </select> <update id="updateEmp"> update t_emp set last_name=#{lastName},email=#{email},gender=#{gender} where id=#{id} </update> <delete id="deleteEmp"> delete from t_emp where id=#{id} </delete> <delete id="deleteEmp2"> delete from t_emp where id=#{id} </delete> </mapper>
|