fix: 修复 select distinct 错误

This commit is contained in:
Captain.B 2020-08-25 15:10:56 +08:00
parent dc64026250
commit b80e5cc996
1 changed files with 9 additions and 6 deletions

View File

@ -38,21 +38,23 @@
</select>
<select id="getMemberList" resultType="io.metersphere.base.domain.User">
SELECT distinct `user`.* FROM user_role JOIN `user` ON user_role.user_id = `user`.id
SELECT DISTINCT * FROM (
SELECT `user`.* FROM user_role JOIN `user` ON user_role.user_id = `user`.id
WHERE user_role.source_id = #{member.workspaceId}
<if test="member.name != null">
AND `user`.name like CONCAT('%', #{member.name},'%')
</if>
order by user_role.update_time desc
order by user_role.update_time desc) temp
</select>
<select id="getOrgMemberList" resultType="io.metersphere.base.domain.User">
SELECT distinct `user`.* FROM user_role JOIN `user` ON user_role.user_id = `user`.id
SELECT DISTINCT * FROM (
SELECT `user`.* FROM user_role JOIN `user` ON user_role.user_id = `user`.id
WHERE user_role.source_id = #{orgMember.organizationId}
<if test="orgMember.name != null">
AND `user`.name like CONCAT('%', #{orgMember.name},'%')
</if>
order by user_role.update_time desc
order by user_role.update_time desc) temp
</select>
<select id="getOrganizationMemberDTO" resultMap="BaseOrganizationMemberDTOMap">
@ -90,11 +92,12 @@
where w.id = #{workspaceId} and ur.user_id = #{userId}
</select>
<select id="getTestManagerAndTestUserList" resultType="io.metersphere.base.domain.User">
SELECT distinct `user`.* FROM user_role INNER JOIN `user` ON user_role.user_id = `user`.id
SELECT DISTINCT * FROM (
SELECT `user`.* FROM user_role INNER JOIN `user` ON user_role.user_id = `user`.id
WHERE user_role.source_id = #{request.workspaceId} And user_role.role_id in ('test_manager', 'test_user')
<if test="request.name != null">
AND `user`.name like CONCAT('%', #{request.name},'%')
</if>
order by user_role.update_time desc
order by user_role.update_time desc) temp
</select>
</mapper>