双重预防项目-国泰新华二开定制版
SZH
2022-08-20 f9f0687195e0fe349185437d22c495d74c8d4a20
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?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="com.ruoyi.project.system.userLoginInfo.mapper.UserLoginInfoMapper">
    
    <resultMap type="UserLoginInfo" id="UserLoginInfoResult">
        <result property="userId"    column="user_id"    />
        <result property="loginIp"    column="login_ip"    />
        <result property="loginDate"    column="login_date"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="token"    column="token"    />
        <result property="deviceType"    column="device_type"    />
        <result property="deviceId"    column="device_id"    />
        <result property="appType"    column="app_type"    />
        <result property="loginName"    column="login_name"    />
        <result property="companyId"    column="company_id"    />
        <result property="companyName"    column="company_name"    />
        <result property="userName"    column="user_name"    />
    </resultMap>
 
    <sql id="selectUserLoginInfoVo">
        select userLoginInfo.user_id, userLoginInfo.login_ip, userLoginInfo.login_date,
        userLoginInfo.create_by, userLoginInfo.create_time, userLoginInfo.update_by, userLoginInfo.update_time,
        userLoginInfo.remark,
        userLoginInfo.token, userLoginInfo.device_type, userLoginInfo.device_id, userLoginInfo.app_type,
        userInfo.login_name,userInfo.company_id,userInfo.user_name,
        companyInfo.company_name
        from sys_user_login_info userLoginInfo
        left join sys_user userInfo
        on userLoginInfo.user_id = userInfo.user_id
        left join sys_company companyInfo
        on companyInfo.company_id = userInfo.company_id
    </sql>
 
    <select id="selectUserLoginInfoList" parameterType="UserLoginInfo" resultMap="UserLoginInfoResult">
        <include refid="selectUserLoginInfoVo"/>
        <where>  
            <if test="loginIp != null  and loginIp != ''"> and userLoginInfo.login_ip = #{loginIp}</if>
            <if test="loginDate != null "> and userLoginInfo.login_date = #{loginDate}</if>
            <if test="token != null  and token != ''"> and userLoginInfo.token = #{token}</if>
            <if test="deviceType != null  and deviceType != ''"> and userLoginInfo.device_type = #{deviceType}</if>
            <if test="deviceId != null  and deviceId != ''"> and userLoginInfo.device_id = #{deviceId}</if>
            <if test="appType != null  and appType != ''"> and userLoginInfo.app_type = #{appType}</if>
        </where>
    </select>
    
    <select id="selectUserLoginInfoById" parameterType="Long" resultMap="UserLoginInfoResult">
        <include refid="selectUserLoginInfoVo"/>
        where userLoginInfo.user_id = #{userId}
    </select>
        
    <insert id="insertUserLoginInfo" parameterType="UserLoginInfo">
        insert into sys_user_login_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null ">user_id,</if>
            <if test="loginIp != null  and loginIp != ''">login_ip,</if>
            <if test="loginDate != null ">login_date,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="remark != null  and remark != ''">remark,</if>
            <if test="token != null  and token != ''">token,</if>
            <if test="deviceType != null  and deviceType != ''">device_type,</if>
            <if test="deviceId != null  and deviceId != ''">device_id,</if>
            <if test="appType != null  and appType != ''">app_type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null ">#{userId},</if>
            <if test="loginIp != null  and loginIp != ''">#{loginIp},</if>
            <if test="loginDate != null ">#{loginDate},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
            <if test="token != null  and token != ''">#{token},</if>
            <if test="deviceType != null  and deviceType != ''">#{deviceType},</if>
            <if test="deviceId != null  and deviceId != ''">#{deviceId},</if>
            <if test="appType != null  and appType != ''">#{appType},</if>
         </trim>
    </insert>
 
    <update id="updateUserLoginInfo" parameterType="UserLoginInfo">
        update sys_user_login_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="loginIp != null  and loginIp != ''">login_ip = #{loginIp},</if>
            <if test="loginDate != null ">login_date = #{loginDate},</if>
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
            <if test="token != null  and token != ''">token = #{token},</if>
            <if test="deviceType != null  and deviceType != ''">device_type = #{deviceType},</if>
            <if test="deviceId != null  and deviceId != ''">device_id = #{deviceId},</if>
            <if test="appType != null  and appType != ''">app_type = #{appType},</if>
        </trim>
        where user_id = #{userId}
    </update>
 
    <delete id="deleteUserLoginInfoById" parameterType="Long">
        delete from sys_user_login_info where user_id = #{userId}
    </delete>
 
    <delete id="deleteUserLoginInfoByIds" parameterType="String">
        delete from sys_user_login_info where user_id in 
        <foreach item="userId" collection="array" open="(" separator="," close=")">
            #{userId}
        </foreach>
    </delete>
    
</mapper>