fix: 数据集消息获取接受人权限错误

This commit is contained in:
fit2cloud-chenyw 2021-08-11 15:52:49 +08:00
parent e3cff22620
commit 5d2340975c
3 changed files with 13 additions and 3 deletions

View File

@ -43,9 +43,11 @@ public class ExtAuthServiceImpl implements ExtAuthService {
@Override @Override
public AuthURD resourceTarget(String resourceId) { public AuthURD resourceTarget(String resourceId) {
AuthURD authURD = new AuthURD(); AuthURD authURD = new AuthURD();
SysAuthExample example = new SysAuthExample(); /*SysAuthExample example = new SysAuthExample();
example.createCriteria().andAuthSourceEqualTo(resourceId); example.createCriteria().andAuthSourceEqualTo(resourceId);
List<SysAuth> sysAuths = sysAuthMapper.selectByExample(example); List<SysAuth> sysAuths = sysAuthMapper.selectByExample(example);*/
List<SysAuth> sysAuths = extAuthMapper.queryByResource(resourceId);
Map<String, List<SysAuth>> authMap = sysAuths.stream().collect(Collectors.groupingBy(SysAuth::getAuthTargetType)); Map<String, List<SysAuth>> authMap = sysAuths.stream().collect(Collectors.groupingBy(SysAuth::getAuthTargetType));
if (!CollectionUtils.isEmpty(authMap.get("user"))) { if (!CollectionUtils.isEmpty(authMap.get("user"))) {
authURD.setUserIds(authMap.get("user").stream().map(item -> Long.parseLong(item.getAuthTarget())).collect(Collectors.toList())); authURD.setUserIds(authMap.get("user").stream().map(item -> Long.parseLong(item.getAuthTarget())).collect(Collectors.toList()));

View File

@ -1,6 +1,7 @@
package io.dataease.base.mapper.ext; package io.dataease.base.mapper.ext;
import io.dataease.base.domain.SysAuth;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -12,6 +13,6 @@ public interface ExtAuthMapper {
List<Long> queryUserIdWithDeptIds(@Param("deptIds") List<Long> deptIds); List<Long> queryUserIdWithDeptIds(@Param("deptIds") List<Long> deptIds);
List<SysAuth> queryByResource(@Param("resourceId") String resourceId);
// Set<Long> queryUserIdWithRD(@Param("roleIds") List<Long> roleIds, @Param("deptIds") List<Long> deptIds); // Set<Long> queryUserIdWithRD(@Param("roleIds") List<Long> roleIds, @Param("deptIds") List<Long> deptIds);
} }

View File

@ -23,5 +23,12 @@
</select> </select>
<select id="queryByResource" resultMap="io.dataease.base.mapper.SysAuthMapper.BaseResultMap" >
select a.*
from sys_auth a left join sys_auth_detail b on a.id = b.auth_id
where a.auth_source = #{resourceId} and b.privilege_value = 1
</select>
</mapper> </mapper>