| | |
| | | import com.oying.domain.SysLog; |
| | | import com.oying.domain.dto.SysLogQueryCriteria; |
| | | import com.oying.service.SysLogService; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | |
| | | @GetMapping |
| | | @ApiOperation("日志查询") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<PageResult<SysLog>> queryLog(SysLogQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryLog(SysLogQueryCriteria criteria) { |
| | | criteria.setLogType("INFO"); |
| | | Page<SysLog> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(sysLogService.queryAll(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/user") |
| | | @ApiOperation("用户日志查询") |
| | | public ResponseEntity<PageResult<SysLog>> queryUserLog(SysLogQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryUserLog(SysLogQueryCriteria criteria) { |
| | | criteria.setLogType("INFO"); |
| | | criteria.setUsername(SecurityUtils.getCurrentUsername()); |
| | | Page<SysLog> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(sysLogService.queryAllByUser(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.queryAllByUser(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/error") |
| | | @ApiOperation("错误日志查询") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<PageResult<SysLog>> queryErrorLog(SysLogQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryErrorLog(SysLogQueryCriteria criteria) { |
| | | criteria.setLogType("ERROR"); |
| | | Page<SysLog> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(sysLogService.queryAll(criteria,page), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/error/{id}") |
| | | @ApiOperation("日志异常详情查询") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<Object> queryErrorLogDetail(@PathVariable Long id){ |
| | | return new ResponseEntity<>(sysLogService.findByErrDetail(id), HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(sysLogService.findByErrDetail(id)), HttpStatus.OK); |
| | | } |
| | | |
| | | @DeleteMapping(value = "/del/error") |
| | | @Log("删除所有ERROR日志") |
| | | @ApiOperation("删除所有ERROR日志") |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<Object> delAllErrorLog(){ |
| | | sysLogService.delAllByError(); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @DeleteMapping(value = "/del/info") |
| | |
| | | @PreAuthorize("@el.check()") |
| | | public ResponseEntity<Object> delAllInfoLog(){ |
| | | sysLogService.delAllByInfo(); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |