提交学习管理员的权限管理模块
This commit is contained in:
1 parent
517a0052bc
commit
dcecdbd6aa
6 files changed
+105
-55
No files matched your search
+12
@@ -114,4 +114,16 @@ public class XgStudentManagerSourceController extends BaseController {
|
||||
xgStudentManagerSourceService.grantDeptAuth(managerId, authSourceIds);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定管理员的授权资源名称列表
|
||||
*
|
||||
* @param managerId 管理员ID
|
||||
* @return 授权资源名称数组
|
||||
*/
|
||||
@SaCheckPermission("xgStudentManagerSource:studentManagerSource:query")
|
||||
@GetMapping("/authSourceNames")
|
||||
public R<List<String>> getAuthSourceNames(@RequestParam Long managerId) {
|
||||
return R.ok(xgStudentManagerSourceService.getAuthSourceNames(managerId));
|
||||
}
|
||||
}
|
||||
+1
@@ -12,4 +12,5 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface XgStudentManagerSourceMapper extends BaseMapperPlus<XgStudentManagerSource, XgStudentManagerSourceVo> {
|
||||
|
||||
// 预留自定义SQL方法接口
|
||||
}
|
||||
+8
@@ -73,4 +73,12 @@ public interface IXgStudentManagerSourceService {
|
||||
* @param authSourceIds 资源ID列表
|
||||
*/
|
||||
void grantDeptAuth(Long managerId, List<Long> authSourceIds);
|
||||
|
||||
/**
|
||||
* 获取指定管理员的授权资源名称列表
|
||||
*
|
||||
* @param managerId 管理员ID
|
||||
* @return 授权资源名称数组
|
||||
*/
|
||||
List<String> getAuthSourceNames(Long managerId);
|
||||
}
|
||||
+23
@@ -164,4 +164,27 @@ public class XgStudentManagerSourceServiceImpl implements IXgStudentManagerSourc
|
||||
baseMapper.insertBatch(insertList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAuthSourceNames(Long managerId) {
|
||||
// 1. 查询xg_student_manager_source表,manager_id=managerId, deleted=0,
|
||||
// status=0,获取auth_source
|
||||
List<Long> authSourceIds = baseMapper.selectList(
|
||||
Wrappers.<XgStudentManagerSource>lambdaQuery()
|
||||
.eq(XgStudentManagerSource::getManagerId, managerId)
|
||||
.eq(XgStudentManagerSource::getDeleted, "0")
|
||||
.eq(XgStudentManagerSource::getStatus, "0"))
|
||||
.stream().map(XgStudentManagerSource::getAuthSource)
|
||||
.filter(id -> id != null)
|
||||
.toList();
|
||||
if (authSourceIds.isEmpty()) {
|
||||
return java.util.Collections.emptyList();
|
||||
}
|
||||
// 2. 查询sys_dept表,dept_id in (authSourceIds), status=0, del_flag=0,获取dept_name
|
||||
String inSql = authSourceIds.stream().map(String::valueOf).collect(java.util.stream.Collectors.joining(","));
|
||||
String sql = "SELECT dept_name FROM sys_dept WHERE dept_id IN (" + inSql
|
||||
+ ") AND status = '0' AND del_flag = '0'";
|
||||
List<String> deptNames = jdbcTemplate.queryForList(sql, String.class);
|
||||
return deptNames;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user