mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-27 23:52:58 +08:00
增加管理员日志详情接口
This commit is contained in:
parent
61eb5be2ee
commit
06da295d58
@ -19,10 +19,7 @@ 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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import xyz.playedu.common.annotation.BackendPermission;
|
||||
import xyz.playedu.common.annotation.Log;
|
||||
@ -31,6 +28,7 @@ import xyz.playedu.common.constant.BPermissionConstant;
|
||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||
import xyz.playedu.common.context.BCtx;
|
||||
import xyz.playedu.common.domain.AdminLog;
|
||||
import xyz.playedu.common.exception.ServiceException;
|
||||
import xyz.playedu.common.service.AdminLogService;
|
||||
import xyz.playedu.common.types.JsonResponse;
|
||||
import xyz.playedu.common.types.paginate.AdminLogPaginateFiler;
|
||||
@ -87,4 +85,19 @@ public class AdminLogController {
|
||||
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
@BackendPermission(slug = BPermissionConstant.ADMIN_LOG)
|
||||
@GetMapping("/detail/{id}")
|
||||
public JsonResponse detail(@PathVariable(name = "id") Integer id) {
|
||||
Integer adminId = 0;
|
||||
if (!backendBus.isSuperAdmin()) {
|
||||
adminId = BCtx.getId();
|
||||
}
|
||||
|
||||
AdminLog log = adminLogService.find(id, adminId);
|
||||
if (log == null) {
|
||||
throw new ServiceException("日志不存在");
|
||||
}
|
||||
return JsonResponse.data(log);
|
||||
}
|
||||
}
|
||||
|
@ -28,4 +28,6 @@ import xyz.playedu.common.types.paginate.PaginationResult;
|
||||
*/
|
||||
public interface AdminLogService extends IService<AdminLog> {
|
||||
PaginationResult<AdminLog> paginate(int page, int size, AdminLogPaginateFiler filter);
|
||||
|
||||
AdminLog find(Integer id, Integer adminId);
|
||||
}
|
||||
|
@ -44,4 +44,12 @@ public class AdminLogServiceImpl extends ServiceImpl<AdminLogMapper, AdminLog>
|
||||
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminLog find(Integer id, Integer adminId) {
|
||||
if (adminId == 0) {
|
||||
return getOne(query().getWrapper().eq("id", id));
|
||||
}
|
||||
return getOne(query().getWrapper().eq("id", id).eq("admin_id", adminId));
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,9 @@
|
||||
</sql>
|
||||
|
||||
<select id="paginate" resultType="xyz.playedu.common.domain.AdminLog">
|
||||
SELECT `admin_logs`.*
|
||||
SELECT `admin_logs`.`id`,`admin_logs`.`admin_id`,`admin_logs`.`admin_name`,`admin_logs`.`module`,`admin_logs`.`title`,
|
||||
`admin_logs`.`opt`,`admin_logs`.`method`,`admin_logs`.`request_method`,`admin_logs`.`url`,`admin_logs`.`ip`,`admin_logs`.`param`,
|
||||
`admin_logs`.`ip_area`,`admin_logs`.`created_at`
|
||||
FROM `admin_logs`
|
||||
<where>
|
||||
<if test="adminId != null">
|
||||
|
Loading…
x
Reference in New Issue
Block a user