SysAuthUserMapper.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="org.dromara.system.mapper.SysUserMapper">
  6. <resultMap id="SysAuthUserResult" type="org.dromara.system.domain.SysAuthUser">
  7. <id property="authId" column="auth_id" />
  8. <result property="uuid" column="uuid" />
  9. <result property="userId" column="user_id" />
  10. <result property="userName" column="user_name" />
  11. <result property="nickName" column="nick_name" />
  12. <result property="avatar" column="avatar" />
  13. <result property="email" column="email" />
  14. <result property="source" column="source" />
  15. <result property="createTime" column="create_time" />
  16. </resultMap>
  17. <select id="selectAuthUserByUuid" parameterType="String" resultMap="SysUserResult">
  18. select b.user_id as user_id, b.user_name as user_name, b.password as password , a.tenant_id as tenant_id
  19. from sys_auth_user a left join sys_user b on a.user_id = b.user_id
  20. where a.uuid = #{uuid} and b.del_flag = '0'
  21. </select>
  22. <select id="selectAuthUserListByUserId" parameterType="Long" resultMap="SysAuthUserResult">
  23. select auth_id, uuid, user_id, user_name, nick_name, avatar, email, source, create_time, tenant_id from sys_auth_user where user_id = #{userId}
  24. </select>
  25. <select id="checkAuthUser" parameterType="org.dromara.system.domain.SysAuthUser" resultType="int">
  26. select count(1) from sys_auth_user where user_id=#{userId} and source=#{source} limit 1
  27. </select>
  28. <insert id="insertAuthUser" parameterType="org.dromara.system.domain.SysAuthUser">
  29. insert into sys_auth_user(
  30. <if test="uuid != null and uuid != ''">uuid,</if>
  31. <if test="userId != null and userId != 0">user_id,</if>
  32. <if test="userName != null and userName != ''">user_name,</if>
  33. <if test="nickName != null and nickName != ''">nick_name,</if>
  34. <if test="avatar != null and avatar != ''">avatar,</if>
  35. <if test="email != null and email != ''">email,</if>
  36. <if test="source != null and source != ''">source,</if>
  37. create_time
  38. )values(
  39. <if test="uuid != null and uuid != ''">#{uuid},</if>
  40. <if test="userId != null and userId != 0">#{userId},</if>
  41. <if test="userName != null and userName != ''">#{userName},</if>
  42. <if test="nickName != null and nickName != ''">#{nickName},</if>
  43. <if test="avatar != null and avatar != ''">#{avatar},</if>
  44. <if test="email != null and email != ''">#{email},</if>
  45. <if test="source != null and source != ''">#{source},</if>
  46. now()
  47. )
  48. </insert>
  49. <delete id="deleteAuthUser" parameterType="Long">
  50. delete from sys_auth_user where auth_id = #{authId}
  51. </delete>
  52. </mapper>