feat: 统一角色枚举 (meetingExecutor/supervisor) + 子账号数据隔离 + Login 读取后端 role_type
后端:
- SysUser 加 roleType 字段 (entity + mapper selectUserVo + service 接口/实现)
- SysUserMapper 新增 selectUserIdsByParent (按 parent_user_id 取子账号列表)
- BizPersonController.list 自动注入 MAIN 业务用户可见性: 仅查 user_id IN (子账号列表)
- BizPersonMapper 加 params.subUserIds foreach 过滤
- BizPerson/BizPersonServiceImpl 配合 getParams().put
前端:
- Login.vue 改用后端 sys_user.roleType 替代 username 前缀 autoRole, 修复 exe01 错入 leader 菜单
- utils/roleMap.js 新增: meetingExecutor->会议执行, supervisor->监察员
- executor/People.vue / sponsor/NewPerson.vue / sponsor/Projects.vue / sponsor/SponsorProjects.vue /
manager/ManagerProjectDetail.vue / manager/{Executor,Sponsor}PersonNew.vue /
admin/{Executor,Sponsor}PersonNew.vue 全部改为 enum key
SQL:
- migration_unify_role_type_2026_08_16.sql 清洗 biz_person.role 从中文到 enum key
This commit is contained in:
@@ -4,22 +4,31 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.vo.SysUserExtendVo;
|
||||
|
||||
/**
|
||||
* 用户表 数据层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysUserMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUserList(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表(扩展视图, 附带业务角色 roleType)
|
||||
*
|
||||
* @param vo 查询条件, roleType 非空时按 sys_user.role_type 过滤
|
||||
* @return 用户扩展视图集合
|
||||
*/
|
||||
public List<SysUserExtendVo> selectUserExtendList(SysUserExtendVo vo);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
@@ -89,7 +98,7 @@ public interface SysUserMapper
|
||||
|
||||
/**
|
||||
* 更新用户登录信息(IP和登录时间)
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param loginIp 登录IP地址
|
||||
* @param loginDate 登录时间
|
||||
@@ -145,4 +154,12 @@ public interface SysUserMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique(String email);
|
||||
|
||||
/**
|
||||
* 通过主账号 user_id 查询所有子账号 user_id (sys_user.parent_user_id)
|
||||
*
|
||||
* @param parentUserId 主账号 user_id
|
||||
* @return 子账号 user_id 集合
|
||||
*/
|
||||
public List<Long> selectUserIdsByParent(@Param("parentUserId") Long parentUserId);
|
||||
}
|
||||
|
||||
@@ -3,22 +3,31 @@ package com.ruoyi.system.service;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.vo.SysUserExtendVo;
|
||||
|
||||
/**
|
||||
* 用户 业务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysUserService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUserList(SysUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表(扩展视图, 附带 sys_user.roleType 业务角色)
|
||||
*
|
||||
* @param vo 查询条件
|
||||
* @return 用户扩展视图集合
|
||||
*/
|
||||
public List<SysUserExtendVo> selectUserExtendList(SysUserExtendVo vo);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
@@ -214,10 +223,10 @@ public interface ISysUserService
|
||||
public boolean isPhoneRegistered(String phone);
|
||||
|
||||
/**
|
||||
* 更新 sys_user.role_type (DB 列, entity 无字段)
|
||||
* 更新 sys_user.role_type (业务角色: admin/leader/manager/doctor/executor/sponsor)
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleType 角色类型 (admin/leader/manager/doctor/executor/sponsor)
|
||||
* @param roleType 角色类型
|
||||
* @return 影响行数
|
||||
*/
|
||||
public int updateRoleType(Long userId, String roleType);
|
||||
|
||||
+15
-1
@@ -23,6 +23,7 @@ import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.domain.vo.SysUserExtendVo;
|
||||
import com.ruoyi.system.mapper.SysPostMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
@@ -68,7 +69,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@@ -79,6 +80,19 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
return userMapper.selectUserList(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表(扩展视图, 附带 sys_user.roleType 业务角色)
|
||||
*
|
||||
* @param vo 查询条件
|
||||
* @return 用户扩展视图集合
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUserExtendVo> selectUserExtendList(SysUserExtendVo vo)
|
||||
{
|
||||
return userMapper.selectUserExtendList(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
|
||||
@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="accountType" column="account_type" />
|
||||
<result property="parentUserId" column="parent_user_id" />
|
||||
<result property="roleType" column="role_type" />
|
||||
<result property="email" column="email" />
|
||||
<result property="phonenumber" column="phonenumber" />
|
||||
<result property="sex" column="sex" />
|
||||
@@ -48,9 +49,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="dataScope" column="data_scope" />
|
||||
<result property="status" column="role_status" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 用户扩展视图 resultMap: 继承 SysUserResult, 附加 sys_user.role_type 业务角色 -->
|
||||
<resultMap type="SysUserExtendVo" id="SysUserExtendResult" extends="SysUserResult">
|
||||
<result property="roleType" column="u_role_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.account_type, u.parent_user_id, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.update_by, u.update_time, u.remark,
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.account_type, u.parent_user_id, u.role_type, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.update_by, u.update_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
@@ -87,6 +93,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<!--
|
||||
用户列表扩展查询: 业务角色从 sys_user.role_type 直接读 (2026-08-16 重构, 删 biz_user_role_bind)
|
||||
-->
|
||||
<select id="selectUserExtendList" parameterType="SysUserExtendVo" resultMap="SysUserExtendResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.update_by, u.update_time, u.remark, d.dept_name, d.leader,
|
||||
u.role_type as u_role_type
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
AND u.user_id = #{userId}
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
|
||||
</if>
|
||||
<if test="roleType != null and roleType != ''"><!-- 业务角色过滤 -->
|
||||
AND u.role_type = #{roleType}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
@@ -194,6 +237,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="roleType != null and roleType != ''">role_type = #{roleType},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
@@ -231,7 +275,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update sys_user set del_flag = '2' where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<!--
|
||||
通过主账号 user_id 查询所有子账号 user_id (sys_user.parent_user_id)
|
||||
用于 biz_person 列表按"主账号隔离"过滤
|
||||
-->
|
||||
<select id="selectUserIdsByParent" resultType="java.lang.Long">
|
||||
select user_id from sys_user where parent_user_id = #{parentUserId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user