2024-02-20 18:11:48 +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="com.securitycontrol.system.mapper.LoginMapper">
|
|
|
|
|
<update id="updateUserLogin">
|
|
|
|
|
update sys_user set
|
|
|
|
|
login_ip=#{ip},login_time=now() where user_id=#{userId}
|
|
|
|
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<!--查询用户角色-->
|
|
|
|
|
<select id="selectUserByUserName" parameterType="String" resultType="com.securitycontrol.system.api.domain.SysUser">
|
|
|
|
|
select user_id userId,user_name userName,login_name nickName,
|
|
|
|
|
`password`,org_id,dept_name deptName,org_name orgName,is_admin,role_id roleId,
|
|
|
|
|
user_type userType,login_type loginType,status,
|
|
|
|
|
role_name roleName,phone,su.login_ip loginIp,su.login_name login_time
|
|
|
|
|
FROM sys_user su
|
|
|
|
|
where su.del_flag=0 AND su.login_name=#{username}
|
|
|
|
|
</select>
|
|
|
|
|
<!--查询用户已分配的权限-->
|
|
|
|
|
<select id="getMenuPermission" parameterType="com.securitycontrol.system.api.domain.SysUser" resultType="String">
|
|
|
|
|
select DISTINCT sm.menu_auth
|
|
|
|
|
FROM sys_user su
|
|
|
|
|
left join sys_role_menu srm on srm .role_id=su.role_id
|
2024-03-01 18:04:49 +08:00
|
|
|
left join sys_menu sm on sm.menu_id=srm.menu_id and sm.menu_type=2 AND sm.del_flag=0
|
2024-02-20 18:11:48 +08:00
|
|
|
where su.user_id=#{userId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getAllMenuList" resultType="com.securitycontrol.system.api.domain.decision.SysMenu">
|
2024-03-12 13:20:40 +08:00
|
|
|
select sm.menu_url url,sm.menu_id menuId,sm.menu_name menuName,sm.menu_logo AS icon,sm.menu_auth AS menuAuth
|
2024-02-20 18:11:48 +08:00
|
|
|
FROM sys_user su
|
|
|
|
|
left join sys_role_menu srm on srm .role_id=su.role_id
|
2024-03-01 18:04:49 +08:00
|
|
|
left join sys_menu sm on sm.menu_id=srm.menu_id and sm.del_flag=0 and (sm.menu_type=0 or sm.menu_type=1)
|
2024-02-20 18:11:48 +08:00
|
|
|
where su.user_id=#{userId} and sm.p_id=#{pid}
|
|
|
|
|
ORDER BY sm.menu_sort ASC
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|