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:
郭庆泰
2026-08-16 13:41:42 +08:00
parent cf5790229a
commit c612d4297a
22 changed files with 1211 additions and 112 deletions
@@ -23,16 +23,16 @@
</resultMap>
<sql id="selectFields">
select person_id, name, phone, org_id, department, position, role, unit_type, status, del_flag, user_id, create_by, create_time, update_by, update_time
select person_id, name, phone, org_id, department, position, role, unit_type, user_id, create_by, create_time, update_by, update_time
from biz_person
</sql>
<!-- 通用列表: LEFT JOIN biz_org 取公司名/类型, LEFT JOIN sys_user 取账号类型 -->
<!-- 通用列表: LEFT JOIN biz_org 取公司名/类型, LEFT JOIN sys_user 取账号状态/类型 -->
<sql id="selectFieldsWithAccount">
select p.person_id, p.name, p.phone, p.org_id, o.org_name, o.org_type,
p.department, p.position, p.role, p.unit_type, p.status, p.del_flag, p.user_id,
p.department, p.position, p.role, p.unit_type, p.user_id,
p.create_by, p.create_time, p.update_by, p.update_time,
u.account_type, u.parent_user_id, u.del_flag as user_del_flag
u.account_type, u.parent_user_id, u.status, u.del_flag as user_del_flag
from biz_person p
left join biz_org o on p.org_id = o.org_id
left join sys_user u on p.user_id = u.user_id
@@ -46,7 +46,7 @@
<select id="selectList" resultMap="BizPersonResult" parameterType="BizPerson">
<include refid="selectFieldsWithAccount"/>
<where>
p.del_flag = '0'
u.del_flag = '0'
<if test="unitType != null and unitType != ''"> and p.unit_type = #{unitType}</if>
<if test="name != null and name != ''"> and p.name = #{name}</if>
<if test="phone != null and phone != ''"> and p.phone = #{phone}</if>
@@ -55,8 +55,15 @@
<if test="department != null and department != ''"> and p.department = #{department}</if>
<if test="position != null and position != ''"> and p.position = #{position}</if>
<if test="role != null and role != ''"> and p.role = #{role}</if>
<if test="status != null and status != ''"> and p.status = #{status}</if>
<if test="status != null and status != ''"> and u.status = #{status}</if>
<if test="parentUserId != null"> and u.parent_user_id = #{parentUserId}</if>
<!-- 业务主账号隔离: biz_person.user_id IN (我的子账号 user_ids) -->
<if test="params.subUserIds != null and params.subUserIds.size() > 0">
and p.user_id in
<foreach collection="params.subUserIds" item="sid" open="(" separator="," close=")">
#{sid}
</foreach>
</if>
</where>
order by p.person_id desc
</select>
@@ -72,7 +79,6 @@
<if test="position != null">position,</if>
<if test="role != null">role,</if>
<if test="unitType != null">unit_type,</if>
<if test="status != null">status,</if>
<if test="userId != null">user_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time,
@@ -88,7 +94,6 @@
<if test="position != null">#{position},</if>
<if test="role != null">#{role},</if>
<if test="unitType != null">#{unitType},</if>
<if test="status != null">#{status},</if>
<if test="userId != null">#{userId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate(),
@@ -108,31 +113,32 @@
<if test="department != null">department = #{department},</if>
<if test="position != null">position = #{position},</if>
<if test="role != null">role = #{role},</if>
<if test="status != null">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate(),
</trim>
where person_id = #{personId}
</update>
<!-- 逻辑删除: del_flag='1', 同时联动把关联 sys_user 子账号也逻辑删除 -->
<!-- 逻辑删除: 改 sys_user.del_flag='1' (biz_person 没这字段, 改用 sys_user 软删) -->
<update id="deleteByPrimaryKey" parameterType="String">
update biz_person set del_flag='1', update_time=sysdate()
where person_id = #{personId} and del_flag='0'
update sys_user u inner join biz_person p on u.user_id = p.user_id
set u.del_flag='1'
where p.person_id = #{personId} and u.del_flag='0'
</update>
<update id="deleteByPrimaryKeys" parameterType="String">
update biz_person set del_flag='1', update_time=sysdate()
where del_flag='0' and person_id in
update sys_user u inner join biz_person p on u.user_id = p.user_id
set u.del_flag='1'
where u.del_flag='0' and p.person_id in
<foreach collection="personIds" item="personId" open="(" separator="," close=")">
#{personId}
</foreach>
</update>
<!-- 联动: 把 personIds 对应的 sys_user 子账号也逻辑删除 -->
<!-- 联动: 把 personIds 对应的 sys_user 子账号也逻辑删除 (兼容保留, 与 deleteByPrimaryKeys 行为一致) -->
<update id="softDeleteSysUserByPersonIds" parameterType="String">
update sys_user u inner join biz_person p on u.user_id = p.user_id
set u.del_flag='1'
where u.del_flag='0' and p.del_flag='1' and p.person_id in
where u.del_flag='0' and p.person_id in
<foreach collection="personIds" item="personId" open="(" separator="," close=")">
#{personId}
</foreach>
@@ -143,8 +149,7 @@
<select id="selectSponsorList" resultMap="BizPersonResult" parameterType="BizPerson">
<include refid="selectFieldsWithAccount"/>
<where>
p.del_flag = '0'
and u.del_flag = '0'
u.del_flag = '0'
and p.unit_type = 'sponsor'
and u.parent_user_id = #{params.sponsorOwnerUid}
<if test="name != null and name != ''"> and p.name = #{name}</if>
@@ -153,7 +158,7 @@
<if test="department != null and department != ''"> and p.department = #{department}</if>
<if test="position != null and position != ''"> and p.position = #{position}</if>
<if test="role != null and role != ''"> and p.role = #{role}</if>
<if test="status != null and status != ''"> and p.status = #{status}</if>
<if test="status != null and status != ''"> and u.status = #{status}</if>
</where>
order by p.person_id desc
</select>