2024-10-18 22:25:41 +08:00
|
|
|
<?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="cn.bunny.services.mapper.UserLoginLogMapper">
|
|
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.log.UserLoginLog">
|
2024-10-19 00:05:01 +08:00
|
|
|
<id column="id" property="id"/>
|
|
|
|
<id column="create_time" property="createTime"/>
|
|
|
|
<id column="update_time" property="updateTime"/>
|
|
|
|
<id column="create_user" property="createUser"/>
|
|
|
|
<id column="update_user" property="updateUser"/>
|
|
|
|
<id column="is_deleted" property="isDeleted"/>
|
|
|
|
<id column="user_id" property="userId"/>
|
|
|
|
<id column="username" property="username"/>
|
|
|
|
<id column="token" property="token"/>
|
|
|
|
<id column="ip_address" property="ipAddress"/>
|
2024-10-19 02:37:30 +08:00
|
|
|
<id column="ip_region" property="ipRegion"/>
|
2024-10-19 00:05:01 +08:00
|
|
|
<id column="user_agent" property="userAgent"/>
|
2024-10-19 02:37:30 +08:00
|
|
|
<id column="type" property="type"/>
|
|
|
|
<id column="x_requested_with" property="xRequestedWith"/>
|
2024-10-18 22:25:41 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
|
|
<sql id="Base_Column_List">
|
2024-10-23 13:46:19 +08:00
|
|
|
id, create_time, update_time, create_user, update_user, is_deleted, user_id, username, token, ip_address, ip_region, user_agent, type, x_requested_with
|
2024-10-18 22:25:41 +08:00
|
|
|
</sql>
|
|
|
|
|
2024-10-18 23:09:29 +08:00
|
|
|
<!-- 分页查询用户登录日志内容 -->
|
|
|
|
<select id="selectListByPage" resultType="cn.bunny.dao.entity.log.UserLoginLog">
|
|
|
|
select
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from log_user_login
|
|
|
|
<where>
|
2024-10-24 23:39:09 +08:00
|
|
|
is_deleted = 0
|
2024-10-19 00:05:01 +08:00
|
|
|
<if test="dto.username != null and dto.username != ''">
|
|
|
|
and username like CONCAT('%',#{dto.username},'%')
|
|
|
|
</if>
|
|
|
|
<if test="dto.ipAddress != null and dto.ipAddress != ''">
|
|
|
|
and ip_address like CONCAT('%',#{dto.ipAddress},'%')
|
|
|
|
</if>
|
2024-10-19 02:37:30 +08:00
|
|
|
<if test="dto.ipRegion != null and dto.ipRegion != ''">
|
|
|
|
and ip_region like CONCAT('%',#{dto.ipRegion},'%')
|
|
|
|
</if>
|
|
|
|
<if test="dto.type != null and dto.type != ''">
|
|
|
|
and type like CONCAT('%',#{dto.type},'%')
|
|
|
|
</if>
|
|
|
|
<if test="dto.xRequestedWith != null and dto.xRequestedWith != ''">
|
|
|
|
and x_requested_with like CONCAT('%',#{dto.xRequestedWith},'%')
|
|
|
|
</if>
|
2024-10-18 23:09:29 +08:00
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
2024-10-22 10:59:18 +08:00
|
|
|
<!-- 分页查询根据用户Id用户登录日志内容 -->
|
|
|
|
<select id="selectListByPageWithLocalUser" resultType="cn.bunny.dao.entity.log.UserLoginLog">
|
|
|
|
select
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
from log_user_login where user_id = #{id} order by create_time desc
|
|
|
|
</select>
|
|
|
|
|
2024-10-18 23:09:29 +08:00
|
|
|
<!-- 物理删除用户登录日志 -->
|
|
|
|
<delete id="deleteBatchIdsWithPhysics">
|
|
|
|
delete
|
|
|
|
from log_user_login
|
|
|
|
where id in
|
|
|
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
|
2024-10-18 22:25:41 +08:00
|
|
|
</mapper>
|