mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-07 09:44:03 +08:00
added: 管理员日志权限
This commit is contained in:
parent
67c3578609
commit
c6eef3477e
@ -71,6 +71,18 @@ public class AdminPermissionCheck implements ApplicationRunner {
|
||||
}
|
||||
},
|
||||
});
|
||||
// 管理员日志
|
||||
put(
|
||||
"管理员日志",
|
||||
new AdminPermission[] {
|
||||
new AdminPermission() {
|
||||
{
|
||||
setSort(0);
|
||||
setName("列表");
|
||||
setSlug(BPermissionConstant.ADMIN_LOG);
|
||||
}
|
||||
},
|
||||
});
|
||||
// 部门
|
||||
put(
|
||||
"部门",
|
||||
|
@ -27,6 +27,8 @@ public class BPermissionConstant {
|
||||
|
||||
public static final String ADMIN_ROLE = "admin-role";
|
||||
|
||||
public static final String ADMIN_LOG = "admin-log";
|
||||
|
||||
public static final String DEPARTMENT_CUD = "department-cud";
|
||||
public static final String DEPARTMENT_USER_LEARN = "department-user-learn";
|
||||
|
||||
|
@ -16,17 +16,21 @@
|
||||
package xyz.playedu.api.controller.backend;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import xyz.playedu.api.BCtx;
|
||||
import xyz.playedu.api.annotation.Log;
|
||||
import xyz.playedu.api.bus.BackendBus;
|
||||
import xyz.playedu.api.constant.BPermissionConstant;
|
||||
import xyz.playedu.api.constant.BusinessType;
|
||||
import xyz.playedu.api.domain.*;
|
||||
import xyz.playedu.api.middleware.BackendPermissionMiddleware;
|
||||
import xyz.playedu.api.service.AdminLogService;
|
||||
import xyz.playedu.api.service.AdminUserService;
|
||||
import xyz.playedu.api.types.JsonResponse;
|
||||
@ -48,6 +52,7 @@ public class AdminLogController {
|
||||
|
||||
@Autowired private BackendBus backendBus;
|
||||
|
||||
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_LOG)
|
||||
@GetMapping("/index")
|
||||
@Log(title = "管理员日志-列表", businessType = BusinessType.GET)
|
||||
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
|
||||
@ -62,9 +67,9 @@ public class AdminLogController {
|
||||
Integer opt = MapUtils.getInteger(params, "opt");
|
||||
|
||||
AdminLogPaginateFiler filter = new AdminLogPaginateFiler();
|
||||
if(backendBus.isSuperAdmin()){
|
||||
if (backendBus.isSuperAdmin()) {
|
||||
filter.setAdminId(adminId);
|
||||
}else {
|
||||
} else {
|
||||
filter.setAdminId(BCtx.getId());
|
||||
}
|
||||
filter.setModule(module);
|
||||
@ -75,12 +80,17 @@ public class AdminLogController {
|
||||
|
||||
PaginationResult<AdminLog> result = adminLogService.paginate(page, size, filter);
|
||||
|
||||
Map<Integer, String> adminUserMap = adminUserService.chunks(result.getData().stream().map(AdminLog::getAdminId).toList())
|
||||
.stream().collect(Collectors.toMap(AdminUser::getId, AdminUser::getName));
|
||||
Map<Integer, String> adminUserMap =
|
||||
adminUserService
|
||||
.chunks(result.getData().stream().map(AdminLog::getAdminId).toList())
|
||||
.stream()
|
||||
.collect(Collectors.toMap(AdminUser::getId, AdminUser::getName));
|
||||
|
||||
result.getData().forEach(adminLog -> {
|
||||
adminLog.setAdminName(adminUserMap.get(adminLog.getAdminId()));
|
||||
});
|
||||
result.getData()
|
||||
.forEach(
|
||||
adminLog -> {
|
||||
adminLog.setAdminName(adminUserMap.get(adminLog.getAdminId()));
|
||||
});
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("data", result.getData());
|
||||
|
Loading…
x
Reference in New Issue
Block a user