==判断企标权限接口 api/lawss/sarBussionessStand/checkIsShow

This commit is contained in:
yuezhihang
2022-03-18 13:46:59 +08:00
parent 9f667ecd51
commit 52b12d4438
4 changed files with 85 additions and 0 deletions
@@ -267,6 +267,21 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
return Result.success(getPageInfo(page.getPager(), rows));
}
/**
* 自定义分页查询列表---判断是否会进入详情页面
* @param page 标准信息
* @return
*/
@ApiOperation(value = "|SarBussionessStandEO|自定义分页查询列表")
@GetMapping("/checkIsShow")
//@RequiresPermissions("lawss:sarBussionessStand:getSarBussionStandPage")
public boolean checkIsShow(SarBussionessStandEOPage page) throws Exception {
if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
return sarBussionessStandEOService.checkIsShow(page);
}
private void nowOrderFunc(SarBussionessStandEOPage page) {
switch (page.getNowOrderBy()) {
case 1:
@@ -42,6 +42,8 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
List<SarBussionessStand> getSarBussionStandPage(SarBussionessStandEOPage page) throws Exception;
boolean checkIsShow(SarBussionessStandEOPage page) throws Exception;
List<SarBussionessStand> getSarBussionStandPageQd(SarBussionessStandEOPage page) throws Exception;
}
@@ -1062,6 +1062,71 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
@Override
public boolean checkIsShow(SarBussionessStandEOPage page) throws Exception {
//查询当前登录人角色拥有权限的菜单
if(page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(page.getUserId())){
String treeType = page.getTreeType();
QueryWrapper<TsResource> qw = new QueryWrapper<>();
qw.eq("ID",page.getMenuId());
qw.isNull("PARENT_ID");
List<TsResource> children = iTsResourceService.list(qw);
if(children.isEmpty() && !page.getMenuId().equals("nomenu") && StringUtils.isNotBlank(treeType) && "tsr".equals(treeType)){
List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
page.setMenuRoleList(getMenuIdList);
} else {
page.setMenuRoleList(null);
}
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}else if(!page.getMenuId().equals("nomenu") && StringUtils.isNotBlank(treeType) && "sarMs".equals(treeType)){
List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
page.setMenuRoleList(getMenuIdList);
} else {
page.setMenuRoleList(null);
}
List<String> ids = iSarMenuStandardService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}else if(page.getMenuId().equals("nomenu") && StringUtils.isNotBlank(page.getSarMsType()) && "filterSarMsMenu".equals(page.getSarMsType())){
List<String> ids = iSarMenuStandardService.getChildMenuList(page.getMenuTopId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}
}
//配置列表显示的数据权限
List<SarBussionessStand> sarlist = new ArrayList<>();
List<String> access = tsUserService.getResourceDataUserId(page.getUserId());
if (null == page.getMenuId() && null == page.getMenuAllChildrenIdList()) {
page.setMenuAllChildrenIdList(access);
page.setMenuId("");
} else if (page.getMenuId().equals("3")) {
page.setMenuAllChildrenIdList(access);
}
List<String> finalData = page.getMenuAllChildrenIdList().stream().filter(s -> access.contains(s)).collect(Collectors.toList());
if (finalData.size() > 0) {
page.setMenuAllChildrenIdList(finalData);
if (null == page.getMenuId() && null == page.getMenuAllChildrenIdList()) {
page.setMenuAllChildrenIdList(access);
}
Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page);
if (rowCount>0) {
return true;
}else {
return false;
}
} else {
return false;
}
}
@Override
public List<SarBussionessStand> getSarBussionStandPageQd(SarBussionessStandEOPage page) throws Exception {
//查询当前登录人角色拥有权限的菜单
@@ -569,6 +569,9 @@
#{item}
</foreach>
</if>
<if test="id != null and id != '' " >
and SAR_BUSSIONESS_STAND.id = #{id}
</if>
<if test="standSort != null" >
and SAR_BUSSIONESS_STAND.stand_sort = #{standSort}
</if>