fix(系统设置): 用户组查看关联用户没有过滤已删除的用户

This commit is contained in:
AgAngle 2023-08-28 15:51:24 +08:00 committed by 刘瑞斌
parent 529968d6b5
commit 25d3f18875
2 changed files with 12 additions and 13 deletions

View File

@ -21,13 +21,13 @@
FROM user FROM user
LEFT JOIN user_extend ON user.id = user_extend.id LEFT JOIN user_extend ON user.id = user_extend.id
WHERE (user.email = #{keyword} OR user.id = #{keyword}) WHERE (user.email = #{keyword} OR user.id = #{keyword})
AND deleted IS FALSE AND deleted = 0
</select> </select>
<select id="findAll" resultType="io.metersphere.system.domain.User"> <select id="findAll" resultType="io.metersphere.system.domain.User">
SELECT * SELECT *
FROM user FROM user
where deleted IS FALSE where deleted = 0
</select> </select>
<insert id="batchSave"> <insert id="batchSave">
@ -71,14 +71,14 @@
* *
</if> </if>
FROM user FROM user
WHERE DELETED IS FALSE WHERE DELETED = 0
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
AND name LIKE CONCAT('%', #{keyword}, '%') AND name LIKE CONCAT('%', #{keyword}, '%')
OR email LIKE CONCAT('%', #{keyword}, '%') OR email LIKE CONCAT('%', #{keyword}, '%')
</if> </if>
</select> </select>
<select id="selectUnDeletedUserIdByIdList" resultType="java.lang.String"> <select id="selectUnDeletedUserIdByIdList" resultType="java.lang.String">
SELECT * from `user` WHERE deleted IS FALSE AND id IN SELECT * from `user` WHERE deleted = 0 AND id IN
<foreach collection="idList" item="id" open="(" separator="," close=")"> <foreach collection="idList" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -96,7 +96,7 @@
<select id="getExcludeSelectOption" resultType="io.metersphere.sdk.dto.ExcludeOptionDTO"> <select id="getExcludeSelectOption" resultType="io.metersphere.sdk.dto.ExcludeOptionDTO">
select id, name select id, name
from user from user
where deleted is false where deleted = 0
</select> </select>
<select id="getSelectOptionByIdsWithDeleted" resultType="io.metersphere.sdk.dto.OptionDTO"> <select id="getSelectOptionByIdsWithDeleted" resultType="io.metersphere.sdk.dto.OptionDTO">
SELECT id, name SELECT id, name

View File

@ -14,18 +14,17 @@
) )
</select> </select>
<select id="selectGlobalRoleByUserId" resultType="io.metersphere.system.domain.UserRoleRelation"> <select id="selectGlobalRoleByUserId" resultType="io.metersphere.system.domain.UserRoleRelation">
SELECT * FROM SELECT *
user_role_relation FROM user_role_relation
WHERE WHERE user_id = #{userId}
user_id = #{userId} AND role_id IN (SELECT id
AND role_id IN ( FROM user_role
SELECT id FROM user_role WHERE type = 'SYSTEM' AND scope_id = 'global' WHERE type = 'SYSTEM' AND scope_id = 'global')
)
</select> </select>
<select id="listGlobal" resultType="io.metersphere.sdk.dto.UserRoleRelationUserDTO"> <select id="listGlobal" resultType="io.metersphere.sdk.dto.UserRoleRelationUserDTO">
select urr.id, u.id as userId, u.name, u.email, u.phone select urr.id, u.id as userId, u.name, u.email, u.phone
from user_role_relation urr from user_role_relation urr
inner join user u on urr.user_id = u.id and urr.role_id = #{request.roleId} inner join user u on urr.user_id = u.id and urr.role_id = #{request.roleId} and u.deleted = 0
<if test="request.keyword != null"> <if test="request.keyword != null">
and ( and (
u.name like concat('%', #{request.keyword},'%') u.name like concat('%', #{request.keyword},'%')