mybatis (mapper mapping file)

 

 

 

<!-- parameterType: parameter type, can be omitted,
    Get the value of the auto-incrementing primary key:
        mysql supports self-incrementing primary keys and the acquisition of self-incrementing primary key values. Mybatis also uses statement.getGeneratedKeys();
        useGeneratedKeys = "true" ; use the auto-incrementing primary key to get the primary key value strategy
        keyProperty; specifies the corresponding primary key property, that is, after mybatis obtains the primary key value, which property of javaBean encapsulates this value to
    -->
    <insert id="addEmp" parameterType="com.atguigu.mybatis.bean.Employee"
        useGeneratedKeys="true" keyProperty="id" databaseId="mysql">
        insert into tbl_employee(last_name,email,gender)
        values(#{lastName},#{email},#{gender})
    </insert>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325823645&siteId=291194637