添加:角色管理配置资料中心权限功能
This commit is contained in:
+4
@@ -2,6 +2,8 @@ package com.adc.da.slrs.fileMaterialCenter.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhaokaiyao
|
* @author zhaokaiyao
|
||||||
*/
|
*/
|
||||||
@@ -24,4 +26,6 @@ public class FileMaterialPage {
|
|||||||
private Integer page;
|
private Integer page;
|
||||||
|
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
|
|
||||||
|
private List<String> treeIdList;
|
||||||
}
|
}
|
||||||
|
|||||||
+36
@@ -1,13 +1,21 @@
|
|||||||
package com.adc.da.slrs.fileMaterialCenter.service.impl;
|
package com.adc.da.slrs.fileMaterialCenter.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.http.Result;
|
||||||
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
|
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
|
||||||
import com.adc.da.slrs.fileMaterialCenter.dao.FileMaterialDao;
|
import com.adc.da.slrs.fileMaterialCenter.dao.FileMaterialDao;
|
||||||
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage;
|
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage;
|
||||||
import com.adc.da.slrs.fileMaterialCenter.service.IFileMaterialService;
|
import com.adc.da.slrs.fileMaterialCenter.service.IFileMaterialService;
|
||||||
|
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
|
||||||
|
import com.adc.da.slrs.sarUser.dao.TsUserDao;
|
||||||
|
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||||
|
import com.adc.da.slrs.tsRoleMeunData.entity.TsRoleMenuData;
|
||||||
|
import com.adc.da.slrs.tsRoleMeunData.service.ITsRoleMenuDataService;
|
||||||
|
import com.adc.da.util.LoginUserUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -15,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import javax.management.Query;
|
import javax.management.Query;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -29,6 +38,12 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
FileMaterialDao fileMaterialDao;
|
FileMaterialDao fileMaterialDao;
|
||||||
|
@Autowired
|
||||||
|
private TsUserDao tsUserDao;
|
||||||
|
@Autowired
|
||||||
|
private ITsPositionService tsPositionService;
|
||||||
|
@Autowired
|
||||||
|
private ITsRoleMenuDataService iTsRoleMenuDataService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,6 +54,27 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
|
|||||||
}else {
|
}else {
|
||||||
page=new Page<>(queryPage.getPage(),queryPage.getPageSize());
|
page=new Page<>(queryPage.getPage(),queryPage.getPageSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前登录人
|
||||||
|
String loginUserId = LoginUserUtil.getUserId();
|
||||||
|
|
||||||
|
List<String> positionIds = tsUserDao.selectPositionIds(loginUserId);
|
||||||
|
List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
|
||||||
|
QueryWrapper<TsRoleMenuData> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.in("ROLE_ID", roleIds);
|
||||||
|
List<TsRoleMenuData> tsRoleMenuData = iTsRoleMenuDataService.list(wrapper);
|
||||||
|
List<String> treeIdList = tsRoleMenuData.stream().map(TsRoleMenuData::getMenuId).distinct().collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(treeIdList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(queryPage.getTreeId())) {
|
||||||
|
queryPage.setTreeIdList(treeIdList);
|
||||||
|
} else {
|
||||||
|
// 查看菜单是否有数据权限
|
||||||
|
if (!treeIdList.contains(queryPage.getTreeId())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
return fileMaterialDao.getFileMaterialPage(page,queryPage);
|
return fileMaterialDao.getFileMaterialPage(page,queryPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.adc.da.slrs.zlTree.entity.ZlTree;
|
|||||||
import com.adc.da.slrs.zlTree.entity.ZlTreeData;
|
import com.adc.da.slrs.zlTree.entity.ZlTreeData;
|
||||||
import com.adc.da.slrs.zlTree.service.IZlTreeDataService;
|
import com.adc.da.slrs.zlTree.service.IZlTreeDataService;
|
||||||
import com.adc.da.slrs.zlTree.service.IZlTreeService;
|
import com.adc.da.slrs.zlTree.service.IZlTreeService;
|
||||||
|
import com.adc.da.util.LoginUserUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -64,7 +65,6 @@ public class ZlTreeController extends BaseController<ZlTree> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询树结构")
|
@ApiOperation("查询树结构")
|
||||||
public ResponseMessage<List<TreeData>> getFileMaterial(){
|
public ResponseMessage<List<TreeData>> getFileMaterial(){
|
||||||
@@ -72,6 +72,13 @@ public class ZlTreeController extends BaseController<ZlTree> {
|
|||||||
return Result.success(fileMaterial);
|
return Result.success(fileMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/permissConfig")
|
||||||
|
@ApiOperation("查询树结构-角色管理")
|
||||||
|
public ResponseMessage<List<TreeData>> getFileMaterialM(){
|
||||||
|
List<TreeData> fileMaterial = iZlTreeService.getLeftTreeM();
|
||||||
|
return Result.success(fileMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改树节点")
|
@ApiOperation("修改树节点")
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ public interface IZlTreeService extends IService<ZlTree> {
|
|||||||
*/
|
*/
|
||||||
List<TreeData> getLeftTree();
|
List<TreeData> getLeftTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色管理-查询树结构
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TreeData> getLeftTreeM();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取类型
|
* 获取类型
|
||||||
|
|||||||
+37
-1
@@ -1,10 +1,15 @@
|
|||||||
package com.adc.da.slrs.zlTree.service.impl;
|
package com.adc.da.slrs.zlTree.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
|
||||||
|
import com.adc.da.slrs.sarRole.service.ITsRoleService;
|
||||||
|
import com.adc.da.slrs.sarUser.dao.TsUserDao;
|
||||||
|
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||||
import com.adc.da.slrs.zlTree.dao.ZlTreeDao;
|
import com.adc.da.slrs.zlTree.dao.ZlTreeDao;
|
||||||
import com.adc.da.slrs.zlTree.entity.TreeData;
|
import com.adc.da.slrs.zlTree.entity.TreeData;
|
||||||
import com.adc.da.slrs.zlTree.entity.ZlTree;
|
import com.adc.da.slrs.zlTree.entity.ZlTree;
|
||||||
import com.adc.da.slrs.zlTree.entity.ZlTreeData;
|
import com.adc.da.slrs.zlTree.entity.ZlTreeData;
|
||||||
import com.adc.da.slrs.zlTree.service.IZlTreeService;
|
import com.adc.da.slrs.zlTree.service.IZlTreeService;
|
||||||
|
import com.adc.da.util.LoginUserUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -31,10 +36,41 @@ public class ZlTreeServiceImpl extends ServiceImpl<ZlTreeDao, ZlTree> implements
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ZlTreeDao zlTreeDao;
|
ZlTreeDao zlTreeDao;
|
||||||
|
@Autowired
|
||||||
|
private ITsUserService tsUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TreeData> getLeftTree() {
|
public List<TreeData> getLeftTree() {
|
||||||
|
// 获取当前登录人
|
||||||
|
String loginUserId = LoginUserUtil.getUserId();
|
||||||
|
// 查询当前登录人的权限菜单
|
||||||
|
List<String> recourceIdList = tsUserService.getResourceUserId(loginUserId);
|
||||||
|
|
||||||
|
TreeData res=new TreeData();
|
||||||
|
QueryWrapper<ZlTree> wrapper=new QueryWrapper<>();
|
||||||
|
wrapper.lambda().in(ZlTree::getId, recourceIdList);
|
||||||
|
wrapper.orderByAsc("length(sort),sort");
|
||||||
|
List<ZlTree> list=this.list(wrapper);
|
||||||
|
List<TreeData> treeData=new ArrayList<>();
|
||||||
|
//代码遍历生成树
|
||||||
|
for (ZlTree zlTree:list) {
|
||||||
|
if (StringUtils.isNotBlank(zlTree.getParentId())){
|
||||||
|
TreeData zlTreeData=new TreeData();
|
||||||
|
BeanUtils.copyProperties(zlTree,zlTreeData);
|
||||||
|
treeData.add(zlTreeData);
|
||||||
|
}else {
|
||||||
|
BeanUtils.copyProperties(zlTree,res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//递归生成树
|
||||||
|
digui(res,treeData);
|
||||||
|
List<TreeData> treeData1=new ArrayList<>();
|
||||||
|
treeData1.add(res);
|
||||||
|
return treeData1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeData> getLeftTreeM() {
|
||||||
TreeData res=new TreeData();
|
TreeData res=new TreeData();
|
||||||
QueryWrapper<ZlTree> wrapper=new QueryWrapper<>();
|
QueryWrapper<ZlTree> wrapper=new QueryWrapper<>();
|
||||||
wrapper.orderByAsc("length(sort),sort");
|
wrapper.orderByAsc("length(sort),sort");
|
||||||
|
|||||||
+6
@@ -28,6 +28,12 @@
|
|||||||
<if test="flieM.treeId != null and flieM.treeId != ''">
|
<if test="flieM.treeId != null and flieM.treeId != ''">
|
||||||
and zd.id=#{flieM.treeId}
|
and zd.id=#{flieM.treeId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="flieM.treeIdList != null">
|
||||||
|
and zd.id in
|
||||||
|
<foreach collection="flieM.treeIdList" open="(" separator="," close=")" index="index" item="item">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="flieM.id != null and flieM.id != ''">
|
<if test="flieM.id != null and flieM.id != ''">
|
||||||
and fm.id=#{flieM.id}
|
and fm.id=#{flieM.id}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user