首页添加图标及图标的权限
@@ -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) {
|
||||
|
||||
|
After Width: | Height: | Size: 914 B |
|
After Width: | Height: | Size: 469 B |
|
After Width: | Height: | Size: 563 B |
|
After Width: | Height: | Size: 674 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 899 B |
|
After Width: | Height: | Size: 996 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1000 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |