<?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.platform.mapper.PlatformLogininforMapper">

	<resultMap type="com.ruoyi.platform.domain.vo.PlatformLogininforVO" id="SysLogininforResult">
		<id     property="id"        column="id"           />
		<result property="loginName"     column="login_name"        />
		<result property="status"        column="status"            />
		<result property="ipaddr"        column="ipaddr"            />
		<result property="loginLocation" column="login_location"    />
		<result property="browser"       column="browser"           />
		<result property="os"            column="os"                />
		<result property="msg"           column="msg"               />
		<result property="loginTime"     column="login_time"        />
	</resultMap>

	<select id="selectLogininforList" parameterType="com.ruoyi.platform.domain.dto.PlatformLogininforDTO" resultMap="SysLogininforResult">
		select id,login_name,ipaddr,login_location,browser,os,status,msg,login_time from platform_logininfor
		<where>
			<if test="ipaddr != null and ipaddr != ''">
				AND ipaddr like concat('%', #{ipaddr}, '%')
			</if>
			<if test="status != null and status != ''">
				AND status = #{status}
			</if>
			<if test="loginName != null and loginName != ''">
				AND login_name like concat('%', #{loginName}, '%')
			</if>
			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
				and date_format(login_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
			</if>
			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
				and date_format(login_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
			</if>
		</where>
	</select>

	<update id="cleanLogininfor">
		truncate table platform_logininfor
	</update>
    
</mapper> 