|
@@ -225,47 +225,52 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 创建用户 -->
|
|
<!-- 创建用户 -->
|
|
- <insert id="insertUser" parameterType="com.backendsys.entity.System.SysUserDTO"
|
|
|
|
- useGeneratedKeys="true" keyProperty="id">
|
|
|
|
- INSERT INTO sys_user (
|
|
|
|
- password
|
|
|
|
- <if test="username != null and username != ''">, username</if>
|
|
|
|
- <if test="phone != null and phone != ''">, phone</if>
|
|
|
|
- <if test="phone_area_code != null and phone_area_code != ''">, phone_area_code</if>
|
|
|
|
|
|
+ <insert id="insertUser" parameterType="com.backendsys.entity.System.SysUserDTO" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
+ INSERT INTO sys_user (password
|
|
|
|
+ <if test="username != null and username != ''">, username</if>
|
|
|
|
+ <if test="phone != null and phone != ''">, phone</if>
|
|
|
|
+ <if test="phone_area_code != null and phone_area_code != ''">, phone_area_code</if>
|
|
)
|
|
)
|
|
- VALUES (
|
|
|
|
- #{password}
|
|
|
|
- <if test="username != null and username != ''">, #{username}</if>
|
|
|
|
- <if test="phone != null and phone != ''">, #{phone}</if>
|
|
|
|
- <if test="phone_area_code != null and phone_area_code != ''">, #{phone_area_code}</if>
|
|
|
|
|
|
+ VALUES (#{password}
|
|
|
|
+ <if test="username != null and username != ''">, #{username}</if>
|
|
|
|
+ <if test="phone != null and phone != ''">, #{phone}</if>
|
|
|
|
+ <if test="phone_area_code != null and phone_area_code != ''">, #{phone_area_code}</if>
|
|
);
|
|
);
|
|
SET @last_user_id = LAST_INSERT_ID();
|
|
SET @last_user_id = LAST_INSERT_ID();
|
|
|
|
|
|
INSERT INTO sys_user_info (user_id
|
|
INSERT INTO sys_user_info (user_id
|
|
- <if test="nickname != null and nickname != ''">, nickname</if>
|
|
|
|
- <if test="email != null and email != ''">, email</if>
|
|
|
|
- <if test="gender != null and gender != ''">, gender</if>
|
|
|
|
- <if test="avatar != null and avatar != ''">, avatar</if>
|
|
|
|
- <if test="status != null and status != ''">, status</if>
|
|
|
|
- <if test="invite_code != null and invite_code != ''">, invite_code</if>
|
|
|
|
|
|
+ <if test="nickname != null and nickname != ''">, nickname</if>
|
|
|
|
+ <if test="email != null and email != ''">, email</if>
|
|
|
|
+ <if test="gender != null and gender != ''">, gender</if>
|
|
|
|
+ <if test="avatar != null and avatar != ''">, avatar</if>
|
|
|
|
+ <if test="status != null and status != ''">, status</if>
|
|
|
|
+ <if test="invite_code != null and invite_code != ''">, invite_code</if>
|
|
) VALUES (@last_user_id
|
|
) VALUES (@last_user_id
|
|
- <if test="nickname != null and nickname != ''">, #{nickname}</if>
|
|
|
|
- <if test="email != null and email != ''">, #{email}</if>
|
|
|
|
- <if test="gender != null and gender != ''">, #{gender}</if>
|
|
|
|
- <if test="avatar != null and avatar != ''">, #{avatar}</if>
|
|
|
|
- <if test="status != null and status != ''">, #{status}</if>
|
|
|
|
- <if test="invite_code != null and invite_code != ''">, #{invite_code}</if>
|
|
|
|
|
|
+ <if test="nickname != null and nickname != ''">, #{nickname}</if>
|
|
|
|
+ <if test="email != null and email != ''">, #{email}</if>
|
|
|
|
+ <if test="gender != null and gender != ''">, #{gender}</if>
|
|
|
|
+ <if test="avatar != null and avatar != ''">, #{avatar}</if>
|
|
|
|
+ <if test="status != null and status != ''">, #{status}</if>
|
|
|
|
+ <if test="invite_code != null and invite_code != ''">, #{invite_code}</if>
|
|
);
|
|
);
|
|
|
|
|
|
- <if test="roles != null and roles.size() > 0">
|
|
|
|
|
|
+ <if test="role_id != null and role_id.size() > 0">
|
|
INSERT INTO sys_user_role_relation (user_id, role_id)
|
|
INSERT INTO sys_user_role_relation (user_id, role_id)
|
|
VALUES
|
|
VALUES
|
|
- <foreach collection="roles" item="role" separator=",">
|
|
|
|
- (@last_user_id, #{role.id})
|
|
|
|
|
|
+ <foreach collection="role_id" item="id" separator=",">
|
|
|
|
+ (@last_user_id, #{id})
|
|
</foreach>
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
|
|
+<!-- <if test="roles != null and roles.size() > 0">-->
|
|
|
|
+<!-- INSERT INTO sys_user_role_relation (user_id, role_id)-->
|
|
|
|
+<!-- VALUES-->
|
|
|
|
+<!-- <foreach collection="roles" item="role" separator=",">-->
|
|
|
|
+<!-- (@last_user_id, #{role.id})-->
|
|
|
|
+<!-- </foreach>-->
|
|
|
|
+<!-- </if>-->
|
|
|
|
+
|
|
<!-- 编辑 用户信息 -->
|
|
<!-- 编辑 用户信息 -->
|
|
<update id="updateUserInfo" parameterType="com.backendsys.entity.System.SysUserDTO">
|
|
<update id="updateUserInfo" parameterType="com.backendsys.entity.System.SysUserDTO">
|
|
UPDATE sys_user_info SET
|
|
UPDATE sys_user_info SET
|