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