角色可见数据,问题修改 12.19

main
zhc077 11 months ago
parent 6a5daf237b
commit 555f50a17f
  1. 24
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcomp/controller/AnnualCompController.java
  2. 47
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompaward/controller/AnnualCompAwardController.java
  3. 34
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/comp/controller/CompController.java
  4. 32
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/compskill/controller/CompskillController.java
  5. 6
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserRoleService.java
  6. 34
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserRoleServiceImpl.java
  7. 16
      jeecgboot-vue3-master/src/views/annualcompetitionprojectregistration/student/AnnualCompetitionProjectRegistrationList.vue

@ -21,6 +21,8 @@ import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService;
import org.jeecg.modules.demo.annualcomp.vo.AnnualCompVo; import org.jeecg.modules.demo.annualcomp.vo.AnnualCompVo;
import org.jeecg.modules.demo.comp.entity.Comp; import org.jeecg.modules.demo.comp.entity.Comp;
import org.jeecg.modules.demo.comp.service.ICompService; import org.jeecg.modules.demo.comp.service.ICompService;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.service.ISysUserRoleService;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -30,9 +32,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -53,6 +53,9 @@ public class AnnualCompController extends JeecgController<AnnualComp, IAnnualCom
@Autowired @Autowired
private ICompService compService; private ICompService compService;
@Autowired
private ISysUserRoleService iSysUserRoleService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -76,16 +79,23 @@ public class AnnualCompController extends JeecgController<AnnualComp, IAnnualCom
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
// 获取当前登录用户 // 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal(); LoginUser loginUser = (LoginUser) subject.getPrincipal();
//角色名称 管理员&教务处可以查看所有 //角色编码 管理员&组委会&教务处 可以看到所有,其它用户可见到所属自己数据
String realname = loginUser.getRealname(); List<SysRole> roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId());
Map<String, String> roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode));
//角色名称 管理员&组委会可以看到所有,其它用户可见到所属自己数据
Map<String, String> efficientRoleMap = new LinkedHashMap<>();
efficientRoleMap.put("admin", "admin");
efficientRoleMap.put("committee", "committee");
efficientRoleMap.put("superAdmin", "superAdmin");
String compname = annualComp.getCompname(); String compname = annualComp.getCompname();
// String compId = null;
LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Comp> queryWrapper1 = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(compname)) { if (StringUtils.isNotBlank(compname)) {
queryWrapper1.eq(Comp::getCompName, compname); queryWrapper1.eq(Comp::getCompName, compname);
} }
if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) { if (efficientRoleMap.containsValue(roleMap.get("admin"))
||efficientRoleMap.containsValue(roleMap.get("committee"))
||efficientRoleMap.containsValue(roleMap.get("superAdmin"))) {
} else { } else {
queryWrapper1.eq(Comp::getCompAdmin, loginUser.getUsername()); queryWrapper1.eq(Comp::getCompAdmin, loginUser.getUsername());
} }

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
@ -24,6 +23,8 @@ import org.jeecg.modules.demo.annualcompaward.entity.AnnualCompAward;
import org.jeecg.modules.demo.annualcompaward.service.IAnnualCompAwardService; import org.jeecg.modules.demo.annualcompaward.service.IAnnualCompAwardService;
import org.jeecg.modules.demo.comp.entity.Comp; import org.jeecg.modules.demo.comp.entity.Comp;
import org.jeecg.modules.demo.comp.service.ICompService; import org.jeecg.modules.demo.comp.service.ICompService;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.service.ISysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -57,6 +58,9 @@ public class AnnualCompAwardController extends JeecgController<AnnualCompAward,
@Autowired @Autowired
private ICompService iCompService; private ICompService iCompService;
@Autowired
private ISysUserRoleService iSysUserRoleService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -77,30 +81,36 @@ public class AnnualCompAwardController extends JeecgController<AnnualCompAward,
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
// 获取当前登录用户 // 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal(); LoginUser loginUser = (LoginUser) subject.getPrincipal();
//角色名称 管理员&教务处可以查看所有 List<SysRole> roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId());
String realname = loginUser.getRealname(); Map<String, String> roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode));
Set<String> annualCompPointIds = new TreeSet<>(); //角色编码 管理员&组委会&教务处 可以看到所有,其它用户可见到所属自己数据
Map<String, String> efficientRoleMap = new LinkedHashMap<>();
efficientRoleMap.put("admin", "admin");
efficientRoleMap.put("committee", "committee");
efficientRoleMap.put("superAdmin", "superAdmin");
// QueryWrapper<AnnualCompAward> queryWrapper = QueryGenerator.initQueryWrapper(annualCompAward, req.getParameterMap());
LambdaQueryWrapper<AnnualCompAward> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<AnnualCompAward> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) { Page<AnnualCompAward> page = new Page<AnnualCompAward>(pageNo, pageSize);
} else { // 查询所属当前登录用户数据
if (!efficientRoleMap.containsValue(roleMap.get("admin"))
&& !efficientRoleMap.containsValue(roleMap.get("committee"))
&& !efficientRoleMap.containsValue(roleMap.get("superAdmin"))) {
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername())); List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername()));
if (!ObjectUtils.isEmpty(compList)) { if (ObjectUtils.isEmpty(compList)) {
Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet()); return Result.OK(page);
List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds)); }
if (!ObjectUtils.isEmpty(annualCompList)) { Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet());
Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet()); List<AnnualComp> annualCompList = annualCompService.list(new LambdaQueryWrapper<AnnualComp>().in(AnnualComp::getCompid, compIds));
List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); if (!ObjectUtils.isEmpty(annualCompList)) {
if (!ObjectUtils.isEmpty(annualCompPointList)) { Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet());
annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet()); List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));
} if (!ObjectUtils.isEmpty(annualCompPointList)) {
Set<String> annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet());
queryWrapper.in(AnnualCompAward::getAnnucompid, annualCompPointIds);
} }
} }
queryWrapper.in(AnnualCompAward::getAnnucompid, annualCompPointIds);
} }
Page<AnnualCompAward> page = new Page<AnnualCompAward>(pageNo, pageSize);
annualCompAwardService.page(page, queryWrapper); annualCompAwardService.page(page, queryWrapper);
// Page<AnnualCompAwardvo> page1 = new Page<>(); // Page<AnnualCompAwardvo> page1 = new Page<>();
@ -143,6 +153,7 @@ public class AnnualCompAwardController extends JeecgController<AnnualCompAward,
return Result.OK(page); return Result.OK(page);
} }
/** /**
* 添加 * 添加
* *

@ -8,7 +8,6 @@ import com.google.common.base.Joiner;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
@ -21,9 +20,10 @@ import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService;
import org.jeecg.modules.demo.comp.entity.Comp; import org.jeecg.modules.demo.comp.entity.Comp;
import org.jeecg.modules.demo.comp.service.ICompService; import org.jeecg.modules.demo.comp.service.ICompService;
import org.jeecg.modules.demo.comptype.service.ICompTypeService; import org.jeecg.modules.demo.comptype.service.ICompTypeService;
import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserRoleService;
import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -32,9 +32,8 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays; import java.util.stream.Collectors;
import java.util.List;
/** /**
* @Description: 比赛 * @Description: 比赛
@ -61,6 +60,9 @@ public class CompController extends JeecgController<Comp, ICompService> {
@Autowired @Autowired
private IAnnualCompService annualCompService; private IAnnualCompService annualCompService;
@Autowired
private ISysUserRoleService iSysUserRoleService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -83,8 +85,16 @@ public class CompController extends JeecgController<Comp, ICompService> {
// 获取当前登录用户 // 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal(); LoginUser loginUser = (LoginUser) subject.getPrincipal();
//角色名称 管理员&教务处可以查看所有 //角色名称 管理员&教务处可以查看所有
String realname = loginUser.getRealname(); List<SysRole> roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId());
if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) { Map<String, String> roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode));
//角色编码 管理员&组委会&教务处 可以看到所有,其它用户可见到所属自己数据
Map<String, String> efficientRoleMap = new LinkedHashMap<>();
efficientRoleMap.put("admin", "admin");
efficientRoleMap.put("committee", "committee");
efficientRoleMap.put("superAdmin", "superAdmin");
if (efficientRoleMap.containsValue(roleMap.get("admin"))
||efficientRoleMap.containsValue(roleMap.get("committee"))
||efficientRoleMap.containsValue(roleMap.get("superAdmin"))) {
} else { } else {
comp.setCompAdmin(loginUser.getUsername()); comp.setCompAdmin(loginUser.getUsername());
} }
@ -116,12 +126,12 @@ public class CompController extends JeecgController<Comp, ICompService> {
* @return * @return
*/ */
//@AutoLog(value = "比赛专家-分页列表查询") //@AutoLog(value = "比赛专家-分页列表查询")
@ApiOperation(value="比赛专家-分页列表查询", notes="比赛专家-分页列表查询") @ApiOperation(value = "比赛专家-分页列表查询", notes = "比赛专家-分页列表查询")
@GetMapping(value = "/listSTU") @GetMapping(value = "/listSTU")
public Result<IPage<Comp>> listSTU(Comp compExp, public Result<IPage<Comp>> listSTU(Comp compExp,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<Comp> queryWrapper = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap()); QueryWrapper<Comp> queryWrapper = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap());
Page<Comp> page = new Page<Comp>(pageNo, pageSize); Page<Comp> page = new Page<Comp>(pageNo, pageSize);
IPage<Comp> pageList = compService.page(page, queryWrapper); IPage<Comp> pageList = compService.page(page, queryWrapper);
@ -180,7 +190,7 @@ public class CompController extends JeecgController<Comp, ICompService> {
comp.setCompAdmin(join);*/ comp.setCompAdmin(join);*/
//现业务只有一个有效负责人,值为 sys_user表username modify by zhc 11.21 //现业务只有一个有效负责人,值为 sys_user表username modify by zhc 11.21
if(!ObjectUtils.isEmpty(list)){ if (!ObjectUtils.isEmpty(list)) {
comp.setCompAdmin(list.get(0)); comp.setCompAdmin(list.get(0));
} }

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
@ -27,6 +26,8 @@ import org.jeecg.modules.demo.comp.service.ICompService;
import org.jeecg.modules.demo.compskill.entity.Compskill; import org.jeecg.modules.demo.compskill.entity.Compskill;
import org.jeecg.modules.demo.compskill.entity.Compskillvo; import org.jeecg.modules.demo.compskill.entity.Compskillvo;
import org.jeecg.modules.demo.compskill.service.ICompskillService; import org.jeecg.modules.demo.compskill.service.ICompskillService;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.service.ISysUserRoleService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -35,10 +36,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -66,6 +64,9 @@ public class CompskillController extends JeecgController<Compskill, ICompskillSe
@Autowired @Autowired
private ICompService iCompService; private ICompService iCompService;
@Autowired
private ISysUserRoleService iSysUserRoleService;
/** /**
* 分页列表查询 * 分页列表查询
@ -87,14 +88,19 @@ public class CompskillController extends JeecgController<Compskill, ICompskillSe
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
// 获取当前登录用户 // 获取当前登录用户
LoginUser loginUser = (LoginUser) subject.getPrincipal(); LoginUser loginUser = (LoginUser) subject.getPrincipal();
//角色名称 管理员&教务处可以查看所有 List<SysRole> roleList = iSysUserRoleService.getUserRoleByUserId(loginUser.getId());
String realname = loginUser.getRealname(); Map<String, String> roleMap = Optional.ofNullable(roleList).orElse(new LinkedList<>()).stream().collect(Collectors.toMap(SysRole::getRoleCode, SysRole::getRoleCode));
//角色编码 管理员&组委会&教务处 可以看到所有,其它用户可见到所属自己数据
Map<String, String> efficientRoleMap = new LinkedHashMap<>();
efficientRoleMap.put("admin", "admin");
efficientRoleMap.put("committee", "committee");
efficientRoleMap.put("superAdmin", "superAdmin");
Set<String> annualCompPointIds = new TreeSet<>();
// QueryWrapper<Compskill> queryWrapper = QueryGenerator.initQueryWrapper(compskill, req.getParameterMap());
LambdaQueryWrapper<Compskill> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Compskill> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.equals("管理员", realname) || StringUtils.equals("教务处", realname)) { // 查询所属当前登录用户数据
} else { if (!efficientRoleMap.containsValue(roleMap.get("admin"))
&& !efficientRoleMap.containsValue(roleMap.get("committee"))
&& !efficientRoleMap.containsValue(roleMap.get("superAdmin"))) {
List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername())); List<Comp> compList = iCompService.list(new LambdaQueryWrapper<Comp>().eq(Comp::getCompAdmin, loginUser.getUsername()));
if (!ObjectUtils.isEmpty(compList)) { if (!ObjectUtils.isEmpty(compList)) {
Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet()); Set<String> compIds = compList.stream().map(c -> c.getId()).collect(Collectors.toSet());
@ -103,11 +109,11 @@ public class CompskillController extends JeecgController<Compskill, ICompskillSe
Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet()); Set<String> annualCompIds = annualCompList.stream().map(d -> d.getId()).collect(Collectors.toSet());
List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds)); List<AnnualCompPoint> annualCompPointList = annualCompPointService.list(new LambdaQueryWrapper<AnnualCompPoint>().in(AnnualCompPoint::getAnnualCompId, annualCompIds));
if (!ObjectUtils.isEmpty(annualCompPointList)) { if (!ObjectUtils.isEmpty(annualCompPointList)) {
annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet()); Set<String> annualCompPointIds = annualCompPointList.stream().map(e -> e.getId()).collect(Collectors.toSet());
queryWrapper.in(Compskill::getAnnucompid, annualCompPointIds);
} }
} }
} }
queryWrapper.in(Compskill::getAnnucompid, annualCompPointIds);
} }

@ -1,7 +1,11 @@
package org.jeecg.modules.system.service; package org.jeecg.modules.system.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserRole; import org.jeecg.modules.system.entity.SysUserRole;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -15,4 +19,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @since 2018-12-21 * @since 2018-12-21
*/ */
public interface ISysUserRoleService extends IService<SysUserRole> { public interface ISysUserRoleService extends IService<SysUserRole> {
List<SysRole> getUserRoleByUserId(String userId);
} }

@ -1,20 +1,18 @@
package org.jeecg.modules.system.service.impl; package org.jeecg.modules.system.service.impl;
import java.util.IdentityHashMap; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.List; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Map;
import org.jeecg.modules.system.entity.SysRole; import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserRole; import org.jeecg.modules.system.entity.SysUserRole;
import org.jeecg.modules.system.mapper.SysUserRoleMapper; import org.jeecg.modules.system.mapper.SysUserRoleMapper;
import org.jeecg.modules.system.service.ISysRoleService; import org.jeecg.modules.system.service.ISysRoleService;
import org.jeecg.modules.system.service.ISysUserRoleService; import org.jeecg.modules.system.service.ISysUserRoleService;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.LinkedList;
import java.util.List;
/** /**
* <p> * <p>
@ -27,4 +25,26 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService { public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {
@Autowired
private ISysRoleService sysRoleService;
/**
* @description: 根据用户id, 获取用户角色
* @param: [userId]
* @return: java.util.List<org.jeecg.modules.system.entity.SysRole>
* @author: z.h.c
* @date: 23/12/19 15:36
*/
@Override
public List<SysRole> getUserRoleByUserId(String userId) {
List<SysRole> sysRoleList = new LinkedList<>();
List<SysUserRole> userRoleList = this.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
for (SysUserRole sysUserRole : userRoleList) {
SysRole sysRole = sysRoleService.getById(sysUserRole.getRoleId());
if (!ObjectUtils.isEmpty(sysRole)) {
sysRoleList.add(sysRole);
}
}
return sysRoleList;
}
} }

@ -6,9 +6,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题--> <!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 报名 </a-button> <!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 报名 </a-button>-->
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls"> 导入 </j-upload-button>-->
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button> <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 </a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls"> 导入 </j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay> <template #overlay>
<a-menu> <a-menu>
@ -81,7 +81,7 @@ import ChaoseTopicPersionModal from '/@/views/chooseTopicPersion/components/Chao
fieldMapToTime: [], fieldMapToTime: [],
}, },
actionColumn: { actionColumn: {
width: 120, width: 200,
fixed: 'right', fixed: 'right',
}, },
}, },
@ -205,7 +205,7 @@ function getTableAction(record) {
}, },
{ {
label: '详情', label: '详情',
onClick: handleEdit.bind(null, record), onClick: handleDetail.bind(null, record),
}, },
]; ];
} }
@ -215,10 +215,10 @@ function getTableAction(record) {
*/ */
function getDropDownAction(record) { function getDropDownAction(record) {
return [ return [
{ // {
label: '详情', // label: '',
onClick: handleDetail.bind(null, record), // onClick: handleDetail.bind(null, record),
}, // },
{ {
label: '申请驳回', label: '申请驳回',
popConfirm: { popConfirm: {

Loading…
Cancel
Save