feat: Implement pagination and effective account validation for backdoor user login
This commit is contained in:
@@ -23,6 +23,14 @@ public interface SysUserMapper
|
||||
*/
|
||||
List<SysUser> selectBackDoorUserList(@Param("keyword") String keyword, @Param("limit") int limit);
|
||||
|
||||
/**
|
||||
* 查询指定账号在后门登录规则下的最新有效用户 ID。
|
||||
*
|
||||
* @param userName 用户账号
|
||||
* @return 最新未删除记录的用户 ID
|
||||
*/
|
||||
Long selectBackDoorEffectiveUserId(@Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
|
||||
@@ -75,12 +75,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
u.app_user_id,
|
||||
u.lc_userid,
|
||||
d.dept_name
|
||||
from sys_user u
|
||||
from (
|
||||
select source_user.*,
|
||||
row_number() over (
|
||||
partition by source_user.user_name
|
||||
order by source_user.create_time desc nulls last, source_user.user_id desc
|
||||
) as account_rank
|
||||
from sys_user source_user
|
||||
where source_user.del_flag = '0'
|
||||
and source_user.user_name is not null
|
||||
and source_user.user_name != ''
|
||||
) u
|
||||
left join sys_dept d on d.dept_id = u.dept_id
|
||||
where u.del_flag = '0'
|
||||
where u.account_rank = 1
|
||||
and u.status = '0'
|
||||
and u.user_name is not null
|
||||
and u.user_name != ''
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and (
|
||||
cast(u.user_id as varchar) like concat('%', cast(#{keyword} as varchar), '%')
|
||||
@@ -93,6 +101,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
u.user_id desc
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectBackDoorEffectiveUserId" resultType="java.lang.Long">
|
||||
select u.user_id
|
||||
from sys_user u
|
||||
where u.del_flag = '0'
|
||||
and u.user_name = #{userName}
|
||||
order by u.create_time desc nulls last, u.user_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
|
||||
Reference in New Issue
Block a user