浏览代码

更新用户

xueyiming 8 月之前
父节点
当前提交
163d5fc358
共有 1 个文件被更改,包括 12 次插入9 次删除
  1. 12 9
      we-com-server/src/main/resources/mapper/UserMapper.xml

+ 12 - 9
we-com-server/src/main/resources/mapper/UserMapper.xml

@@ -116,17 +116,20 @@
             <include refid="Example_Where_Clause"/>
         </if>
     </delete>
-    <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.User">
+    <insert id="insert" parameterType="com.tzld.piaoquan.wecom.model.po.User" useGeneratedKeys="true" keyProperty="id">
         insert into we_com_user (id, external_user_id, union_id,
-                                 external_user_id_3rd_party, `type`, `name`,
-                                 avatar, gender,
-                                 created_at, updated_at, deleted_at,
-                                 create_time, update_time)
+        external_user_id_3rd_party, `type`, `name`,
+        avatar, gender,
+        created_at, updated_at, deleted_at,
+        create_time, update_time)
         values (#{id,jdbcType=BIGINT}, #{externalUserId,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR},
-                #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
-                #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER},
-                #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT},
-                #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+        #{externalUserId3rdParty,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
+        #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER},
+        #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{deletedAt,jdbcType=BIGINT},
+        #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+        <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
+            select LAST_INSERT_ID()
+        </selectKey>
     </insert>
     <insert id="insertSelective" parameterType="com.tzld.piaoquan.wecom.model.po.User">
         insert into we_com_user