package com.vincent.rsf.server.system.controller;
|
|
import com.vincent.rsf.framework.common.R;
|
import com.vincent.rsf.httpaudit.entity.HttpAuditLog;
|
import com.vincent.rsf.server.common.domain.BaseParam;
|
import com.vincent.rsf.server.common.domain.PageParam;
|
import com.vincent.rsf.server.system.service.HttpAuditLogService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Arrays;
|
import java.util.Map;
|
|
@RestController
|
public class HttpAuditLogController extends BaseController {
|
|
@Autowired
|
private HttpAuditLogService httpAuditLogService;
|
|
@PreAuthorize("hasAuthority('system:httpAuditLog:list')")
|
@PostMapping("/httpAuditLog/page")
|
public R page(@RequestBody Map<String, Object> map) {
|
BaseParam baseParam = buildParam(map, BaseParam.class);
|
PageParam<HttpAuditLog, BaseParam> pageParam = new PageParam<>(baseParam, HttpAuditLog.class);
|
return R.ok().add(httpAuditLogService.page(pageParam, pageParam.buildWrapper(true)));
|
}
|
|
@PreAuthorize("hasAuthority('system:httpAuditLog:list')")
|
@GetMapping("/httpAuditLog/{id}")
|
public R get(@PathVariable("id") Long id) {
|
return R.ok().add(httpAuditLogService.getById(id));
|
}
|
|
@PreAuthorize("hasAuthority('system:httpAuditLog:remove')")
|
@PostMapping("/httpAuditLog/remove/{ids}")
|
public R remove(@PathVariable Long[] ids) {
|
if (!httpAuditLogService.removeByIds(Arrays.asList(ids))) {
|
return R.error("Delete Fail");
|
}
|
return R.ok("Delete Success");
|
}
|
}
|