-
admin
2024-05-17 1ccd6932893e47722574e6d1147e63b2ec4972c1
提交 | 用户 | 时间
e57a89 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="com.jcdm.system.mapper.SysLogininforMapper">
6
7     <resultMap type="SysLogininfor" id="SysLogininforResult">
8         <id     property="infoId"        column="info_id"           />
9         <result property="userName"      column="user_name"         />
10         <result property="status"        column="status"            />
11         <result property="ipaddr"        column="ipaddr"            />
12         <result property="loginLocation" column="login_location"    />
13         <result property="browser"       column="browser"           />
14         <result property="os"            column="os"                />
15         <result property="msg"           column="msg"               />
16         <result property="loginTime"     column="login_time"        />
17     </resultMap>
18
19     <insert id="insertLogininfor" parameterType="SysLogininfor">
20         insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time)
21         values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, getdate())
22     </insert>
23
24     <select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
25         select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from sys_logininfor
26         <where>
27             <if test="ipaddr != null and ipaddr != ''">
28                 AND ipaddr like concat('%', #{ipaddr}, '%')
29             </if>
30             <if test="status != null and status != ''">
31                 AND status = #{status}
32             </if>
33             <if test="userName != null and userName != ''">
34                 AND user_name like concat('%', #{userName}, '%')
35             </if>
36             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
37                 <!--                and <![CDATA[ login_time >= convert(datetime, #{params.beginTime}, 20)]]>-->
38                 and datediff(d, login_time, #{params.beginTime}) <![CDATA[<=]]> 0
39             </if>
40             <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
41                 <!--                and <![CDATA[ login_time <= convert(datetime, #{params.endTime}, 20)]]>-->
42                 and datediff(d, login_time, #{params.endTime}) <![CDATA[>=]]> 0
43             </if>
44         </where>
45         order by info_id desc
46     </select>
47
48     <delete id="deleteLogininforByIds" parameterType="Long">
49         delete from sys_logininfor where info_id in
50         <foreach collection="array" item="infoId" open="(" separator="," close=")">
51             #{infoId}
52         </foreach>
53     </delete>
54
55     <update id="cleanLogininfor">
56         truncate table sys_logininfor
57     </update>
58
59 </mapper>