mysql insert返回值插入后的id

方法1:

    
        insert into person(name,pswd) values(#{name},#{pswd})
    

 

方法2:

<insert id="insert" parameterType="com.xinrong.entity.member.DreamNexusDo" >
  <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
    SELECT LAST_INSERT_ID()
  selectKey>
  insert into u_dream_nexus (UID, SUB_UID, CREATE_TIME, 
    START_TIME, END_TIME, REWARD_RATE
    )
          values (#{uid,jdbcType=INTEGER}, #{subUid,jdbcType=INTEGER}, #        {createTime,jdbcType=TIMESTAMP}, 
           #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #   {rewardRate,jdbcType=DECIMAL}
    )
insert>

方法3: 

insert into addeditemgroup(addeditemgroupname) value('11') ; select @@IDENTITY  as id;

你可能感兴趣的:(MySQL)