<!-- 保存项目信息 --> <insert id="saveItem" parameterType="pd" useGeneratedKeys="true" keyProperty="item_id"> <selectKey resultType="int" order="AFTER" keyProperty="item_id"> SELECT LAST_INSERT_ID() </selectKey> insert into busi_repairitem_info ( item_name,item_gongshi,item_danjia,create_name,modify_name,garage_id ) values ( #{item_name},#{item_gongshi},#{item_danjia},#{create_name},#{modify_name},#{garage_id} ) </insert>
这里是执行了插入语句之后,返回item_id到传入进来的pd对象中