首页添加图标及图标的权限

This commit is contained in:
zhn
2022-11-04 11:23:44 +08:00
parent 92677adbf3
commit ffb094de83
14 changed files with 24 additions and 2 deletions
@@ -10,13 +10,19 @@ import com.jero.modules.home.mapper.HomeFunctionModuleEOMapper;
import com.jero.modules.home.service.IHomeFunctionModuleEOService;
import com.alibaba.fastjson.JSONObject;
import com.jero.modules.system.entity.SysPermission;
import com.jero.modules.system.service.ISysPermissionService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @Description: 功能模块
@@ -27,6 +33,9 @@ import java.util.UUID;
@Service
public class HomeFunctionModuleEOServiceImpl extends ServiceImpl<HomeFunctionModuleEOMapper, HomeFunctionModuleEO> implements IHomeFunctionModuleEOService {
@Autowired
private ISysPermissionService sysPermissionService;
/**
* 保存
*
@@ -103,22 +112,35 @@ public class HomeFunctionModuleEOServiceImpl extends ServiceImpl<HomeFunctionMod
public List<HomeFunctionModuleEO> queryList(String cut) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//用户拥有权限的菜单
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getUsername());
//所有的图表(state=0)
LambdaQueryWrapper<HomeFunctionModuleEO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(HomeFunctionModuleEO::getState,"0").isNull(HomeFunctionModuleEO::getCreateBy);
List<HomeFunctionModuleEO> homeFunctionModuleEOList = this.list(wrapper);
List<HomeFunctionModuleEO> homeFunctionModuleEOListTemp = new ArrayList<>();
if(ObjectUtils.isNotEmpty(homeFunctionModuleEOList)){
for (SysPermission sysPermission : metaList) {
List<HomeFunctionModuleEO> collect = homeFunctionModuleEOList.stream().filter(e -> e.getIconName().equals(sysPermission.getName())).collect(Collectors.toList());
if(ObjectUtils.isNotEmpty(collect)){
homeFunctionModuleEOListTemp.addAll(collect);
}
}
}
homeFunctionModuleEOListTemp = homeFunctionModuleEOListTemp.stream().distinct().collect(Collectors.toList());
//当前用户配置的图表
LambdaQueryWrapper<HomeFunctionModuleEO> wrapperTemp = new LambdaQueryWrapper<>();
wrapperTemp.in(HomeFunctionModuleEO::getCreateBy,loginUser.getUsername()).orderByAsc(HomeFunctionModuleEO::getState).orderByAsc(HomeFunctionModuleEO::getSort);
List<HomeFunctionModuleEO> homeFunctionModuleEOS = this.list(wrapperTemp);
if(homeFunctionModuleEOS.size() == 0){
if(CutEnum.EN.getValue().equals(cut)){
for (HomeFunctionModuleEO homeFunctionModuleEO : homeFunctionModuleEOList) {
for (HomeFunctionModuleEO homeFunctionModuleEO : homeFunctionModuleEOListTemp) {
homeFunctionModuleEO.setIconName(homeFunctionModuleEO.getIconNameEn());
}
}
return homeFunctionModuleEOList;
return homeFunctionModuleEOListTemp;
}else{
if(CutEnum.EN.getValue().equals(cut)){
for (HomeFunctionModuleEO homeFunctionModuleEO : homeFunctionModuleEOS) {
Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1000 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB