Files
peipei-backend/play-admin/target/classes/mapper/system/SysLoginLogMapper.xml
2024-03-22 16:46:41 +08:00

70 lines
2.6 KiB
XML

<?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.starry.admin.modules.system.mapper.SysLoginLogMapper">
<resultMap type="com.starry.admin.modules.system.entity.SysLoginLogEntity" id="XlLoginLogResult">
<result property="loginId" column="login_id"/>
<result property="userCode" column="user_code"/>
<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="status" column="status"/>
<result property="loginTime" column="login_time"/>
<result property="updatedTime" column="updated_time"/>
<result property="updatedBy" column="updated_by"/>
<result property="createdTime" column="created_time"/>
<result property="createdBy" column="created_by"/>
<result property="deleted" column="deleted"/>
<result property="version" column="version"/>
</resultMap>
<sql id="selectXlLoginLogVo">
select login_id,
user_code,
ipaddr,
login_location,
browser,
os,
msg,
status,
login_time,
updated_time,
updated_by,
created_time,
created_by,
deleted,
version
from sys_login_log
</sql>
<select id="selectXlLoginLogList" resultMap="XlLoginLogResult">
<include refid="selectXlLoginLogVo"/>
<where>
deleted = 0
</where>
<if test="vo.ipaddr != null and vo.ipaddr != ''">
AND ipaddr = #{vo.ipaddr}
</if>
<if test="vo.beginTime != null and vo.beginTime != ''">
<!-- 开始时间检索 -->
AND date_format(login_time,'%y%m%d') &gt;= date_format(#{vo.beginTime},'%y%m%d')
</if>
<if test="vo.endTime != null and vo.endTime != ''">
<!-- 结束时间检索 -->
AND date_format(login_time,'%y%m%d') &lt;= date_format(#{vo.endTime},'%y%m%d')
</if>
order by login_id desc
</select>
<select id="selectXlLoginLogByLoginId" parameterType="Long" resultMap="XlLoginLogResult">
<include refid="selectXlLoginLogVo"/>
where login_id = #{loginId}
</select>
<update id="cleanLoginlog">
truncate table sys_login_log
</update>
</mapper>